diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-09-01 09:56:41 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-09-01 10:13:39 -0700 |
commit | 77fcebe8506a39ba041b89fbc831ca0c0c5a11f1 (patch) | |
tree | 332f7be05afdcc79e61f8fd40e385ee00b71e359 /WallpaperPicker | |
parent | b9d7ff7ecb1a5e53da2e7bcce0838556ca05f634 (diff) | |
download | android_packages_apps_Trebuchet-77fcebe8506a39ba041b89fbc831ca0c0c5a11f1.tar.gz android_packages_apps_Trebuchet-77fcebe8506a39ba041b89fbc831ca0c0c5a11f1.tar.bz2 android_packages_apps_Trebuchet-77fcebe8506a39ba041b89fbc831ca0c0c5a11f1.zip |
Fixing crash when picking an external image
Change-Id: I98654000e82fd7e96152785ceafe857724fc417f
Diffstat (limited to 'WallpaperPicker')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 1d3b0cc29..63c31e866 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -360,36 +360,33 @@ public class WallpaperPickerActivity extends WallpaperCropActivity private void addTemporaryWallpaperTile(final Uri uri, boolean fromRestore) { // Add a tile for the image picked from Gallery, reusing the existing tile if there is one. - View existingTile = null; + View imageTile = null; int indexOfExistingTile = 0; for (; indexOfExistingTile < mWallpapersView.getChildCount(); indexOfExistingTile++) { View thumbnail = mWallpapersView.getChildAt(indexOfExistingTile); Object tag = thumbnail.getTag(); if (tag instanceof UriWallpaperInfo && ((UriWallpaperInfo) tag).mUri.equals(uri)) { - existingTile = thumbnail; + imageTile = thumbnail; break; } } - final View pickedImageThumbnail; final UriWallpaperInfo info; - if (existingTile != null) { - pickedImageThumbnail = existingTile; + if (imageTile != null) { // Always move the existing wallpaper to the front so user can see it without scrolling. mWallpapersView.removeViewAt(indexOfExistingTile); - mWallpapersView.addView(pickedImageThumbnail, 0); - info = (UriWallpaperInfo) pickedImageThumbnail.getTag(); + info = (UriWallpaperInfo) imageTile.getTag(); } else { // This is the first time this temporary wallpaper has been added info = new UriWallpaperInfo(uri); - pickedImageThumbnail = createTileView(mWallpapersView, info, true); - mWallpapersView.addView(pickedImageThumbnail, 0); + imageTile = createTileView(mWallpapersView, info, true); mTempWallpaperTiles.add(uri); } + mWallpapersView.addView(imageTile, 0); info.loadThumbnaleAsync(this); updateTileIndices(); if (!fromRestore) { - onClick(existingTile); + onClick(imageTile); } } |