diff options
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 29 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherProvider.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 2 |
6 files changed, 39 insertions, 21 deletions
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 7a2c247c6..d3afc3bf0 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -471,17 +471,6 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona // Load the current page synchronously, and the neighboring pages asynchronously mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true); mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage()); - - // We had to enable the wallpaper visibility when launching apps from all apps (so that - // the transitions would be the same as when launching from workspace) so we need to - // re-disable the wallpaper visibility to ensure performance. - int duration = getResources().getInteger(android.R.integer.config_shortAnimTime); - postDelayed(new Runnable() { - @Override - public void run() { - mLauncher.updateWallpaperVisibility(false); - } - }, duration); } } diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 6f4759d1e..ba20a76ba 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -160,6 +160,9 @@ public class CellLayout extends ViewGroup { private static final int INVALID_DIRECTION = -100; private DropTarget.DragEnforcer mDragEnforcer; + private final static PorterDuffXfermode sAddBlendMode = + new PorterDuffXfermode(PorterDuff.Mode.ADD); + public CellLayout(Context context) { this(context, null); } @@ -506,7 +509,7 @@ public class CellLayout extends ViewGroup { if (mForegroundAlpha > 0) { mOverScrollForegroundDrawable.setBounds(mForegroundRect); Paint p = ((NinePatchDrawable) mOverScrollForegroundDrawable).getPaint(); - p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD)); + p.setXfermode(sAddBlendMode); mOverScrollForegroundDrawable.draw(canvas); p.setXfermode(null); } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 0d4b0d041..8b6fee92d 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -33,8 +33,6 @@ import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; -import android.content.ClipData; -import android.content.ClipDescription; import android.content.ComponentCallbacks2; import android.content.ComponentName; import android.content.ContentResolver; @@ -144,6 +142,10 @@ public final class Launcher extends Activity private static final String PREFERENCES = "launcher.preferences"; static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher.force_enable_rotation"; + // The Intent extra that defines whether to ignore the launch animation + static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION = + "com.android.launcher.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION"; + // Type: int private static final String RUNTIME_STATE_CURRENT_SCREEN = "launcher.current_screen"; // Type: int @@ -1180,6 +1182,23 @@ public final class Launcher extends Activity // currently shown, because doing that may involve // some communication back with the app. mWorkspace.postDelayed(mBuildLayersRunnable, 500); + + // We had to enable the wallpaper visibility when launching apps from all + // apps (so that the transitions would be the same as when launching from + // workspace) so take this time to see if we need to re-disable the + // wallpaper visibility to ensure performance. + mWorkspace.post(new Runnable() { + @Override + public void run() { + if (mState == State.APPS_CUSTOMIZE) { + if (mAppsCustomizeTabHost != null && + !mAppsCustomizeTabHost.isTransitioning()) { + updateWallpaperVisibility(false); + } + } + } + }); + observer.removeOnPreDrawListener(this); return true; } @@ -1890,7 +1909,11 @@ public final class Launcher extends Activity intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { - if (v != null) { + // Only launch using the new animation if the shortcut has not opted out (this is a + // private contract between launcher and may be ignored in the future). + boolean useLaunchAnimation = (v != null) && + !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION); + if (useLaunchAnimation) { ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index ff4abc6b3..bae4c56fc 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1684,7 +1684,7 @@ public class LauncherModel extends BroadcastReceiver { for (ItemInfo i : sWorkspaceItems) { if (i instanceof ShortcutInfo) { ShortcutInfo info = (ShortcutInfo) i; - if (info.intent.getPackage().equals(packageName)) { + if (info.intent.getComponent().getPackageName().equals(packageName)) { infos.add(info); } } diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java index 5e572a575..4cf87d2b4 100644 --- a/src/com/android/launcher2/LauncherProvider.java +++ b/src/com/android/launcher2/LauncherProvider.java @@ -66,7 +66,7 @@ public class LauncherProvider extends ContentProvider { private static final String DATABASE_NAME = "launcher.db"; - private static final int DATABASE_VERSION = 10; + private static final int DATABASE_VERSION = 11; static final String AUTHORITY = "com.android.launcher2.settings"; @@ -477,12 +477,14 @@ public class LauncherProvider extends ContentProvider { version = 9; } - if (version < 10) { + // We bumped the version twice during JB, once to update the launch flags, and once to + // update the override for the default launch animation. + if (version < 11) { // Contact shortcuts need a different set of flags to be launched now // The updateContactsShortcuts change is idempotent, so we can keep using it like // back in the Donut days updateContactsShortcuts(db); - version = 10; + version = 11; } if (version != DATABASE_VERSION) { @@ -535,7 +537,8 @@ public class LauncherProvider extends ContentProvider { // detail activities. newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - + newIntent.putExtra( + Launcher.INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION, true); newIntent.setData(uri); final ContentValues values = new ContentValues(); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 4b8e56ee5..3c84805dd 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -3622,7 +3622,7 @@ public class Workspace extends SmoothPagedView for (String intentStr : newApps) { try { Intent intent = Intent.parseUri(intentStr, 0); - if (packageNames.contains(intent.getPackage())) { + if (packageNames.contains(intent.getComponent().getPackageName())) { newApps.remove(intentStr); } } catch (URISyntaxException e) {} |