-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to set a chip icon from a URL image? #18
Comments
At the moment no. I may work on a pull request on this for the future. Essentially, you will need to manage the download/transformation of the image yourself, then pass this on to recreate the chip when the image is ready. If I do work on this, I'll work on an example that uses Glide or Picasso to do the downloading. |
Thanks for the quick answer, @tylerjroach! |
@maxmiliano The problem with that approach is that you may not have an ImageView. If you are inserting the chip from a list, you may have already loaded in an image that you can then use getDrawable() for. Although you will need to do the bitmap transformation/sizing into the chip yourself. If the image had not yet loaded into its row (or you aren't showing an image), then you will not have the drawable to insert into the chip. Glide has custom targets https://github.com/bumptech/glide/wiki/Custom-targets that would be useful for the purpose of downloading the images. In the callback, you could then pass the bitmap when you recreate a chip. There are a few methods that will need to be added to Nachos to support this. Chip recreation and dynamic bitmap passing to name a few. I may work on this in the next few weeks but I can't promise I will get to it. Nachos is pretty simple, so create a fork and see for yourself what you can come up with! The Hootsuite devs are responsive for suggested pull requests if you figure it out. :) |
I implemented this one. |
If not possible without tweaks, I might try "Chip recreation" after loading url image as a last resort. |
@tylerjroach any word on glide implementation? |
@bagintz No, sorry, I am no longer using Nachos. |
@tylerjroach are you using an alternative that does load images via url? |
I ended up going with using a RecyclerView to handle chip creation since it will be more performant in the long run. See this project: https://github.com/BelooS/ChipsLayoutManager Of course, the difference between the projects is that Nachos uses TextView spans which allow you to continue typing inline. For our ui, this wasn't a big deal having to split the EditText and the chip list to separate rows. There is another project that I haven't tried that attempts to inline the edittext while also using a recyclerview at the same time. https://github.com/tylersuehr7/chips-input-layout This project is based on the ChipsLayouutManager project. |
@miroslavign try invalidateChips on your NachoTextView after loading |
@bagintz I tried that and a whole lot of other invalidate's |
@miroslavign I was able to accomplish url loading with this |
Is there a way to set the icon from a URL image or maybe change it at runtime?
The text was updated successfully, but these errors were encountered: