From 7a78a09e052e64da5cbe1592a1f31f7301d912ff Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Mon, 22 Jan 2024 19:15:58 +0100 Subject: [PATCH 1/2] fix(android): fix Android FAB tintColor --- .../titanium/ui/widget/TiUIFloatingActionButton.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIFloatingActionButton.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIFloatingActionButton.java index 956f203d3da..c63fd5d79a1 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIFloatingActionButton.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIFloatingActionButton.java @@ -7,6 +7,7 @@ package ti.modules.titanium.ui.widget; import android.content.res.ColorStateList; +import android.graphics.PorterDuff; import com.google.android.material.floatingactionbutton.FloatingActionButton; @@ -54,6 +55,9 @@ public void processProperties(KrollDict d) if (d.containsKey("maxImageSize")) { setMaxImageSize(TiConvert.toInt(d.get("maxImageSize"))); } + if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) { + setTintColor(d.getString("tintColor")); + } if (d.containsKeyAndNotNull(TiC.PROPERTY_TOUCH_FEEDBACK_COLOR)) { ColorStateList colorStateList = null; colorStateList = ColorStateList.valueOf( @@ -91,6 +95,12 @@ private void setImage(Object obj) } } + public void setTintColor(String color) + { + int tintColor = TiConvert.toColor(color, TiApplication.getAppCurrentActivity()); + fab.setColorFilter(tintColor, PorterDuff.Mode.SRC_IN); + } + @Override public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { @@ -106,6 +116,8 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP ColorStateList colorStateList = null; colorStateList = ColorStateList.valueOf(TiConvert.toColor(newValue, proxy.getActivity())); fab.setRippleColor(colorStateList); + } else if (key.equals(TiC.PROPERTY_TINT_COLOR)) { + setTintColor(TiConvert.toString(newValue)); } } } From 46aaaea957fbf3e048494440fe3f6deb9e9e481e Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 30 Jan 2024 21:56:25 +0100 Subject: [PATCH 2/2] remove from excludes --- apidoc/Titanium/UI/Android/FloatingActionButton.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apidoc/Titanium/UI/Android/FloatingActionButton.yml b/apidoc/Titanium/UI/Android/FloatingActionButton.yml index 02d016ba4f5..b42eda0f788 100644 --- a/apidoc/Titanium/UI/Android/FloatingActionButton.yml +++ b/apidoc/Titanium/UI/Android/FloatingActionButton.yml @@ -17,7 +17,7 @@ excludes: backgroundImage, backgroundLeftCap, backgroundRepeat, backgroundSelectedColor, backgroundSelectedImage, backgroundTopCap, borderColor, borderRadius, borderWidth, center, children, clipMode, focusable, height, horizontalWrap, keepScreenOn, layout, opacity, overrideCurrentAnimation, - pullBackgroundColor, rect, size, softKeyboardOnFocus, tintColor, touchEnabled, touchFeedback, transform, + pullBackgroundColor, rect, size, softKeyboardOnFocus, touchEnabled, touchFeedback, transform, viewShadowColor, viewShadowOffset, viewShadowRadius, width, zIndex] events: