diff options
Diffstat (limited to 'WallpaperPicker/src')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 23 |
1 files changed, 16 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 |