GithubHelp home page GithubHelp logo

android-chips's People

Contributors

carlosrobles avatar daveeeh avatar gourave avatar johnjohndoe avatar jungyang avatar klinker24 avatar klinker41 avatar mayank26saxena avatar seanabraham avatar shusshu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-chips's Issues

Permissions checking for Marshmallow

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?

Exception when trying to show contact chips

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)

How to customize?

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.

Fuzzy matching strangeness?

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.

add a contact twice.

hi,
how do I prevent if a phone number is selected twice or more than one time.

Use custom adapter other than contact or email

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 ?

Issues deleting recipients

Taken from: https://github.com/klinker-apps/messenger-issues/issues/588

  1. Start a large group message( I do about 10 frequently, issue also happens with about 6-7 people).
  2. Edit recipients
  3. Try scrolling up the recipient list to delete a person at the top (add more recipients if scrolling is not needed)
  4. Notice how the scroll up does not stay/stick, it will automatically scroll by down, not allowing to edit/delete the top people at the top of the list

Bug: can cause IndexOutOfBoundsException on some cases

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)

com.android.ex.chips.RecipientEditTextView cannot be instantiated - Rendering issues

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" />

Packaging with aapt2 fails

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

Show all contacts is not working properly

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.

ProGuard configuration

Hi, it doesn't seem like android-chips would need any ProGuard configuration. Can you confirm this? Thanks!

How to remove chip programmatically and duplicate post when adding participant

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?

See the screenshot attached
untitled

How to force multiline on RecipientEditTextView

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.

Issue with selecting a chip to delete

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

01

FYI: It's working good when selecting a chip from filtered dropdown. Please see the below screenshot

02

Can you suggest me to fix the first one to become like second one?

Can I programmatically add chips to a RecipientEditTextView?

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!

Pixelated contact picture and chip outline

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.

Cropped screenshot

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?

How to pass a predefined recipient from one Activity to another?

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);

inkedinkedinkedscreenshot_2017-08-18-15-15-37-132_li
inkedinkedscreenshot_2017-08-18-15-15-44-468_li
inkedscreenshot_2017-08-18-15-15-40-652_li
inkedscreenshot_2017-08-18-15-15-49-359_li

Can this lib be used for any other purpose?

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?

Putting space in does not create a "chip" for unknown contact

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

filter contactList

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 ?

New Chip without icon

As I'm creating a new Chip based on a phone number on contact name, which is not matching any of the phone's contact's from the address book, the chip then does not have any icon setted,

Is that normal?

droid screen-1

How can i set multiple contacts in Chip Edittext?

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 ?

Contacts autocompletion failed for some contacts.

I have used this library for one of my application. But there are two issues which i have noticed.

  1. Not all the contacts pops in pop up list view.
  2. When i tried to delete chips, only the drawable gets deleted but it still shows the contact number.

Inefficient API is used

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.

addRecipient - duplicate chips

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?

Send DrawableRecipientChips[] to Another Activity

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 👯

Optimal way to limit the number of chips allowed?

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?

Method to create a new chip?

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.