summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-11-11 12:23:59 -0800
committerDanesh M <daneshm90@gmail.com>2015-09-27 20:48:59 -0700
commitad5c6a5a9749e8da11487a96c330255aa0f670d6 (patch)
tree116e12c453bfe125e2c1aff3c6971e12fb091353
parent5b54994fc56c9d00d415f161457c2c7449af912d (diff)
downloadandroid_packages_apps_Trebuchet-ad5c6a5a9749e8da11487a96c330255aa0f670d6.tar.gz
android_packages_apps_Trebuchet-ad5c6a5a9749e8da11487a96c330255aa0f670d6.tar.bz2
android_packages_apps_Trebuchet-ad5c6a5a9749e8da11487a96c330255aa0f670d6.zip
Removing some duplicate methods
Change-Id: I8a1295ab74890984e8d8508aaa18fd79ac2a032d
-rw-r--r--src/com/android/launcher3/Launcher.java18
-rw-r--r--src/com/android/launcher3/LauncherAppState.java7
-rw-r--r--src/com/android/launcher3/Utilities.java2
3 files changed, 8 insertions, 19 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a5c80a430..c2ae5a1cb 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -197,7 +197,6 @@ public class Launcher extends Activity
// To turn on these properties, type
// adb shell setprop log.tag.PROPERTY_NAME [VERBOSE | SUPPRESS]
- static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher_force_rotate";
static final String DUMP_STATE_PROPERTY = "launcher_dump_state";
static final String DISABLE_ALL_APPS_PROPERTY = "launcher_noallapps";
@@ -423,8 +422,6 @@ public class Launcher extends Activity
private static PendingAddArguments sPendingAddItem;
- public static boolean sForceEnableRotation = isPropertyEnabled(FORCE_ENABLE_ROTATION_PROPERTY);
-
private static class PendingAddArguments {
int requestCode;
Intent intent;
@@ -454,10 +451,6 @@ public class Launcher extends Activity
public void onAnimationCancel(Animator arg0) {}
};
- public static boolean isPropertyEnabled(String propertyName) {
- return Log.isLoggable(propertyName, Log.VERBOSE);
- }
-
Runnable mUpdateDynamicGridRunnable = new Runnable() {
@Override
public void run() {
@@ -2851,7 +2844,7 @@ public class Launcher extends Activity
case KeyEvent.KEYCODE_HOME:
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (isPropertyEnabled(DUMP_STATE_PROPERTY)) {
+ if (Utilities.isPropertyEnabled(DUMP_STATE_PROPERTY)) {
dumpState();
return true;
}
@@ -5488,19 +5481,14 @@ public class Launcher extends Activity
return oriMap[(d.getRotation() + indexOffset) % 4];
}
- public boolean isRotationEnabled() {
- boolean enableRotation = sForceEnableRotation ||
- getResources().getBoolean(R.bool.allow_rotation);
- return enableRotation;
- }
public void lockScreenOrientation() {
- if (isRotationEnabled()) {
+ if (Utilities.isRotationEnabled(this)) {
setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
.getConfiguration().orientation));
}
}
public void unlockScreenOrientation(boolean immediate) {
- if (isRotationEnabled()) {
+ if (Utilities.isRotationEnabled(this)) {
if (immediate) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 40d197139..29c88fa79 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import android.annotation.TargetApi;
import android.app.SearchManager;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -26,16 +27,15 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Point;
+import android.os.Build;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
-
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
-
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -193,6 +193,7 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
return LauncherFiles.SHARED_PREFERENCES_KEY;
}
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
DeviceProfile initDynamicGrid(Context context) {
// Determine the dynamic grid properties
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
@@ -268,7 +269,7 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
public static boolean isDisableAllApps() {
// Returns false on non-dogfood builds.
return getInstance().mBuildInfo.isDogfoodBuild() &&
- Launcher.isPropertyEnabled(Launcher.DISABLE_ALL_APPS_PROPERTY);
+ Utilities.isPropertyEnabled(Launcher.DISABLE_ALL_APPS_PROPERTY);
}
public static boolean isDogfoodBuild() {
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 9102639c8..cfadeaa5c 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -141,7 +141,7 @@ public final class Utilities {
icon.setBounds(0, 0, sIconWidth, sIconHeight);
}
- private static boolean isPropertyEnabled(String propertyName) {
+ public static boolean isPropertyEnabled(String propertyName) {
return Log.isLoggable(propertyName, Log.VERBOSE);
}