diff options
author | Michael Jurka <mikejurka@google.com> | 2013-09-14 12:26:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-14 12:26:09 +0000 |
commit | 78cf9299b9273053aebba0fdc465d91753aae83f (patch) | |
tree | 31bf8197e3bc977f8166c11d9050874bc1d01739 /src/com | |
parent | af110e8603b2f372286d9155cbe8955a6a329e2d (diff) | |
parent | adc574ccb1986856b38198ad5a934b7543a1debb (diff) | |
download | android_packages_apps_Trebuchet-78cf9299b9273053aebba0fdc465d91753aae83f.tar.gz android_packages_apps_Trebuchet-78cf9299b9273053aebba0fdc465d91753aae83f.tar.bz2 android_packages_apps_Trebuchet-78cf9299b9273053aebba0fdc465d91753aae83f.zip |
Merge "Update to using new crop intent" into jb-ub-now-indigo-rose
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher3/WallpaperCropActivity.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/launcher3/WallpaperCropActivity.java b/src/com/android/launcher3/WallpaperCropActivity.java index dee9fe9ad..f5a6b80b3 100644 --- a/src/com/android/launcher3/WallpaperCropActivity.java +++ b/src/com/android/launcher3/WallpaperCropActivity.java @@ -22,6 +22,7 @@ import android.app.WallpaperManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; @@ -100,6 +101,10 @@ public class WallpaperCropActivity extends Activity { }); } + public static String getSharedPreferencesKey() { + return WallpaperCropActivity.class.getName(); + } + // As a ratio of screen height, the total distance we want the parallax effect to span // horizontally private static float wallpaperTravelToScreenWidthRatio(int width, int height) { @@ -145,7 +150,7 @@ public class WallpaperCropActivity extends Activity { // for the intended // parallax effects final int defaultWidth, defaultHeight; - if (LauncherAppState.isScreenLarge(res)) { + if (isScreenLarge(res)) { defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); defaultHeight = maxDim; } else { @@ -200,6 +205,11 @@ public class WallpaperCropActivity extends Activity { cropTask.execute(); } + private static boolean isScreenLarge(Resources res) { + Configuration config = res.getConfiguration(); + return config.smallestScreenWidthDp >= 720; + } + protected void cropImageAndSetWallpaper(Uri uri, OnBitmapCroppedHandler onBitmapCroppedHandler, final boolean finishActivityWhenDone) { // Get the crop @@ -216,7 +226,7 @@ public class WallpaperCropActivity extends Activity { int maxDim = Math.max(maxDims.x, maxDims.y); final int minDim = Math.min(minDims.x, minDims.y); int defaultWidth; - if (LauncherAppState.isScreenLarge(getResources())) { + if (isScreenLarge(getResources())) { defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); } else { @@ -564,7 +574,7 @@ public class WallpaperCropActivity extends Activity { } protected void updateWallpaperDimensions(int width, int height) { - String spKey = LauncherAppState.getSharedPreferencesKey(); + String spKey = getSharedPreferencesKey(); SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); if (width != 0 && height != 0) { diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 672a38717..0d966f42a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -30,6 +30,7 @@ import android.appwidget.AppWidgetProviderInfo; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; @@ -1044,8 +1045,10 @@ public class Workspace extends SmoothPagedView }; protected void setWallpaperDimension() { + String spKey = WallpaperCropActivity.getSharedPreferencesKey(); + SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_PRIVATE); WallpaperPickerActivity.suggestWallpaperDimension(mLauncher.getResources(), - mLauncher.getSharedPrefs(), mLauncher.getWindowManager(), mWallpaperManager); + sp, mLauncher.getWindowManager(), mWallpaperManager); } |