diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-08-17 14:43:41 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-08-17 14:43:41 -0700 |
commit | c268148f06f5c6c30deb1678e74530ef5aa85a67 (patch) | |
tree | ee179b0e3dd08c1c158e9dd761b10dd75fe37e0f /src/com/android/launcher3/Utilities.java | |
parent | 017a5c1e6524a0b93b7fdec1de7a49aaf1d04852 (diff) | |
parent | 9fc953b94dbc6b99e6de08c9dcc80a0cb8e3e319 (diff) | |
download | android_packages_apps_Trebuchet-c268148f06f5c6c30deb1678e74530ef5aa85a67.tar.gz android_packages_apps_Trebuchet-c268148f06f5c6c30deb1678e74530ef5aa85a67.tar.bz2 android_packages_apps_Trebuchet-c268148f06f5c6c30deb1678e74530ef5aa85a67.zip |
resolved conflicts for merge of 9fc953b9 to ub-launcher3-master
Change-Id: Ia3e845a2e336c846cceefdc2d1e8c6786753f1b1
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 4c98e2032..e0a4a1c3a 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -90,6 +90,24 @@ public final class Utilities { private static final int[] sLoc0 = new int[2]; private static final int[] sLoc1 = new int[2]; + // TODO: use Build.VERSION_CODES when available + public static final boolean ATLEAST_MARSHMALLOW = Build.VERSION.SDK_INT >= 23; + + public static final boolean ATLEAST_LOLLIPOP_MR1 = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1; + + public static final boolean ATLEAST_LOLLIPOP = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; + + public static final boolean ATLEAST_KITKAT = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; + + public static final boolean ATLEAST_JB_MR1 = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1; + + public static final boolean ATLEAST_JB_MR2 = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; + // To turn on these properties, type // adb shell setprop log.tag.PROPERTY_NAME [VERBOSE | SUPPRESS] private static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher_force_rotate"; @@ -113,23 +131,6 @@ public final class Utilities { return sForceEnableRotation || context.getResources().getBoolean(R.bool.allow_rotation); } - /** - * Indicates if the device is running LMP or higher. - */ - public static boolean isLmpOrAbove() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; - } - - public static boolean isLmpMR1OrAbove() { - // TODO(adamcohen): update to Build.VERSION_CODES.LOLLIPOP_MR1 once building against 22; - return Build.VERSION.SDK_INT >= 22; - } - - public static boolean isLmpMR1() { - // TODO(adamcohen): update to Build.VERSION_CODES.LOLLIPOP_MR1 once building against 22; - return Build.VERSION.SDK_INT == 22; - } - public static boolean isNycOrAbove() { // TODO(vadimt): Replace using reflection with looking at the API version once // Build.VERSION.SDK_INT gets bumped to 24. b/22942492. @@ -530,7 +531,7 @@ public final class Utilities { @TargetApi(Build.VERSION_CODES.KITKAT) public static boolean isViewAttachedToWindow(View v) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + if (ATLEAST_KITKAT) { return v.isAttachedToWindow(); } else { // A proxy call which returns null, if the view is not attached to the window. @@ -557,7 +558,7 @@ public final class Utilities { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); for (AppWidgetProviderInfo info : appWidgetManager.getInstalledProviders()) { if (info.provider.getPackageName().equals(providerPkg)) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + if (ATLEAST_JB_MR1) { if ((info.widgetCategory & AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX) != 0) { return info; } else if (defaultWidgetForSearchPackage == null) { @@ -668,7 +669,7 @@ public final class Utilities { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static boolean isRtl(Resources res) { - return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) && + return ATLEAST_JB_MR1 && (res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL); } |