Commit 9abc1d29 by olly Committed by Oliver Woodman

Don't call Drawable.setLayoutDirection pre-API-23

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174323423
parent 233a1d16
...@@ -250,9 +250,7 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -250,9 +250,7 @@ public class DefaultTimeBar extends View implements TimeBar {
try { try {
scrubberDrawable = a.getDrawable(R.styleable.DefaultTimeBar_scrubber_drawable); scrubberDrawable = a.getDrawable(R.styleable.DefaultTimeBar_scrubber_drawable);
if (scrubberDrawable != null) { if (scrubberDrawable != null) {
if (Util.SDK_INT >= 23) { setDrawableLayoutDirection(scrubberDrawable, getLayoutDirection());
scrubberDrawable.setLayoutDirection(getLayoutDirection());
}
defaultTouchTargetHeight = defaultTouchTargetHeight =
Math.max(scrubberDrawable.getMinimumHeight(), defaultTouchTargetHeight); Math.max(scrubberDrawable.getMinimumHeight(), defaultTouchTargetHeight);
} }
...@@ -519,7 +517,7 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -519,7 +517,7 @@ public class DefaultTimeBar extends View implements TimeBar {
@Override @Override
public void onRtlPropertiesChanged(int layoutDirection) { public void onRtlPropertiesChanged(int layoutDirection) {
if (scrubberDrawable != null && scrubberDrawable.setLayoutDirection(layoutDirection)) { if (scrubberDrawable != null && setDrawableLayoutDirection(scrubberDrawable, layoutDirection)) {
invalidate(); invalidate();
} }
} }
...@@ -753,6 +751,10 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -753,6 +751,10 @@ public class DefaultTimeBar extends View implements TimeBar {
return (int) (dps * displayMetrics.density + 0.5f); return (int) (dps * displayMetrics.density + 0.5f);
} }
private static boolean setDrawableLayoutDirection(Drawable drawable, int layoutDirection) {
return Util.SDK_INT >= 23 && drawable.setLayoutDirection(layoutDirection);
}
public static int getDefaultScrubberColor(int playedColor) { public static int getDefaultScrubberColor(int playedColor) {
return 0xFF000000 | playedColor; return 0xFF000000 | playedColor;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment