diff options
author | Winson Chung <winsonc@google.com> | 2011-11-18 11:42:17 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-18 11:42:17 -0800 |
commit | 601cac2f3e2f3ce13d8e2e07dbe51945686044eb (patch) | |
tree | 66a58fc9b76a40b0514868da97ee8200757d4aed /src | |
parent | aa1e57286d5435fff0ad1de894cf9d3d730b5e59 (diff) | |
parent | 3f4e1423804d64a38cb69e4511d7b80783564827 (diff) | |
download | packages_apps_Trebuchet-601cac2f3e2f3ce13d8e2e07dbe51945686044eb.tar.gz packages_apps_Trebuchet-601cac2f3e2f3ce13d8e2e07dbe51945686044eb.tar.bz2 packages_apps_Trebuchet-601cac2f3e2f3ce13d8e2e07dbe51945686044eb.zip |
Merge "Minor fixes to Launcher" into ics-mr1
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 34 | ||||
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/DragController.java | 20 |
3 files changed, 31 insertions, 26 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 2cdd16a49..0189d6c35 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -193,6 +193,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen private ArrayList<Object> mWidgets; // Cling + private boolean mHasShownAllAppsCling; private int mClingFocusedX; private int mClingFocusedY; @@ -396,14 +397,33 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int page = getPageForComponent(mSaveInstanceStateItemIndex); invalidatePageData(Math.max(0, page)); - // Calculate the position for the cling punch through - int[] offset = new int[2]; - int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY); - mLauncher.getDragLayer().getLocationInDragLayer(this, offset); - pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + offset[0]; - pos[1] += (getMeasuredHeight() - mWidgetSpacingLayout.getMeasuredHeight()) / 2 + offset[1]; - mLauncher.showFirstRunAllAppsCling(pos); + // Show All Apps cling if we are finished transitioning, otherwise, we will try again when + // the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be + // returned while animating) + AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost(); + if (!host.isTransitioning()) { + post(new Runnable() { + @Override + public void run() { + showAllAppsCling(); + } + }); + } + } + void showAllAppsCling() { + if (!mHasShownAllAppsCling && isDataReady() && testDataReady()) { + mHasShownAllAppsCling = true; + // Calculate the position for the cling punch through + int[] offset = new int[2]; + int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY); + mLauncher.getDragLayer().getLocationInDragLayer(this, offset); + // PagedViews are centered horizontally but top aligned + pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + + offset[0]; + pos[1] += offset[1]; + mLauncher.showFirstRunAllAppsCling(pos); + } } @Override diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 897a7fb51..778d6bc75 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -388,8 +388,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona } if (!toWorkspace) { - // Dismiss the cling if necessary + // Dismiss the workspace cling and show the all apps cling (if not already shown) l.dismissWorkspaceCling(null); + mAppsCustomizePane.showAllAppsCling(); if (!LauncherApplication.isScreenLarge()) { mAppsCustomizePane.hideScrollingIndicator(false); diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index ee054abcc..286e2fe6d 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -101,7 +101,6 @@ public class DragController { private int mScrollState = SCROLL_OUTSIDE_ZONE; private ScrollRunnable mScrollRunnable = new ScrollRunnable(); - private RectF mDeleteRegion; private DropTarget mLastDropTarget; private InputMethodManager mInputMethodManager; @@ -486,12 +485,6 @@ public class DragController { } mLastDropTarget = dropTarget; - // Scroll, maybe, but not if we're in the delete region. - boolean inDeleteRegion = false; - if (mDeleteRegion != null) { - inDeleteRegion = mDeleteRegion.contains(x, y); - } - // After a scroll, the touch point will still be in the scroll region. // Rather than scrolling immediately, require a bit of twiddling to scroll again final int slop = ViewConfiguration.get(mLauncher).getScaledWindowTouchSlop(); @@ -500,7 +493,7 @@ public class DragController { mLastTouch[0] = x; mLastTouch[1] = y; - if (!inDeleteRegion && x < mScrollZone) { + if (x < mScrollZone) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { mScrollState = SCROLL_WAITING_IN_ZONE; if (mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT)) { @@ -508,7 +501,7 @@ public class DragController { mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); } } - } else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) { + } else if (x > mScrollView.getWidth() - mScrollZone) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { mScrollState = SCROLL_WAITING_IN_ZONE; if (mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT)) { @@ -669,15 +662,6 @@ public class DragController { mScrollView = v; } - /** - * Specifies the delete region. We won't scroll on touch events over the delete region. - * - * @param region The rectangle in DragLayer coordinates of the delete region. - */ - void setDeleteRegion(RectF region) { - mDeleteRegion = region; - } - DragView getDragView() { return mDragObject.dragView; } |