MultiSearchView icon indicating copy to clipboard operation
MultiSearchView copied to clipboard

Request (Style Programically)

Open rgocal opened this issue 5 years ago • 51 comments

Setting a style via xml doesn't really help in an app where the gui dynamically changes based on colors. I would enjoy the ability to tint the search icon and text via code.

rgocal avatar Aug 31 '20 00:08 rgocal

@rgocal , you can check my pull request that gives you the ability to change the search icon color . Check it out at #16

kojofosu avatar May 18 '21 06:05 kojofosu

Sweet

rgocal avatar May 18 '21 09:05 rgocal

let me know when you have issues. Since it has not been merged with the upstream branch, you may need to go to jitpack to get my build

kojofosu avatar May 18 '21 10:05 kojofosu

Alright, il give this a go sometime later. Working on a main project atm

rgocal avatar May 18 '21 10:05 rgocal

How do we include your build in a project? The documentation in your github still points to this project instead. What specifically is the Gradle implementation/api syntax for your build in jitpack?

ryust avatar Jul 19 '21 12:07 ryust

@ryust use this build implementation 'com.github.kojofosu:MultiSearchView:0.4'

i updated my README, you can check it out at https://github.com/kojofosu/MultiSearchView

kojofosu avatar Jul 19 '21 13:07 kojofosu

Thanks for the update. Unfortunately, I wasn't able to get things to work. It would be sooooooooo much simpler if there was a getter method on the EditText so that I can easily change items programmatically (like hint) instead of messing around with XML styles and trying to hook it all together when using multiple 3rd party libraries.

ryust avatar Jul 19 '21 13:07 ryust

@ryust your request seems to be on the edittext itself rather than the icon ..am I right? If yes, i think i can work on that for you

kojofosu avatar Jul 19 '21 13:07 kojofosu

Yes, exactly. The original post request was to set styles programmatically… regardless of the widget. So getter methods is the easiest way to access underlying components so developers have the most flexibility to modify the widgets via code (not XML). I’m surprised the original library didn’t have it, but apparently that developer has abandoned the project. Thanks for taking it over!

On Jul 19, 2021, at 8:56 AM, Kojo Fosu Bempa Edue @.***> wrote:

@ryust https://github.com/ryust your request seems to be on the edittext itself rather than the icon ..am I right? If yes, i think i can work on that for you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iammert/MultiSearchView/issues/11#issuecomment-882568679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGR4SXYMU4QZ5LQOM7KNLTYQVHHANCNFSM4QP6IQXQ.

ryust avatar Jul 19 '21 14:07 ryust

@ryust your request seems to be on the edittext itself rather than the icon ..am I right? If yes, i think i can work on that for you

Any idea when you could get something working? If awhile, then I'll look at other search libraries. This one looked good, but it's very inflexible in customization... I just can't get the styles XML method to work in my project.

ryust avatar Jul 21 '21 14:07 ryust

Will Friday be too far out for you? Currently wrapping up on another library I'm building .

On Wed, 21 Jul 2021, 2:22 pm Ron Yust, @.***> wrote:

@ryust https://github.com/ryust your request seems to be on the edittext itself rather than the icon ..am I right? If yes, i think i can work on that for you

Any idea when you could get something working? If awhile, then I'll look at other search libraries. This one looked good, but it's very inflexible in customization... I just can't get the styles XML method to work in my project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iammert/MultiSearchView/issues/11#issuecomment-884230119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2ERLWYZDDQDF7OIN6CU3LTY3JY7ANCNFSM4QP6IQXQ .

kojofosu avatar Jul 21 '21 14:07 kojofosu

Friday will work. Thanks!

ryust avatar Jul 21 '21 14:07 ryust

@ryust I've added getter and setter method to change search hint...will have time to make the editext itself accessible. Are there any other customizations you would like me to prioritize?

kojofosu avatar Jul 22 '21 21:07 kojofosu

Thanks! The hint was the most important attribute, but having complete control of the EditText is ideal. I'll work with what you've done.

ryust avatar Jul 22 '21 22:07 ryust

@ryust alright, let me know if there are any issues. And to change the hint, you will need to remove the line that sets the "style" for the search view in the xml

kojofosu avatar Jul 22 '21 22:07 kojofosu

