tidev/titanium-sdk

Android: FAB tintColor

m1ga opened this issue · 2 comments

m1ga commented

Reminder for myself: check FAB tintColor

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

Check FAB tintColor

Platform

Android

SDK version you are using

12.2.1

Alloy version you are using

No response

I found this, so I tried to implement it into sdk, bot no luck so far...
My code:
if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) {
setTintColor(d.getString("tintColor"), d.get(TiC.PROPERTY_IMAGE));
}
and then

public void setTintColor(String color, Object obj)
{
int tintColor = Color.parseColor(color);
TiDrawableReference source = TiDrawableReference.fromObject(getProxy(), obj);
Drawable icon = fab.getDrawable();
icon.setColorFilter(tintColor, PorterDuff.Mode.SRC_IN);
fab.setImageDrawable(source.getDrawable());
}

But it doesn't do anything, when I comment <item name="colorOnSecondary">#ffffff</item> in theme, icon remains black...

m1ga commented

Almost correct 😄 Here is a PR #13972