Closed oscar-urbina-tech closed 9 years ago
You can't do it out of the box, I don't think it's a common usecase so I won't support it.
However it shouldn't be too hard to get the name back by iterating over IconValue.values()
and compare them with the "strange char" until you find a match.
Ok, Thanks! :D
First thank you for your really great library. However, you should really take into consideration the situation when the user has to compare the text. I faced this problem today and was not able to overcome it.
@Julienpraad What do you compare the text with?
For example View.getText().toString().equalIgnoreCase("{fa-heart 18sp}") is always evaluating to false even though the text of your text view is the same
I see what you mean. There's a solution for that but it would be a breaking change.
May I ask why you need to compare the text to this?
Oh I needed to change the symbol of the text when the user click on it so that a filled heart is replaced by an outlined one for example and vice versa in a recycler view grid so I won't need to add extra object fields to use them for checking purposes
It would be great to have a method to return the text, for example, "{ion-chevron-up}" so that I could validate the icon has changed to "{ion-chevron-down}" once it clicked in my Espresso automated test case.
Hope you can help, I have a xml resource file with a IconTextView:
< android.widget.IconTextView android:id="@+id/article_item_like" android:layout_width="wrap_content" android:layout_height="wrap_content" android:shadowColor="#22000000" android:shadowDx="3" android:shadowDy="3" android:shadowRadius="1" android:text="{fa-heart}" android:textColor="#FF33B5E5" android:textSize="30sp" />
In order to complete a feature, i need to get the value of that item. But when i try to get the value:
Log.i("MyTag", "This is the text:" + myIconTextView.getText().toString());
I just get a strange char in console. Is there a way to get this value? pe. Get "{fa-heart}".
Thanks!