{"id":13645595,"url":"https://github.com/quiin/UnifiedContactPicker","last_synced_at":"2025-04-21T14:31:56.394Z","repository":{"id":57722270,"uuid":"79880200","full_name":"quiin/UnifiedContactPicker","owner":"quiin","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-06T16:01:05.000Z","size":164,"stargazers_count":177,"open_issues_count":9,"forks_count":32,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-04T06:11:16.896Z","etag":null,"topics":["android","android-library","chip","material","phone"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quiin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-24T05:01:36.000Z","updated_at":"2024-01-09T03:49:02.000Z","dependencies_parsed_at":"2022-08-29T22:31:48.646Z","dependency_job_id":null,"html_url":"https://github.com/quiin/UnifiedContactPicker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiin%2FUnifiedContactPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiin%2FUnifiedContactPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiin%2FUnifiedContactPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiin%2FUnifiedContactPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quiin","download_url":"https://codeload.github.com/quiin/UnifiedContactPicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070233,"owners_count":21369840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","chip","material","phone"],"created_at":"2024-08-02T01:02:38.097Z","updated_at":"2025-04-21T14:31:55.991Z","avatar_url":"https://github.com/quiin.png","language":"Java","funding_links":[],"categories":["其他"],"sub_categories":[],"readme":"# Unified Contact Picker Android Library\n\n[![GitHub release](https://img.shields.io/github/release/quiin/UnifiedContactPicker.svg)](https://github.com/quiin/UnifiedContactPicker/releases/latest)  [![Min SDK](https://img.shields.io/badge/minSDK-15-brightgreen.svg)](https://developer.android.com/about/dashboards/index.html)  [![GitHub license](https://img.shields.io/badge/license-Apache%202-orange.svg)](https://raw.githubusercontent.com/quiin/UnifiedContactPicker/master/LICENSE)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Unified%20Contact%20Picker-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5158) \n\n## Introduction\n\nThis library unifies the user contacts in a compact and user intuitive way allowing the end-user to choose between the contact's available communication options (email/phone number) follows Material Design guidelines.\n\nAlthough there is a standard way to call the contact list in Android, it does not always feel well-integrated in your app\nAndroid applications.\nUnifiedContactPicker is an Android library which allows you to easily integrate contact picking workflow into your application with minimal effort\n\n### IMPORTANT :exclamation:\n---\nThis library is no longer in active development. However, pull requests for new features or bugfixes are always welcomed and will be attended.\n\n## Demo\n![](https://media.giphy.com/media/26xBtXCT49aFwPmCI/source.gif)\n\n## Features\n\n* Unifies user's contacts\n* Customizable UI\n* Easy and redy to use\n* Display list of contacts\n* Intuitive interface\n* Follows Material Design guidelines\n* Asynchronous contact loading\n\n\n# Installation\n\nIn order to use the library, add the following line to your **root** gradle file:\n\u003cpre\u003e \u003ccode\u003e\nrepositories {\n    jcenter()\n    maven { url \"https://jitpack.io\" }\n    ...\n}\n\u003c/code\u003e \u003c/pre\u003e\n\nAs well as this line in your project **build.gradle** file\n\u003cpre\u003e \u003ccode\u003e\ndependencies {\n    compile 'com.github.quiin:unifiedContactPicker:{LATEST_VERSION}'\n    ...\n}\n\u003c/code\u003e \u003c/pre\u003e\n\n# Usage\n\nTo use UnifiedContactPicker in your app simply follow this 3 simple steps:\n\n1. Add _read contacts_ permission in your manifest\n\n```\n    \u003cuses-permission android:name=\"android.permission.READ_CONTACTS\"/\u003e\n```\n\n2. Launch _ContactPickerActivity.java_ as activity result\n\n```java\n// Your Activity or Fragment\npublic void launchContactPicker(View view) {\n        int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS);\n        if(permissionCheck == PackageManager.PERMISSION_GRANTED){\n            Intent contactPicker = new Intent(this, ContactPickerActivity.class);\n            startActivityForResult(contactPicker, CONTACT_PICKER_REQUEST);\n        }else{\n            ActivityCompat.requestPermissions(this,\n                    new String[] {Manifest.permission.READ_CONTACTS},\n                    READ_CONTACT_REQUEST);\n        }\n    }\n\n```\n\n3. Override _onActivityResult()_  and wait for the user to select the contacts.\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    switch (requestCode){\n        case CONTACT_PICKER_REQUEST:\n            if(resultCode == RESULT_OK){\n                TreeSet\u003cSimpleContact\u003e selectedContacts = (TreeSet\u003cSimpleContact\u003e)data.getSerializableExtra(ContactPickerActivity.CP_SELECTED_CONTACTS);\n                for (SimpleContact selectedContact : selectedContacts)\n                        Log.e(\"Selected\", selectedContact.toString());\n            }else\n                Toast.makeText(this, \"No contacts selected\", Toast.LENGTH_LONG).show();\n        break;\n        default:\n            super.onActivityResult(requestCode,resultCode,data);\n        }\n}\n\n```\n\nContacts are returned in a TreeSet of *SimpleContact*; each *SimpleContact* object ha the following accessible properties:\n\n* DisplayName - Contact display name\n* Communication - Contact selected communication (email/phone)\n\n\u003e :warning:  IMPORTANT\n\u003e\n\u003e  As of SDK 23 (Android 6) developers are requested to explicitly ask for permissions at runtime. So please be sure to request for contact reading permissions using the previous code or any other means you prefer.\n\n\n## Customization\n\nThe following UI views can be customized:\n\n| UI component           |       Intent extra        | Expected value |  Type   | Sugestion |\n|:----------------------:|:-------------------------:|:--------------:|:-------:|:---------:|\n| FAB color              | CP_EXTRA_FAB_COLOR        | hexColor       | String  |       -   |\n| Selection color        | CP_EXTRA_SELECTION_COLOR  | hexColor       | String  |       -   |\n| Selection Drawable     |CP_EXTRA_SELECTION_DRAWABLE| Image          | byte [] |use PickerUtils.sendDrawable()|\n| Fab drawable           | CP_EXTRA_FAB_DRAWABLE     | Image          | byte [] |use PickerUtils.sendDrawable()|\n| Chips                  | CP_EXTRA_SHOW_CHIPS       | boolean        | boolean |       -   |\n\n\nAditionally, you can customize the contact query parameters used to extract the user's contacts adding the following extras to the intent\n\n| Extra                             |   Type    |\n|:---------------------------------:|:---------:|\n|CP_EXTRA_PROJECTION                | String [] |\n|CP_EXTRA_SELECTION                 | String    |\n|CP_EXTRA_SELECTION_ARGS            | String [] |\n|CP_EXTRA_HAS_CUSTOM_SELECTION_ARGS | boolean   |\n|CP_EXTRA_SORT_BY                   | String    |\n\n#### Example\n```java\npublic void launchContactPicker(View view) {\n        int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS);\n        if(permissionCheck == PackageManager.PERMISSION_GRANTED){\n            Intent contactPicker = new Intent(this, ContactPickerActivity.class);\n            //Don't show Chips\n            contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SHOW_CHIPS, false);\n            //Customize Floating action button color\n            contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_FAB_COLOR, \"#FFF722\");\n            //Customize Selection drawable\n            contactPicker.putExtra(ContactPickerActivity.CP_EXTRA_SELECTION_DRAWABLE, PickerUtils.sendDrawable(getResources(),R.drawable.my_drawable));\n            startActivityForResult(contactPicker, CONTACT_PICKER_REQUEST);\n        }else{\n            ActivityCompat.requestPermissions(this,\n                    new String[] {Manifest.permission.READ_CONTACTS},\n                    READ_CONTACT_REQUEST);\n        }\n    }\n```\n\n## Default values \u0026 behavior\n\n* Default projection columns:\n  * ContactsContract.Data._ID\n  * ContactsContract.Contacts.DISPLAY_NAME\n  * ContactsContract.CommonDataKinds.Phone.NUMBER\n  * ContactsContract.Data.MIMETYPE\n\n* Default selection query:\n```java\n\"(\" + ContactsContract.Data.MIMETYPE + \"=? OR \" + ContactsContract.Data.MIMETYPE + \"=?)\"\n```\n* Default selection params:\n  * ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE\n  * ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE\n* Default sorting: DisplayName Ascendant\n* A chip is added to the textview when one of the following happens:\n  * User chooses a contact from the contact list\n  * User writes a new email/phone - the chip is created after an empty space is found (\" \")\n\n## Considerations\n* In the absence of any of these extras, its value will fallback to the default value\n* If you wish to use a custom selection string (CP_EXTRA_SELECTION) with custom selection arguments (CP_EXTRA_SELECTION_ARGS) the use of CP_EXTRA_HAS_CUSTOM_SELECTION_ARGS is _required_ in order for the query to work (see defaults section for more information)\n\n\n## Support \u0026 extension\n- Feel free to make any pull request to add a new behaviour or fix some existing bug\n- Feel free to open issues if you find some bug or unexpected behaviour\n- I'll keep polishing and giving support to this library in my free time\n\n## Acknowledgments\n\n * [MaterialLetterIcon](https://github.com/IvBaranov/MaterialLetterIcon) For the cool image icon in contact list\n * [RoundedImageView](https://github.com/vinc3m1/RoundedImageView) For the rounded icon once a contact is selected\n * [ExpandableRecyclerView](https://github.com/bignerdranch/expandable-recycler-view) For the expandable recycler view in contact list\n * [Nachos](https://github.com/hootsuite/nachos) For the chip view\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiin%2FUnifiedContactPicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquiin%2FUnifiedContactPicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiin%2FUnifiedContactPicker/lists"}