summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2013-11-13 17:59:46 +0100
committerDanesh M <daneshm90@gmail.com>2014-06-06 22:54:21 -0700
commitdf2df99a6cc6fef5a6eefcd9283da6c456cc0a24 (patch)
treeaf7f185316ab9b43356925571eb4525a0749de6a /src/com/android/launcher3/Workspace.java
parent708dd5f82adedfaed4f80208c6f222df3ef47efe (diff)
downloadandroid_packages_apps_Trebuchet-df2df99a6cc6fef5a6eefcd9283da6c456cc0a24.tar.gz
android_packages_apps_Trebuchet-df2df99a6cc6fef5a6eefcd9283da6c456cc0a24.tar.bz2
android_packages_apps_Trebuchet-df2df99a6cc6fef5a6eefcd9283da6c456cc0a24.zip
Update suggested wallpaper dimensions in onResume
If another launcher runs in between, it might change the suggested dimensions. This fixes that case. Bug: 11667475 Change-Id: I9211016c6b59450c46646737d6d54a11a49f3bba
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6e8604582..a1810802d 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -43,6 +43,7 @@ import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.AsyncTask;
import android.os.IBinder;
import android.os.Parcelable;
import android.support.v4.view.ViewCompat;
@@ -471,6 +472,9 @@ public class Workspace extends SmoothPagedView
mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
+
+ // Set the wallpaper dimensions when Launcher starts up
+ setWallpaperDimension();
}
private void setupLayoutTransition() {
@@ -1305,10 +1309,16 @@ public class Workspace extends SmoothPagedView
}
protected void setWallpaperDimension() {
- String spKey = WallpaperCropActivity.getSharedPreferencesKey();
- SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS);
- WallpaperPickerActivity.suggestWallpaperDimension(mLauncher.getResources(),
- sp, mLauncher.getWindowManager(), mWallpaperManager);
+ new AsyncTask<Void, Void, Void>() {
+ public Void doInBackground(Void ... args) {
+ String spKey = WallpaperCropActivity.getSharedPreferencesKey();
+ SharedPreferences sp =
+ mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS);
+ WallpaperPickerActivity.suggestWallpaperDimension(mLauncher.getResources(),
+ sp, mLauncher.getWindowManager(), mWallpaperManager);
+ return null;
+ }
+ }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
}
protected void snapToPage(int whichPage, Runnable r) {
@@ -1789,6 +1799,12 @@ public class Workspace extends SmoothPagedView
} else {
mWallpaperOffset.syncWithScroll();
}
+
+ // Update wallpaper dimensions if they were changed since last onResume
+ // (we also always set the wallpaper dimensions in the constructor)
+ if (LauncherAppState.getInstance().hasWallpaperChangedSinceLastCheck()) {
+ setWallpaperDimension();
+ }
}
@Override
@@ -4150,7 +4166,6 @@ public class Workspace extends SmoothPagedView
// hardware layers on children are enabled on startup, but should be disabled until
// needed
updateChildrenLayersEnabled(false);
- setWallpaperDimension();
}
/**