diff options
4 files changed, 29 insertions, 7 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index a83e75e25..013606a50 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -249,6 +249,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable( c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); + if (defaultWallpaper == null) { + Log.w(TAG, "Null default wallpaper encountered."); + c.setTileSource(null, null); + return; + } + c.setTileSource( new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null); c.setScale(1f); @@ -259,6 +265,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public void onSave(WallpaperPickerActivity a) { try { WallpaperManager.getInstance(a).clear(); + a.setResult(RESULT_OK); } catch (IOException e) { Log.w("Setting wallpaper to default threw exception", e); } @@ -480,13 +487,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Add a tile for the default wallpaper if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { DefaultWallpaperInfo defaultWallpaperInfo = getDefaultWallpaper(); - FrameLayout defaultWallpaperTile = (FrameLayout) createImageTileView( - getLayoutInflater(), 0, null, mWallpapersView, defaultWallpaperInfo.mThumb); - setWallpaperItemPaddingToZero(defaultWallpaperTile); - defaultWallpaperTile.setTag(defaultWallpaperInfo); - mWallpapersView.addView(defaultWallpaperTile, 0); - defaultWallpaperTile.setOnClickListener(mThumbnailOnClickListener); - defaultWallpaperInfo.setView(defaultWallpaperTile); + if (defaultWallpaperInfo != null) { + FrameLayout defaultWallpaperTile = (FrameLayout) createImageTileView( + getLayoutInflater(), 0, null, mWallpapersView, defaultWallpaperInfo.mThumb); + setWallpaperItemPaddingToZero(defaultWallpaperTile); + defaultWallpaperTile.setTag(defaultWallpaperInfo); + mWallpapersView.addView(defaultWallpaperTile, 0); + defaultWallpaperTile.setOnClickListener(mThumbnailOnClickListener); + defaultWallpaperInfo.setView(defaultWallpaperTile); + } } // Select the first item; wait for a layout pass so that we initialize the dimensions of diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 251ae2108..5c8828aaf 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -828,6 +828,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } }); } else { + mLauncher.getWorkspace().removeExtraEmptyScreen(true, null); mLauncher.unlockScreenOrientation(false); } } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1060a94c2..c22a6bf3f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2078,6 +2078,10 @@ public class Launcher extends Activity return mWorkspaceLoading || mWaitingForResult; } + public boolean isWorkspaceLoading() { + return mWorkspaceLoading; + } + private void resetAddInfo() { mPendingAddInfo.container = ItemInfo.NO_ID; mPendingAddInfo.screenId = -1; @@ -3771,6 +3775,8 @@ public class Launcher extends Activity * Implementation of the method from LauncherModel.Callbacks. */ public void startBinding() { + mWorkspaceLoading = true; + // If we're starting binding all over again, clear any bind calls we'd postponed in // the past (see waitUntilResume) -- we don't need them since we're starting binding // from scratch again diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 50d29ed29..86c603e87 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -863,6 +863,12 @@ public class Workspace extends SmoothPagedView // Log to disk Launcher.addDumpLog(TAG, "11683562 - stripEmptyScreens()", true); + if (mLauncher.isWorkspaceLoading()) { + // Don't strip empty screens if the workspace is still loading + Launcher.addDumpLog(TAG, " - workspace loading, skip", true); + return; + } + if (isPageMoving()) { mStripScreensOnPageStopMoving = true; return; |