diff options
Diffstat (limited to 'src/com/android/launcher3/WallpaperPickerActivity.java')
-rw-r--r-- | src/com/android/launcher3/WallpaperPickerActivity.java | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java index d1c616028..3502043ea 100644 --- a/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/src/com/android/launcher3/WallpaperPickerActivity.java @@ -102,29 +102,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private SavedWallpaperImages mSavedImages; private WallpaperInfo mLiveWallpaperInfoOnPickerLaunch; - public static abstract class WallpaperTileInfo { - protected View mView; - public void setView(View v) { - mView = v; - } - public void onClick(WallpaperPickerActivity a) {} - public void onSave(WallpaperPickerActivity a) {} - public void onDelete(WallpaperPickerActivity a) {} - public boolean isSelectable() { return false; } - public boolean isNamelessWallpaper() { return false; } - public void onIndexUpdated(CharSequence label) { - if (isNamelessWallpaper()) { - mView.setContentDescription(label); - } - } - } - public static class PickImageInfo extends WallpaperTileInfo { @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(WallpaperCropActivity a) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); - Utilities.startActivityForResultSafely(a, intent, IMAGE_PICK); + Utilities.startActivityForResultSafely(((WallpaperPickerActivity)a), intent, IMAGE_PICK); } } @@ -134,14 +117,14 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mUri = uri; } @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(WallpaperCropActivity a) { CropView v = a.getCropView(); int rotation = WallpaperCropActivity.getRotationFromExif(a, mUri); v.setTileSource(new BitmapRegionTileSource(a, mUri, 1024, rotation), null); v.setTouchEnabled(true); } @Override - public void onSave(final WallpaperPickerActivity a) { + public void onSave(final WallpaperCropActivity a) { boolean finishActivityWhenDone = true; OnBitmapCroppedHandler h = new OnBitmapCroppedHandler() { public void onBitmapCropped(byte[] imageBytes) { @@ -149,10 +132,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // rotation is set to 0 since imageBytes has already been correctly rotated Bitmap thumb = createThumbnail( thumbSize, null, null, imageBytes, null, 0, 0, true); - a.getSavedImages().writeImage(thumb, imageBytes); + ((WallpaperPickerActivity)a).getSavedImages().writeImage(thumb, imageBytes); } }; - a.cropImageAndSetWallpaper(mUri, h, finishActivityWhenDone); + ((WallpaperPickerActivity)a).cropImageAndSetWallpaper(mUri, h, finishActivityWhenDone); } @Override public boolean isSelectable() { @@ -175,7 +158,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mThumb = thumb; } @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(WallpaperCropActivity a) { int rotation = WallpaperCropActivity.getRotationFromExif(mResources, mResId); BitmapRegionTileSource source = new BitmapRegionTileSource( mResources, a, mResId, 1024, rotation); @@ -190,9 +173,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { v.setTouchEnabled(false); } @Override - public void onSave(WallpaperPickerActivity a) { + public void onSave(WallpaperCropActivity a) { boolean finishActivityWhenDone = true; - a.cropImageAndSetWallpaper(mResources, mResId, finishActivityWhenDone); + ((WallpaperPickerActivity)a).cropImageAndSetWallpaper(mResources, mResId, finishActivityWhenDone); } @Override public boolean isSelectable() { @@ -204,8 +187,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - public void setWallpaperStripYOffset(float offset) { - mWallpaperStrip.setPadding(0, 0, 0, (int) offset); + @Override + protected void setWallpaperStripYOffset(int offset) { + mWallpaperStrip.setPadding(0, 0, 0, offset); } // called by onCreate; this is subclassed to overwrite WallpaperCropActivity |