Fix bug where no images could be deleted in wallpaper picker

Bug: 10926729

Change-Id: I9392e297d071f1ed12bb6665e591756dfe42009f
diff --git a/src/com/android/launcher3/LiveWallpaperListAdapter.java b/src/com/android/launcher3/LiveWallpaperListAdapter.java
index 9d0f48b..e9e5e79 100644
--- a/src/com/android/launcher3/LiveWallpaperListAdapter.java
+++ b/src/com/android/launcher3/LiveWallpaperListAdapter.java
@@ -116,6 +116,7 @@
             mThumbnail = thumbnail;
             mInfo = info;
         }
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             Intent preview = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
             preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
diff --git a/src/com/android/launcher3/SavedWallpaperImages.java b/src/com/android/launcher3/SavedWallpaperImages.java
index f00f62f..7cd82f0 100644
--- a/src/com/android/launcher3/SavedWallpaperImages.java
+++ b/src/com/android/launcher3/SavedWallpaperImages.java
@@ -57,6 +57,7 @@
             mDbId = dbId;
             mThumb = thumb;
         }
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             String imageFilename = a.getSavedImages().getImageFilename(mDbId);
             File file = new File(a.getFilesDir(), imageFilename);
@@ -65,14 +66,17 @@
             v.moveToLeft();
             v.setTouchEnabled(false);
         }
+        @Override
         public void onSave(WallpaperPickerActivity a) {
             boolean finishActivityWhenDone = true;
             String imageFilename = a.getSavedImages().getImageFilename(mDbId);
             a.setWallpaper(imageFilename, finishActivityWhenDone);
         }
+        @Override
         public void onDelete(WallpaperPickerActivity a) {
             a.getSavedImages().deleteImage(mDbId);
         }
+        @Override
         public boolean isSelectable() {
             return true;
         }
diff --git a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
index ab2f5d7..7ed1c1b 100644
--- a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
+++ b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
@@ -46,6 +46,7 @@
         public ThirdPartyWallpaperTile(ResolveInfo resolveInfo) {
             mResolveInfo = resolveInfo;
         }
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             final ComponentName itemComponentName = new ComponentName(
                     mResolveInfo.activityInfo.packageName, mResolveInfo.activityInfo.name);
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java
index 5f35cde..a7c96f5 100644
--- a/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -87,11 +87,12 @@
     public static abstract class WallpaperTileInfo {
         public void onClick(WallpaperPickerActivity a) {}
         public void onSave(WallpaperPickerActivity a) {}
-        public void onDelete() {}
+        public void onDelete(WallpaperPickerActivity a) {}
         public boolean isSelectable() { return false; }
     }
 
     public static class PickImageInfo extends WallpaperTileInfo {
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
             intent.setType("image/*");
@@ -104,13 +105,14 @@
         public UriWallpaperInfo(Uri uri) {
             mUri = uri;
         }
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             CropView v = a.getCropView();
             v.setTileSource(new BitmapRegionTileSource(
                     a, mUri, 1024, 0), null);
             v.setTouchEnabled(true);
         }
-
+        @Override
         public void onSave(final WallpaperPickerActivity a) {
             boolean finishActivityWhenDone = true;
             OnBitmapCroppedHandler h = new OnBitmapCroppedHandler() {
@@ -123,6 +125,7 @@
             };
             a.cropImageAndSetWallpaper(mUri, h, finishActivityWhenDone);
         }
+        @Override
         public boolean isSelectable() {
             return true;
         }
@@ -138,6 +141,7 @@
             mResId = resId;
             mThumb = thumb;
         }
+        @Override
         public void onClick(WallpaperPickerActivity a) {
             BitmapRegionTileSource source = new BitmapRegionTileSource(
                     mResources, a, mResId, 1024, 0);
@@ -151,10 +155,12 @@
             v.setScale(wallpaperSize.x / crop.width());
             v.setTouchEnabled(false);
         }
+        @Override
         public void onSave(WallpaperPickerActivity a) {
             boolean finishActivityWhenDone = true;
             a.cropImageAndSetWallpaper(mResources, mResId, finishActivityWhenDone);
         }
+        @Override
         public boolean isSelectable() {
             return true;
         }
@@ -361,7 +367,8 @@
                         CheckableFrameLayout c =
                                 (CheckableFrameLayout) mWallpapersView.getChildAt(i);
                         if (c.isChecked()) {
-                            ((WallpaperTileInfo) c.getTag()).onDelete();
+                            WallpaperTileInfo info = (WallpaperTileInfo) c.getTag();
+                            info.onDelete(WallpaperPickerActivity.this);
                             viewsToRemove.add(c);
                         }
                     }