summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-10-25 13:10:55 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-25 13:10:56 -0700
commit8634f8494a0260b75a82f82e8d4a7985030d04c8 (patch)
treebfc6abcf5cf4da6b13274ba9e70037f68ce14046 /src/com/android
parent853e2a7ac308b3d66740a79e72f9e28b8f27f9c8 (diff)
parentcb222e85d256e37da41f0ffa3744656c9b53083c (diff)
downloadandroid_packages_apps_Trebuchet-8634f8494a0260b75a82f82e8d4a7985030d04c8.tar.gz
android_packages_apps_Trebuchet-8634f8494a0260b75a82f82e8d4a7985030d04c8.tar.bz2
android_packages_apps_Trebuchet-8634f8494a0260b75a82f82e8d4a7985030d04c8.zip
Merge "Delay ACTION_MAIN processing when not focused." into jb-mr1-dev
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/Launcher.java67
1 files changed, 41 insertions, 26 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 56fdbb60c..0225d28bf 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1384,39 +1384,54 @@ public final class Launcher extends Activity
// also will cancel mWaitingForResult.
closeSystemDialogs();
- boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
+ final boolean alreadyOnHome =
+ ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
- Folder openFolder = mWorkspace.getOpenFolder();
- // In all these cases, only animate if we're already on home
- mWorkspace.exitWidgetResizeMode();
- if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() &&
- openFolder == null) {
- mWorkspace.moveToDefaultScreen(true);
- }
+ Runnable processIntent = new Runnable() {
+ public void run() {
+ Folder openFolder = mWorkspace.getOpenFolder();
+ // In all these cases, only animate if we're already on home
+ mWorkspace.exitWidgetResizeMode();
+ if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() &&
+ openFolder == null) {
+ mWorkspace.moveToDefaultScreen(true);
+ }
- closeFolder();
- exitSpringLoadedDragMode();
+ closeFolder();
+ exitSpringLoadedDragMode();
- // If we are already on home, then just animate back to the workspace, otherwise, just
- // wait until onResume to set the state back to Workspace
- if (alreadyOnHome) {
- showWorkspace(true);
- } else {
- mOnResumeState = State.WORKSPACE;
- }
+ // If we are already on home, then just animate back to the workspace,
+ // otherwise, just wait until onResume to set the state back to Workspace
+ if (alreadyOnHome) {
+ showWorkspace(true);
+ } else {
+ mOnResumeState = State.WORKSPACE;
+ }
- final View v = getWindow().peekDecorView();
- if (v != null && v.getWindowToken() != null) {
- InputMethodManager imm = (InputMethodManager)getSystemService(
- INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
- }
+ final View v = getWindow().peekDecorView();
+ if (v != null && v.getWindowToken() != null) {
+ InputMethodManager imm = (InputMethodManager)getSystemService(
+ INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
+ }
+
+ // Reset AllApps to its initial state
+ if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
+ mAppsCustomizeTabHost.reset();
+ }
+ }
+ };
- // Reset AllApps to its initial state
- if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
- mAppsCustomizeTabHost.reset();
+ if (alreadyOnHome && !mWorkspace.hasWindowFocus()) {
+ // Delay processing of the intent to allow the status bar animation to finish
+ // first in order to avoid janky animations.
+ mWorkspace.postDelayed(processIntent, 350);
+ } else {
+ // Process the intent immediately.
+ processIntent.run();
}
+
}
}