From d794a3f46521b972fa02826d379d1efa112793d2 Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Tue, 16 Sep 2014 15:17:58 +0100 Subject: Update calls now we have an L API version. Bug: 17543647 Change-Id: I92c652a4ced5a5e783b24e42f9da4d9dfe1118ba --- src/com/android/launcher3/Folder.java | 2 +- src/com/android/launcher3/Launcher.java | 14 +++++++------- src/com/android/launcher3/Utilities.java | 7 +++---- .../android/launcher3/compat/AppWidgetManagerCompat.java | 3 +-- src/com/android/launcher3/compat/LauncherAppsCompat.java | 5 +++-- .../android/launcher3/compat/PackageInstallerCompat.java | 2 +- src/com/android/launcher3/compat/UserManagerCompat.java | 5 +++-- 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/com/android/launcher3') diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index a27e51986..1890af47d 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -461,7 +461,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList Animator openFolderAnim = null; final Runnable onCompleteRunnable; - if (!Utilities.isLmp()) { + if (!Utilities.isLmpOrAbove()) { positionAndSizeAsIcon(); centerAboutIcon(); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1b95c2b3f..bd39ea86c 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1650,7 +1650,7 @@ public class Launcher extends Activity // TODO(sansid): use the APIs directly when compiling against L sdk. // Currently we use reflection to access the flags and the API to set the transparency // on the System bars. - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { try { getWindow().getAttributes().systemUiVisibility |= (View.SYSTEM_UI_FLAG_LAYOUT_STABLE @@ -2809,7 +2809,7 @@ public class Launcher extends Activity Bundle optsBundle = null; if (useLaunchAnimation) { - ActivityOptions opts = Utilities.isLmp() ? + ActivityOptions opts = Utilities.isLmpOrAbove() ? ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim) : ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); optsBundle = opts.toBundle(); @@ -2920,7 +2920,7 @@ public class Launcher extends Activity ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY); - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { oa.setInterpolator(new LogDecelerateInterpolator(100, 0)); } oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); @@ -3194,7 +3194,7 @@ public class Launcher extends Activity mStateAnimation = null; } - boolean material = Utilities.isLmp(); + boolean material = Utilities.isLmpOrAbove(); final Resources res = getResources(); @@ -3376,7 +3376,7 @@ public class Launcher extends Activity dispatchOnLauncherTransitionStart(toView, animated, false); revealView.setAlpha(initAlpha); - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { @@ -3431,7 +3431,7 @@ public class Launcher extends Activity mStateAnimation = null; } - boolean material = Utilities.isLmp(); + boolean material = Utilities.isLmpOrAbove(); Resources res = getResources(); final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime); @@ -3651,7 +3651,7 @@ public class Launcher extends Activity dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { for (int i = 0; i < layerViews.size(); i++) { View v = layerViews.get(i); if (v != null) { diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index f20f261f9..80d4b22ce 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -103,11 +103,10 @@ public final class Utilities { } /** - * Indicates if the device is running LMP or not. - * TODO(sansid): Change the check to a VERSION_CODES code check once we have a version for L. + * Indicates if the device is running LMP or higher. */ - public static boolean isLmp() { - return "L".equals(Build.VERSION.CODENAME); + public static boolean isLmpOrAbove() { + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.L; } /** diff --git a/src/com/android/launcher3/compat/AppWidgetManagerCompat.java b/src/com/android/launcher3/compat/AppWidgetManagerCompat.java index 5997e7b03..6512d427e 100644 --- a/src/com/android/launcher3/compat/AppWidgetManagerCompat.java +++ b/src/com/android/launcher3/compat/AppWidgetManagerCompat.java @@ -38,9 +38,8 @@ public abstract class AppWidgetManagerCompat { public static AppWidgetManagerCompat getInstance(Context context) { synchronized (sInstanceLock) { - // TODO change this to use api version once L gets an API number. if (sInstance == null) { - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { sInstance = new AppWidgetManagerCompatVL(context.getApplicationContext()); } else { sInstance = new AppWidgetManagerCompatV16(context.getApplicationContext()); diff --git a/src/com/android/launcher3/compat/LauncherAppsCompat.java b/src/com/android/launcher3/compat/LauncherAppsCompat.java index e3879eed0..6efcc00fd 100644 --- a/src/com/android/launcher3/compat/LauncherAppsCompat.java +++ b/src/com/android/launcher3/compat/LauncherAppsCompat.java @@ -23,6 +23,8 @@ import android.graphics.Rect; import android.os.Build; import android.os.Bundle; +import com.android.launcher3.Utilities; + import java.util.List; public abstract class LauncherAppsCompat { @@ -48,9 +50,8 @@ public abstract class LauncherAppsCompat { public static LauncherAppsCompat getInstance(Context context) { synchronized (sInstanceLock) { - // STOPSHIP(kennyguy) change this to use api version once L gets an API number. if (sInstance == null) { - if ("L".equals(Build.VERSION.CODENAME)) { + if (Utilities.isLmpOrAbove()) { sInstance = new LauncherAppsCompatVL(context.getApplicationContext()); } else { sInstance = new LauncherAppsCompatV16(context.getApplicationContext()); diff --git a/src/com/android/launcher3/compat/PackageInstallerCompat.java b/src/com/android/launcher3/compat/PackageInstallerCompat.java index 0ae52bd23..03857e693 100644 --- a/src/com/android/launcher3/compat/PackageInstallerCompat.java +++ b/src/com/android/launcher3/compat/PackageInstallerCompat.java @@ -32,7 +32,7 @@ public abstract class PackageInstallerCompat { public static PackageInstallerCompat getInstance(Context context) { synchronized (sInstanceLock) { if (sInstance == null) { - if (Utilities.isLmp()) { + if (Utilities.isLmpOrAbove()) { sInstance = new PackageInstallerCompatVL(context); } else { sInstance = new PackageInstallerCompatV16(context) { }; diff --git a/src/com/android/launcher3/compat/UserManagerCompat.java b/src/com/android/launcher3/compat/UserManagerCompat.java index 8effb81a1..1374b4e49 100644 --- a/src/com/android/launcher3/compat/UserManagerCompat.java +++ b/src/com/android/launcher3/compat/UserManagerCompat.java @@ -20,6 +20,8 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; +import com.android.launcher3.Utilities; + import java.util.List; public abstract class UserManagerCompat { @@ -27,8 +29,7 @@ public abstract class UserManagerCompat { } public static UserManagerCompat getInstance(Context context) { - // TODO change this to use api version once L gets an API number. - if ("L".equals(Build.VERSION.CODENAME)) { + if (Utilities.isLmpOrAbove()) { return new UserManagerCompatVL(context); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return new UserManagerCompatV17(context); -- cgit v1.2.3