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
commit e4bafbb3ce
8 changed files with 20 additions and 20 deletions

View File

@ -20,7 +20,7 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3">
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="16"/>
<uses-sdk android:targetSdkVersion="21" android:minSdkVersion="16"/>
<permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"

View File

@ -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();

View File

@ -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) {

View File

@ -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;
}
/**

View File

@ -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());

View File

@ -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());

View File

@ -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) { };

View File

@ -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);