Commit f77077a8 by olly Committed by Oliver Woodman

Don't call getLayoutDirection before API level 17

Weirdly, the Android Javadoc indicates that it returns something
before the API level on which the same Javadoc states it was added.
In any case, we can simply not call the method to avoid the
warning, since we only use the value if the API level is at least
23 anyway.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190941776
parent 7be249ea
...@@ -250,7 +250,7 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -250,7 +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) {
setDrawableLayoutDirection(scrubberDrawable, getLayoutDirection()); setDrawableLayoutDirection(scrubberDrawable);
defaultTouchTargetHeight = defaultTouchTargetHeight =
Math.max(scrubberDrawable.getMinimumHeight(), defaultTouchTargetHeight); Math.max(scrubberDrawable.getMinimumHeight(), defaultTouchTargetHeight);
} }
...@@ -747,8 +747,8 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -747,8 +747,8 @@ public class DefaultTimeBar extends View implements TimeBar {
return true; return true;
} }
private static int dpToPx(DisplayMetrics displayMetrics, int dps) { private boolean setDrawableLayoutDirection(Drawable drawable) {
return (int) (dps * displayMetrics.density + 0.5f); return Util.SDK_INT >= 23 && setDrawableLayoutDirection(drawable, getLayoutDirection());
} }
private static boolean setDrawableLayoutDirection(Drawable drawable, int layoutDirection) { private static boolean setDrawableLayoutDirection(Drawable drawable, int layoutDirection) {
...@@ -771,4 +771,7 @@ public class DefaultTimeBar extends View implements TimeBar { ...@@ -771,4 +771,7 @@ public class DefaultTimeBar extends View implements TimeBar {
return 0x33000000 | (adMarkerColor & 0x00FFFFFF); return 0x33000000 | (adMarkerColor & 0x00FFFFFF);
} }
private static int dpToPx(DisplayMetrics displayMetrics, int dps) {
return (int) (dps * displayMetrics.density + 0.5f);
}
} }
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