Using the same clip animation for wallpaper button as using for app icons
Bug: 30222414
Change-Id: I12ea7be255abe572c29102b6e93c4d2cdfce0aff
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b7f033e..5675b96 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2009,9 +2009,9 @@
}
@Override
- public void startActivityForResult(Intent intent, int requestCode) {
+ public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
onStartForResult(requestCode);
- super.startActivityForResult(intent, requestCode);
+ super.startActivityForResult(intent, requestCode, options);
}
@Override
@@ -2725,10 +2725,12 @@
int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen());
float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll);
- startActivityForResult(new Intent(Intent.ACTION_SET_WALLPAPER)
+
+ Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER)
.setPackage(pickerPackage)
- .putExtra(Utilities.EXTRA_WALLPAPER_OFFSET, offset),
- REQUEST_PICK_WALLPAPER);
+ .putExtra(Utilities.EXTRA_WALLPAPER_OFFSET, offset);
+ intent.setSourceBounds(getViewBounds(v));
+ startActivityForResult(intent, REQUEST_PICK_WALLPAPER, getActivityLaunchOptions(v));
}
/**
@@ -2876,6 +2878,12 @@
return null;
}
+ private Rect getViewBounds(View v) {
+ int[] pos = new int[2];
+ v.getLocationOnScreen(pos);
+ return new Rect(pos[0], pos[1], pos[0] + v.getWidth(), pos[1] + v.getHeight());
+ }
+
public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
if (mIsSafeModeEnabled && !Utilities.isSystemApp(this, intent)) {
Toast.makeText(this, R.string.safemode_shortcut_error, Toast.LENGTH_SHORT).show();
@@ -2896,10 +2904,7 @@
// Prepare intent
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (v != null) {
- int[] pos = new int[2];
- v.getLocationOnScreen(pos);
- intent.setSourceBounds(
- new Rect(pos[0], pos[1], pos[0] + v.getWidth(), pos[1] + v.getHeight()));
+ intent.setSourceBounds(getViewBounds(v));
}
try {
if (Utilities.ATLEAST_MARSHMALLOW && item != null