summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2011-03-03 19:54:56 -0800
committerPatrick Dubroy <dubroy@google.com>2011-03-03 20:10:01 -0800
commit758a9239f045ff4eb85c421a2f67a720b5b3c621 (patch)
treeecf2081ad55e36293e32630c6aeb5ae7251fbd35 /src/com/android
parentc50d9573b31fd5ad9f463370adfeafd15429adc1 (diff)
downloadandroid_packages_apps_Trebuchet-758a9239f045ff4eb85c421a2f67a720b5b3c621.tar.gz
android_packages_apps_Trebuchet-758a9239f045ff4eb85c421a2f67a720b5b3c621.tar.bz2
android_packages_apps_Trebuchet-758a9239f045ff4eb85c421a2f67a720b5b3c621.zip
Fix 3511340: Exit widget resize mode when home or back clicked
Also add an optimization to drastically reduce the number of posted events when a widget is currently being resized. Change-Id: I8839d4bba564028a67fb0355d35b7dd52465b199
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/DragLayer.java7
-rw-r--r--src/com/android/launcher2/Launcher.java3
-rw-r--r--src/com/android/launcher2/Workspace.java5
3 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 37bbb05af..2e72f6223 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -63,12 +63,13 @@ public class DragLayer extends FrameLayout {
// dismiss any visible resize frames.
final Workspace w = (Workspace) findViewById(R.id.workspace);
final CellLayout currentPage = (CellLayout) w.getChildAt(w.getCurrentPage());
+ final CellLayoutChildren childrenLayout = currentPage.getChildrenLayout();
- if (currentPage.getChildrenLayout().hasResizeFrames()) {
+ if (childrenLayout.hasResizeFrames() && !childrenLayout.isWidgetBeingResized()) {
post(new Runnable() {
public void run() {
- if (!currentPage.getChildrenLayout().isWidgetBeingResized()) {
- currentPage.getChildrenLayout().clearAllResizeFrames();
+ if (!childrenLayout.isWidgetBeingResized()) {
+ childrenLayout.clearAllResizeFrames();
}
}
});
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 3e0fcd5d2..994c3b825 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1482,6 +1482,7 @@ public final class Launcher extends Activity
mWorkspace.unshrink(alreadyOnHome);
}
+ mWorkspace.exitWidgetResizeMode();
if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive()) {
mWorkspace.moveToDefaultScreen(true);
}
@@ -2020,6 +2021,8 @@ public final class Launcher extends Activity
dismissPreview(mPreviousView);
dismissPreview(mNextView);
} else {
+ mWorkspace.exitWidgetResizeMode();
+
// Back button is a no-op here, but give at least some feedback for the button press
mWorkspace.showOutlinesTemporarily();
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 88233c12b..123ab1e41 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1790,6 +1790,11 @@ public class Workspace extends SmoothPagedView
}
}
+ public void exitWidgetResizeMode() {
+ final CellLayout currentLayout = (CellLayout) getChildAt(getCurrentPage());
+ currentLayout.getChildrenLayout().clearAllResizeFrames();
+ }
+
void unshrink(boolean animated) {
unshrink(animated, false);
}