klinker41 / android-chips Goto Github PK
View Code? Open in Web Editor NEWChips in your AutoCompleteTextView on Android
Chips in your AutoCompleteTextView on Android
Are there any plans to check for permissions for Marshmallow if not what would be the best way to disable pulling from the contacts provider? Would just not setting the adapter be sufficient?
I cant get the contact chips to be shown and suggested. If I download the whole sample project completely and run it, that project works. But If I add the chips library to into my own project gradle like instructed in Readme (or just add chips library as a module) it gives this security exception.
My phone is nexus 6 on api 22. And this is logcats Log.
08-25 21:12:38.604 4380-4533/com.sepidsa.fortytwocalendar W/Filter﹕ An exception occured during performFiltering()!
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{1ce44f5 4380:com.sepidsa.fortytwocalendar/u0a197} (pid=4380, uid=10197) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3314)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4624)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2472)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1442)
at android.content.ContentResolver.query(ContentResolver.java:462)
at android.content.ContentResolver.query(ContentResolver.java:422)
at com.android.ex.chips.BaseRecipientAdapter.doQuery(BaseRecipientAdapter.java:953)
at com.android.ex.chips.BaseRecipientAdapter.access$100(BaseRecipientAdapter.java:63)
at com.android.ex.chips.BaseRecipientAdapter$DefaultFilter.performFiltering(BaseRecipientAdapter.java:248)
at android.widget.Filter$RequestHandler.handleMessage(Filter.java:234)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
Hello, I have been debugging the code since a day to replica as a android default messenger application but didn't get through the exact path. Could you please help me out to show the contact details on a recycler view under the AutoCompleteTextView instead of adding them to the ACTV as a dropdown list. TIA.
When searching for contacts via email, I'll start typing, and for 2 letters I'll get back one result, and with 3 I'll get back a different, single result - the the first result is still valid for the query. I'll type someone's first name, and get back one contact, but have other contacts with first name and email that also match, but which aren't returned.
Things like:
Contact Name: Suzy, email address: role@host
Contact Name: Ron M, email address ronm@host
Contact Name, Ron N, email address ron.name@otherhost
If I type "ro", only Suzy is returned.
If I type "ron", only Ron M is returned.
To get to Ron N, I have to type "ron.n"
"ro" should match all 3?
"ron" should match Ron M and Ron N?
Sometimes name matching works, even if the email address doesn't contain the name. Sometimes names aren't included in the results, especially if there's an email address match.
I've searched in a lot of places, as I've made a similar library a long time ago:
https://github.com/AndroidDeveloperLB/ChipsLibrary
I'm just curious...
Note: Copied from https://github.com/klinker-apps/messenger-issues/issues/689
Device with issue: Samsung Galaxy A7 (2017)
App version: 3.1.1.2131
Steps to reproduce:
Additional information:
Just avoid duplicating items by removing a chosen recipient from the list after adding him to the edit box.
When I'm writing, the filter not displays results.
hi,
how do I prevent if a phone number is selected twice or more than one time.
Hi,
When I call submitItem(displayName, strMailId, Uri.parse(photoUri), photoBytes) on RecipientEditTextView, it does not display contact photo
Hi,
How to use a customer adapter with custom listener ?
I am building an application where when a use post a problem, he have to indicate a circle where the problem should be send.
I want a custom adapter, layout for the circle he choose. Also a custom listener when he clicks on the circle because a click on a circle must display the list of people of the circle.
How to do it please ?
Taken from: https://github.com/klinker-apps/messenger-issues/issues/588
Not sure about how to reproduce it, but if you play with it enough, you can get this exception.
Here's the log:
08-22 13:05:36.751 22900-22900/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.android.ex.chips.sample, PID: 22900
java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at com.android.ex.chips.BaseRecipientAdapter.isEnabled(BaseRecipientAdapter.java:1004)
at android.widget.ListView.dispatchDraw(ListView.java:3363)
at android.view.View.draw(View.java:16206)
at android.widget.AbsListView.draw(AbsListView.java:5984)
at android.view.View.updateDisplayListIfDirty(View.java:15126)
at android.view.View.getDisplayList(View.java:15149)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3687)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3666)
at android.view.View.updateDisplayListIfDirty(View.java:15086)
at android.view.View.getDisplayList(View.java:15149)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:275)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:320)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2751)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2584)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2176)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
All data
Hi,
Do you plan to filter out or not allow duplicate entries?
I'm having Rendering issues using this library. Here's the reported log from the Android Studio 2.2.2 preview:
java.lang.ClassCastException: com.android.layoutlib.bridge.android.view.WindowManagerImpl cannot be cast to android.view.WindowManagerImpl at android.view.Window.setWindowManager(Window.java:743) at android.view.Window.setWindowManager(Window.java:724) at android.app.Dialog.<init>(Dialog.java:187) at android.app.Dialog.<init>(Dialog.java:147) at com.android.ex.chips.RecipientEditTextView.<init>(RecipientEditTextView.java:244) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
I've tried syncing, cleaning, rebuilding, invalidating caches and restarting, changing api level, changing theme, but it doesn't work. If I remove the RecipientEditTextView
the error goes. Here's the view:
<com.android.ex.chips.RecipientEditTextView android:layout_width="match_parent" android:layout_height="wrap_content" />
aapt2
outputs the following warning and error:
warn: skipping element 'g' with unknown namespace 'http://schemas.android.com/tools'
For the line at https://github.com/klinker41/android-chips/blob/master/library/src/main/res/values/strings.xml#L18 (note, this is a warning, not an error)
And also:
error: invalid resource type 'attr' for parent of style
for the line at https://github.com/klinker41/android-chips/blob/master/library/src/main/res/values/styles.xml#L18
I believe the error is a legitimate error because the style at that line inherits from "@android:attr/fooBar" as opposed to "@android:style/fooBar"
I believe the fix is as simple as updating that line accordingly but would require testing to verify
Could you please send me a code
I don't have the same number anymore
After rotation, clicking on show all contacts is not showing the popup window. If I search a letter in RecipientEditTextView, from then on show all contacts button click is working. But I could see the log from BaseRecipientAdapter all the time, not the popup window. Suggestions please.
Hi, it doesn't seem like android-chips
would need any ProGuard configuration. Can you confirm this? Thanks!
i need to get tags from user and i don't need any icon on left side, as per my requirements i need both end in round shape. Please suggest me how i can modify this library
How do I go about to remove a chip from the RecipientEditTextView programmatically? Previously there was a removeParticipant function but not anymore? Also, I create a RecipientEntry and populate the RecipientEditTextView from my own contact list, but everytime I add the entry using the addRecipient, two chips are created. One without an avatar and one with and avatar? How do I stop this from happening?
Hi,
even when I set android:lines or android:maxLines on RecipientEditTextView with width="match_parent", when a new chip is longer than RecipientEditTextView relative remaining space, there is no line return before adding it.
Is it a bug or have I missed something?
Best regards.
Hi,
I'm getting one issue on selecting a chip which is added by submitItem
is not able to delete the chip. Please see the below screenshot
FYI: It's working good when selecting a chip from filtered dropdown. Please see the below screenshot
Can you suggest me to fix the first one to become like second one?
Hi,
How to programmaticaly remove a chip ? Like the first or second chip ?
Thanks.
Thanks for this library; It's really well-done, and amazingly easy to use. I have a question though. Is there a way I can pre-populate a RecipientEditTextView with contacts? I.e., when I create my Activity or Fragment, I want to take a list of pre-existing names and phone numbers, and add them to the TextView as chips. Is this possible?
Thank you for your help!
I see there has been some nice improvements made to this library since last time I looked at it. However, I've noticed that the chip outline and contact pictures are pixelated.
It looks like it doesn't apply any filtering or AA when downscaling the image or something like that. Anyone else able to reproduce this?
Additionally, while the above issue doesn't affect the dropdown view, that view has an alignment issue where the primary and alternate numbers are misaligned in a very obvious way. How about using the same layout as the equivalent dropdown in the Phone app in 7.x or newer?
In my Existing Chip I have 2 chip already and added another chip , choosing from android contact list but when add with existing chip it broken chip bubble
String phNos = toPhone.getText().toString().trim()+phone+",";
toPhone.setText(phNos);
I am Passing the Name and Number of a Contact from one activity to another and using these Number and Name.
I Construct a RecipientEntry By using constructorGeneratedEntry and passing the name and number in those with isValid true, But when I add the Recipient to the RecipientEditTextView it generates Two chips, one consists of Number while the other one consists of the Name.
RecipientEntry entry = RecipientEntry.constructGeneratedEntry(name, number, true);
phoneRetv.addRecipient(entry);
Other than email and contact, suppose i have some options ( probably a list having an option) and a layout where i will show the chosen ones from the list, is that possible?
If I put in and email address for someone that is not in my contact list there is no way to create a chip for that email.
In the gmail app for example if the email address is not in the contact list all you do is put a space in and it will create a chip for that address however putting in a space here does not do this and the only way to create a chip is to focus on something else.
Either that or do like the hangouts app does where you select the item from the Autocomplete list but as it stands this is broke.
I have not tried this with phone numbers so I do not know if that works correctly or not.
Edit:
I see that using a comma creates it but IMO you cannot expect the user to know this, use a comma or a space?
Edit 2:
I think I see the problem, in the method lastCharacterIsCommitCharacter
of class RecipientEditTextView
you do
return last == COMMIT_CHAR_COMMA || last == COMMIT_CHAR_SEMICOLON;
but you are missing COMMIT_CHAR_SPACE
first two chip I have selected from my suggesting list and add another contact 8697374578 using keyboard and putting next character , but 8697374578 does not create any chip for 8697374578.If I put space in state of " , " it create chip for that phone no.............please help me
Would be great if a method could be exposed to grab the remaining raw text (aka the current query string) excluding all tokenized chips
I am using two autocompleteTextView. I want to filter those contacts which is already exist in another .
I cannot filter contact list .Can you suggest me how to do it ?
I want to implement application which provides option to user to select contacts. Once user close that application and restart it then that contacts should be appear in Chip Edittext.
I used "submitItem" method but it is not working at all.
So Is there a way to set multiple Contacts ?
I have used this library for one of my application. But there are two issues which i have noticed.
If I do backspace the chips transform into "[email protected]" instead of removing
Dear developers,
I found an inefficient API, setImageURI(), is used in chips.
For setImageURI(), Google says this:
https://developer.android.com/reference/android/widget/ImageView.html#setImageURI(android.net.Uri)
" This does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that's a concern, consider using setImageDrawable(android.graphics.drawable.Drawable) or setImageBitmap(android.graphics.Bitmap) and BitmapFactory instead. "
I noticed that in the following code, setImageURI() is used:
com.android.ex.chips.DropdownChipLayouter.java bindIconToView() (line number: 181)
https://github.com/klinker41/android-chips/blob/master/library/src/main/java/com/android/ex/chips/DropdownChipLayouter.java#L181
and bindIconToView() is invoked indirectly by:
com/android/ex/chips/RecipientAlternatesAdapter.java getView()
https://github.com/klinker41/android-chips/blob/master/library/src/main/java/com/android/ex/chips/RecipientAlternatesAdapter.java#L546
getView() callback is frequently invoked in the UI thread and this means that setImageURI() will be called many times in the UI thread.
Since setImageURI() is a slow operation, for performance considerations, I think we should perform these operations in worker threads (e.g., via AsyncTask).
In addition, when loading an image, Google suggests us to resize the image before decoding them, so as to save memory resource and avoid OutOfMemory exception.
https://developer.android.com/topic/performance/graphics/load-bitmap.html
" To avoid java.lang.OutOfMemory exceptions, check the dimensions of a bitmap before decoding it, unless you absolutely trust the source to provide you with predictably sized image data that comfortably fits within the available memory "
If the photos processed by setImageURI() are larger than required. Perhaps we should resize the images before reading and decoding them, which can reduce time and memory overhead and help make app more smooth in user interaction (using setImageDrawable(Drawable) or setImageBitmap(android.graphics.Bitmap) and BitmapFactory instead.).
Do you think the use of setImageURI() will affect chips's performance? If yes, for performance considerations, maybe we should optimize it.
Thanks.
Hi,
I added contacts with method addRecipient, and get duplicate chips.
Here my code:
activity.xml
<com.android.ex.chips.RecipientEditTextView android:id="@+id/phone_retv" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:textColor="@color/colorPrimary" android:fontFamily="@font/montserrat" android:minHeight="58dp" />
on Activity.kt
lateinit var numbersTo: RecipientEditTextView
override fun onCreate(savedInstanceState: Bundle?) {
...
numbersTo = findViewById(R.id.phone_retv)
numbersTo.maxChips = 10
numbersTo.setTokenizer(MultiAutoCompleteTextView.CommaTokenizer())
val adapterRecipientEditTextView =
BaseRecipientAdapter(BaseRecipientAdapter.QUERY_TYPE_PHONE, this)
adapterRecipientEditTextView.isShowMobileOnly = true
numbersTo.setAdapter(adapterRecipientEditTextView)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
...
val entry = RecipientEntry.constructGeneratedEntry(displayName, mainNumber, true)
numbersTo.addRecipient(entry)
}
this a result:
![screenshot_1544651248](https://user-images.githubusercontent.com/4046890/49900816-50c5e300-fe68-11e8-8e92-556b4b10259b.png)
You can help me?
I know this very very trivial. After geting all the chips with:
DrawableRecipientChips[] chips = phoneRetv.getSortedRecipients();
how do i send it to another activity?
I tried:
Intent intent = new Intent(this, editList.class);
intent.putStringArrayListExtra("chips", DrawableRecipientChips[]);
startActivity(intent)
But its not working. please help.
Btw,
Great Libary 👯
You said it wasn't possible, but if that was a year ago and I'd like to know if it has been added.
Hi,
I was looking into using this library for an app I'm making where only one recipient is allowed. Is there a simple way to impose that kind of limit with the current version of the lib or would you suggest that I fork it and modify the library code to impose that limit?
Hi,
I am probably missing something so hopefully someone can help. I would like to commit a new chip using a software button instead of the keyboard enter key. Is there a function I can call to do this? Most of the functions responsible for creating a new chip are private it seems. Hope this is simple!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.