am c0b89b72: Merge "Update calls now we have an L API version." into ub-now-porkchop

* commit 'c0b89b72af01c6e7bf805f29fa6cc531d6388b6f':
  Update calls now we have an L API version.
This commit is contained in:
Kenny Guy
2014-09-18 12:22:45 +00:00
committed by Android Git Automerger
8 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3"> package="com.android.launcher3">
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="16"/> <uses-sdk android:targetSdkVersion="21" android:minSdkVersion="16"/>
<permission <permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT" android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
+1 -1
View File
@@ -461,7 +461,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Animator openFolderAnim = null; Animator openFolderAnim = null;
final Runnable onCompleteRunnable; final Runnable onCompleteRunnable;
if (!Utilities.isLmp()) { if (!Utilities.isLmpOrAbove()) {
positionAndSizeAsIcon(); positionAndSizeAsIcon();
centerAboutIcon(); centerAboutIcon();
+7 -7
View File
@@ -1650,7 +1650,7 @@ public class Launcher extends Activity
// TODO(sansid): use the APIs directly when compiling against L sdk. // 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 // Currently we use reflection to access the flags and the API to set the transparency
// on the System bars. // on the System bars.
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
try { try {
getWindow().getAttributes().systemUiVisibility |= getWindow().getAttributes().systemUiVisibility |=
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
@@ -2809,7 +2809,7 @@ public class Launcher extends Activity
Bundle optsBundle = null; Bundle optsBundle = null;
if (useLaunchAnimation) { if (useLaunchAnimation) {
ActivityOptions opts = Utilities.isLmp() ? ActivityOptions opts = Utilities.isLmpOrAbove() ?
ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim) : ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim) :
ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
optsBundle = opts.toBundle(); optsBundle = opts.toBundle();
@@ -2920,7 +2920,7 @@ public class Launcher extends Activity
ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha,
scaleX, scaleY); scaleX, scaleY);
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
oa.setInterpolator(new LogDecelerateInterpolator(100, 0)); oa.setInterpolator(new LogDecelerateInterpolator(100, 0));
} }
oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
@@ -3194,7 +3194,7 @@ public class Launcher extends Activity
mStateAnimation = null; mStateAnimation = null;
} }
boolean material = Utilities.isLmp(); boolean material = Utilities.isLmpOrAbove();
final Resources res = getResources(); final Resources res = getResources();
@@ -3376,7 +3376,7 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionStart(toView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false);
revealView.setAlpha(initAlpha); revealView.setAlpha(initAlpha);
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
for (int i = 0; i < layerViews.size(); i++) { for (int i = 0; i < layerViews.size(); i++) {
View v = layerViews.get(i); View v = layerViews.get(i);
if (v != null) { if (v != null) {
@@ -3431,7 +3431,7 @@ public class Launcher extends Activity
mStateAnimation = null; mStateAnimation = null;
} }
boolean material = Utilities.isLmp(); boolean material = Utilities.isLmpOrAbove();
Resources res = getResources(); Resources res = getResources();
final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime); final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime);
@@ -3651,7 +3651,7 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(fromView, animated, false);
dispatchOnLauncherTransitionStart(toView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false);
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
for (int i = 0; i < layerViews.size(); i++) { for (int i = 0; i < layerViews.size(); i++) {
View v = layerViews.get(i); View v = layerViews.get(i);
if (v != null) { if (v != null) {
+3 -4
View File
@@ -103,11 +103,10 @@ public final class Utilities {
} }
/** /**
* Indicates if the device is running LMP or not. * Indicates if the device is running LMP or higher.
* TODO(sansid): Change the check to a VERSION_CODES code check once we have a version for L.
*/ */
public static boolean isLmp() { public static boolean isLmpOrAbove() {
return "L".equals(Build.VERSION.CODENAME); return Build.VERSION.SDK_INT >= Build.VERSION_CODES.L;
} }
/** /**
@@ -38,9 +38,8 @@ public abstract class AppWidgetManagerCompat {
public static AppWidgetManagerCompat getInstance(Context context) { public static AppWidgetManagerCompat getInstance(Context context) {
synchronized (sInstanceLock) { synchronized (sInstanceLock) {
// TODO change this to use api version once L gets an API number.
if (sInstance == null) { if (sInstance == null) {
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
sInstance = new AppWidgetManagerCompatVL(context.getApplicationContext()); sInstance = new AppWidgetManagerCompatVL(context.getApplicationContext());
} else { } else {
sInstance = new AppWidgetManagerCompatV16(context.getApplicationContext()); sInstance = new AppWidgetManagerCompatV16(context.getApplicationContext());
@@ -23,6 +23,8 @@ import android.graphics.Rect;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import com.android.launcher3.Utilities;
import java.util.List; import java.util.List;
public abstract class LauncherAppsCompat { public abstract class LauncherAppsCompat {
@@ -48,9 +50,8 @@ public abstract class LauncherAppsCompat {
public static LauncherAppsCompat getInstance(Context context) { public static LauncherAppsCompat getInstance(Context context) {
synchronized (sInstanceLock) { synchronized (sInstanceLock) {
// STOPSHIP(kennyguy) change this to use api version once L gets an API number.
if (sInstance == null) { if (sInstance == null) {
if ("L".equals(Build.VERSION.CODENAME)) { if (Utilities.isLmpOrAbove()) {
sInstance = new LauncherAppsCompatVL(context.getApplicationContext()); sInstance = new LauncherAppsCompatVL(context.getApplicationContext());
} else { } else {
sInstance = new LauncherAppsCompatV16(context.getApplicationContext()); sInstance = new LauncherAppsCompatV16(context.getApplicationContext());
@@ -32,7 +32,7 @@ public abstract class PackageInstallerCompat {
public static PackageInstallerCompat getInstance(Context context) { public static PackageInstallerCompat getInstance(Context context) {
synchronized (sInstanceLock) { synchronized (sInstanceLock) {
if (sInstance == null) { if (sInstance == null) {
if (Utilities.isLmp()) { if (Utilities.isLmpOrAbove()) {
sInstance = new PackageInstallerCompatVL(context); sInstance = new PackageInstallerCompatVL(context);
} else { } else {
sInstance = new PackageInstallerCompatV16(context) { }; sInstance = new PackageInstallerCompatV16(context) { };
@@ -20,6 +20,8 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import com.android.launcher3.Utilities;
import java.util.List; import java.util.List;
public abstract class UserManagerCompat { public abstract class UserManagerCompat {
@@ -27,8 +29,7 @@ public abstract class UserManagerCompat {
} }
public static UserManagerCompat getInstance(Context context) { public static UserManagerCompat getInstance(Context context) {
// TODO change this to use api version once L gets an API number. if (Utilities.isLmpOrAbove()) {
if ("L".equals(Build.VERSION.CODENAME)) {
return new UserManagerCompatVL(context); return new UserManagerCompatVL(context);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return new UserManagerCompatV17(context); return new UserManagerCompatV17(context);