Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-28547-rev1
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews committed Oct 29, 2021
2 parents e8d3462 + 11dc187 commit bb0e605
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.view.TiDrawableReference;
import org.appcelerator.titanium.view.TiUIView;

import ti.modules.titanium.ui.AttributedStringProxy;
Expand Down Expand Up @@ -311,18 +310,17 @@ private void updateButtonImage()
}

// Fetch the image.
TiDrawableReference drawableRef = null;
Drawable drawable = null;
Object imageObject = this.proxy.getProperty(TiC.PROPERTY_IMAGE);
if (imageObject != null) {
drawableRef = TiDrawableReference.fromObject(this.proxy.getActivity(), imageObject);
drawable = TiUIHelper.getResourceDrawable(imageObject);
}

// Update button's image/icon.
if (drawableRef != null) {
if (drawable != null) {
boolean imageIsMask = TiConvert.toBoolean(this.proxy.getProperty(TiC.PROPERTY_IMAGE_IS_MASK), true);
String colorString = TiConvert.toString(this.proxy.getProperty(TiC.PROPERTY_TINT_COLOR));
int colorValue = (colorString != null) ? TiConvert.toColor(colorString) : this.defaultColor;
Drawable drawable = drawableRef.getDensityScaledDrawable();
if (button instanceof MaterialButton) {
MaterialButton materialButton = (MaterialButton) button;
materialButton.setIcon(drawable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ protected Drawable generateSelectedDrawable(KrollDict properties, Drawable drawa
stateDrawable.addState(new int[] { android.R.attr.state_activated }, new ColorDrawable(COLOR_SELECTED));
}

// NOTE: Android 6.0 and below require ShapeDrawable to have non-null Shape.
// This bug is fixed on Android 7.0 and above.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
// NOTE: Android 7.1 and below require ShapeDrawable to have non-null Shape.
// This bug is fixed on Android 8.0 and above.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
Drawable currentDrawable = drawable;

if (currentDrawable instanceof RippleDrawable) {
Expand Down

0 comments on commit bb0e605

Please sign in to comment.