ContactAutoCompleteTextView
ContactAutoCompleteTextView is a view which allows the user to search across all his contacts to get email or phone number.
The thread to get the data is asynchronous, which allow the view to load very fast (without this, you can need 1 to 2 seconds for 1500 contacts).
[Javadoc] (http://lolobosse.github.io/ContactsAutoCompleteTextView/)
Demo
Roadmap
- Test the stability of the lib and improve the lifecycles of it (cache data)
- Add the ability to have postal addresses
- Add the photo from all contact providers (not only from the local storage --> we want to have as many photos as in the native contact app).
- Test on other resolutions: XHDPI, XXHDPI, XXXHDPI (Please open issue, even if it works, to allow me to update the readme...)
- Write/Improve wiki
- Test the possibility of changing the adapter.
- Make a maven version.
- Write a demo app.
How does it work?
Lib available for Gradle:
compile 'com.github.lolobosse.contactsautocompletetextview:library:0.1.2'
And for Maven:
<dependency>
<groupId>com.github.lolobosse.contactsautocompletetextview</groupId>
<artifactId>library</artifactId>
<version>0.1.2</version>
<type>aar</type>
</dependency>
Create a subfolder in your project folder, navigate to it with terminal and then type:
git clone https://github.com/lolobosse/ContactsAutoCompleteTextView.git
Import it in Android studio as a module. (or make it directly from VCS Github menu of Android Studio).
Then create a view, for example like this:
<com.meyerlaurent.cactv.AutoCompleteContactTextView
android:id="@+id/fragment_send_auto_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
auto:typedLettersHaveDifferentStyle="true"
auto:styleOfTypedLetters="bold"
auto:displayPhotoIfAvailable="true"
auto:typeOfData="email"/>
DO NOT FORGET TO SET:
xmlns:auto="http://schemas.android.com/apk/res-auto"
on your parent layout.
Enjoy 😄
Attributes
colorOfData
: (color) color of the data which will be displayedcolorOfNames
: (color) color of the name of concerned peopletypedLettersHaveDifferentStyle
: (boolean) if you set it to true the letter you type will be highlighted in the name of the person.styleOfTypedLetters
: (enum) (only available iftypedLettersHaveDifferentStyle
true), the highlight of letters will be underlined or bold.getTextPattern
: (String) return pattern of the name selected, make your combinations with:[N]
: Name of people in upper case.[n]
: Name of people in lower case.[Nn]
: Name in normal style. For Example: Laurent.[d]
: The data
displayPhotoIfAvailable
: (boolean) Should the view include the photo of the contact.typeOfData
: (enum) What you want for dataphone
: Phone numbersemail
: Emails
###ChangeMap###
The software is under MIT License.
The MIT License (MIT)
Copyright (c) Laurent Meyer, 2015
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.