Well.... that's the core of my problem... I don't use XML layouts and create UI views programmatically. So if I have to mess with styles and XML, then I'm back to my original problem... I won't be able to use what you've done.

ryust avatar Jul 22 '21 22:07 ryust

@ryust you don't need xml for that. you can do everything programmatically now. Just try it and let me know how it goes

kojofosu avatar Jul 22 '21 22:07 kojofosu

OK, I got the hint to work and that works well, but have a couple other issues with the new library:

  1. I wanted change the icon color programmatically, but it appears that the setSearchIconColor expects an argument of a color resource... I want to use a Color directly instead.

  2. When creating multiple search items, the length of each is much wider than the original library... to the point that you can't see multiple items at the same time in the search.

ryust avatar Jul 23 '21 20:07 ryust

Alright. I'll look into that for you !

On Fri, 23 Jul 2021, 8:50 pm Ron Yust, @.***> wrote:

OK, I got the hint to work and that works well, but have a couple other issues with the new library:

I wanted change the icon color programmatically, but it appears that the setSearchIconColor expects an argument of a color resource... I want to use a Color directly instead. 2.

When creating multiple search items, the length of each is much wider than the original library... to the point that you can't see multiple items at the same time in the search.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iammert/MultiSearchView/issues/11#issuecomment-885907001, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2ERLTBC4LYKUWFFKM7ZU3TZHI2RANCNFSM4QP6IQXQ .

kojofosu avatar Jul 23 '21 20:07 kojofosu

Great! And I also need the ability to tint the hint for dark mode colors. :)

ryust avatar Jul 26 '21 15:07 ryust

alright

kojofosu avatar Jul 27 '21 08:07 kojofosu

@ryust kindly check version 0.6

kojofosu avatar Jul 27 '21 12:07 kojofosu

That version is not found. Gradle can't find it.

ryust avatar Jul 27 '21 12:07 ryust

try again..Jitpack didn't finish building at that time..my bad @ryust

kojofosu avatar Jul 27 '21 12:07 kojofosu

I'm about to give up on the library. Now creating MultiSearchView programmatically (as I've done before) results in a NPE:

java.lang.NullPointerException at com.iammert.library.ui.multisearchviewlib.MultiSearchView.(MultiSearchView.kt:58) at com.iammert.library.ui.multisearchviewlib.MultiSearchView.(MultiSearchView.kt:14) at com.iammert.library.ui.multisearchviewlib.MultiSearchView.(Unknown Source:6)

ryust avatar Jul 27 '21 12:07 ryust

@ryust i apologize once again. These were quick fixes and i didnt really test for the nullpointer exception. But that has been fixed in 0.7 now.

kojofosu avatar Jul 27 '21 13:07 kojofosu

android.content.res.Resources$NotFoundException: Resource ID #0xff43a047
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:215)
    at android.content.res.Resources.getColorStateList(Resources.java:1020)
    at androidx.core.content.res.ResourcesCompat.getColorStateList(ResourcesCompat.java:195)
    at androidx.core.content.ContextCompat.getColorStateList(ContextCompat.java:519)
    at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:48)
    at com.iammert.library.ui.multisearchviewlib.MultiSearchView.setSearchIconColor(MultiSearchView.kt:85)

ryust avatar Jul 27 '21 13:07 ryust

And the width of the search items still take up the full width of the parent view unlike the original library so you can't really see more than one search item at a time.

ryust avatar Jul 27 '21 13:07 ryust

setHintColor(Integer value)

What exactly is Integer? Resource id? Color int?

ryust avatar Jul 27 '21 14:07 ryust

android.content.res.Resources$NotFoundException: Resource ID #0xff43a047
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:215)
    at android.content.res.Resources.getColorStateList(Resources.java:1020)
    at androidx.core.content.res.ResourcesCompat.getColorStateList(ResourcesCompat.java:195)
    at androidx.core.content.ContextCompat.getColorStateList(ContextCompat.java:519)
    at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:48)
    at com.iammert.library.ui.multisearchviewlib.MultiSearchView.setSearchIconColor(MultiSearchView.kt:85)

how are you setting the color?

kojofosu avatar Jul 27 '21 14:07 kojofosu