mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't call Drawable.setLayoutDirection pre-API-23
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=174323423
This commit is contained in:
parent
233a1d165f
commit
9abc1d2974
1 changed files with 6 additions and 4 deletions
|
|
@ -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 {
|
||||||
|
|
||||||
@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 {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue