summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-04-24 18:24:05 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-24 18:24:05 -0700
commit7eece5d72710823bd4aee7670704b9d927e7fd69 (patch)
treea3f1e9382ae01d7d9e5b9db5a06d6341a4b5cbbb
parent044c5695451db0b056fd0386901716c08015e0f1 (diff)
parentc7450e3ebd7672fcd7b9d51a8c1e68f63c5ce86b (diff)
downloadandroid_packages_apps_Trebuchet-7eece5d72710823bd4aee7670704b9d927e7fd69.tar.gz
android_packages_apps_Trebuchet-7eece5d72710823bd4aee7670704b9d927e7fd69.tar.bz2
android_packages_apps_Trebuchet-7eece5d72710823bd4aee7670704b9d927e7fd69.zip
Merge "Updating launcher transitions."
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java8
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java17
-rw-r--r--src/com/android/launcher2/Folder.java3
-rw-r--r--src/com/android/launcher2/Launcher.java21
4 files changed, 42 insertions, 7 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 35bdf14c2..2935ceaaa 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -518,12 +518,18 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
if (v instanceof PagedViewIcon) {
// Animate some feedback to the click
final ApplicationInfo appInfo = (ApplicationInfo) v.getTag();
- mLauncher.startActivitySafely(appInfo.intent, appInfo);
// Lock the drawable state to pressed until we return to Launcher
if (mPressedIcon != null) {
mPressedIcon.lockDrawableState();
}
+
+ // NOTE: we need to re-enable the wallpaper visibility if we want correct transitions
+ // between items that are launched from the workspace and all apps. It will be disabled
+ // correctly the next time the window is visible in AppsCustomizeTabHost.
+ mLauncher.updateWallpaperVisibility(true);
+ mLauncher.startActivitySafely(v, appInfo.intent, appInfo);
+
} else if (v instanceof PagedViewWidget) {
// Let the user know that they have to long press to add a widget
Toast.makeText(getContext(), R.string.long_press_widget_to_add,
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 0c5bbeb7e..21842da3b 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -57,6 +57,8 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
private boolean mResetAfterTransition;
private Runnable mRelayoutAndMakeVisible;
+ private Launcher mLauncher;
+
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
mLayoutInflater = LayoutInflater.from(context);
@@ -68,6 +70,10 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
};
}
+ public void setup(Launcher launcher) {
+ mLauncher = launcher;
+ }
+
/**
* Convenience methods to select specific tabs. We want to set the content type immediately
* in these cases, but we note that we still call setCurrentTabByTag() so that the tab view
@@ -463,6 +469,17 @@ 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/Folder.java b/src/com/android/launcher2/Folder.java
index fcaf02037..01939f839 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -194,7 +194,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
v.getLocationOnScreen(pos);
item.intent.setSourceBounds(new Rect(pos[0], pos[1],
pos[0] + v.getWidth(), pos[1] + v.getHeight()));
- mLauncher.startActivitySafely(item.intent, item);
+
+ mLauncher.startActivitySafely(v, item.intent, item);
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index dfeb5900e..3ba93af3f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -26,6 +26,7 @@ import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.ActivityOptions;
import android.app.SearchManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
@@ -830,6 +831,7 @@ public final class Launcher extends Activity
findViewById(R.id.apps_customize_pane);
mAppsCustomizeContent = (AppsCustomizePagedView)
mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
+ mAppsCustomizeTabHost.setup(this);
mAppsCustomizeContent.setup(this, dragController);
// Get the all apps button
@@ -1768,7 +1770,8 @@ public final class Launcher extends Activity
v.getLocationOnScreen(pos);
intent.setSourceBounds(new Rect(pos[0], pos[1],
pos[0] + v.getWidth(), pos[1] + v.getHeight()));
- boolean success = startActivitySafely(intent, tag);
+
+ boolean success = startActivitySafely(v, intent, tag);
if (success && v instanceof BubbleTextView) {
mWaitingForResume = (BubbleTextView) v;
@@ -1836,7 +1839,7 @@ public final class Launcher extends Activity
public void onClickAppMarketButton(View v) {
if (mAppMarketIntent != null) {
- startActivitySafely(mAppMarketIntent, "app market");
+ startActivitySafely(v, mAppMarketIntent, "app market");
} else {
Log.e(TAG, "Invalid app market intent.");
}
@@ -1867,10 +1870,18 @@ public final class Launcher extends Activity
}
}
- boolean startActivitySafely(Intent intent, Object tag) {
+ boolean startActivitySafely(View v, Intent intent, Object tag) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
try {
- startActivity(intent);
+ if (v != null) {
+ ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0,
+ v.getMeasuredWidth(), v.getMeasuredHeight());
+
+ startActivity(intent, opts.toBundle());
+ } else {
+ startActivity(intent);
+ }
return true;
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
@@ -2444,7 +2455,7 @@ public final class Launcher extends Activity
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
- if (level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
+ if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
mAppsCustomizeTabHost.onTrimMemory();
}
}