From 1c4cf4a11f3f7f24bbf65f958fdd22295d0bbd55 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 29 Jul 2011 14:49:10 -0700 Subject: Minor bug fixes - Making the spring loaded side page hovers slightly faster - Fixing issue where you can't drag over another item on another page to create a portal - Ignoring side pages while hovering over hotseat - Fixing issue where hotseat may be stuck in shrunken state (and removing the scale on the hotseat) Change-Id: I87d50a1bdc451704285482c79caed0982a5a7f5a --- src/com/android/launcher2/DragController.java | 4 +-- src/com/android/launcher2/DragScroller.java | 2 +- .../launcher2/SpringLoadedDragController.java | 6 ++-- src/com/android/launcher2/Workspace.java | 40 +++++++++++----------- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index eb0db69eb..28c53d163 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -483,14 +483,14 @@ public class DragController { mScrollState = SCROLL_WAITING_IN_ZONE; mScrollRunnable.setDirection(SCROLL_LEFT); mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); - mDragScroller.onEnterScrollArea(SCROLL_LEFT); + mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT); } } else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { mScrollState = SCROLL_WAITING_IN_ZONE; mScrollRunnable.setDirection(SCROLL_RIGHT); mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); - mDragScroller.onEnterScrollArea(SCROLL_RIGHT); + mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT); } } else { if (mScrollState == SCROLL_WAITING_IN_ZONE) { diff --git a/src/com/android/launcher2/DragScroller.java b/src/com/android/launcher2/DragScroller.java index 6ef4bd873..894b06b27 100644 --- a/src/com/android/launcher2/DragScroller.java +++ b/src/com/android/launcher2/DragScroller.java @@ -30,7 +30,7 @@ public interface DragScroller { * * @param direction The scroll direction */ - void onEnterScrollArea(int direction); + void onEnterScrollArea(int x, int y, int direction); /** * The touch point has left the scroll area. diff --git a/src/com/android/launcher2/SpringLoadedDragController.java b/src/com/android/launcher2/SpringLoadedDragController.java index 7b4adf30f..358362c85 100644 --- a/src/com/android/launcher2/SpringLoadedDragController.java +++ b/src/com/android/launcher2/SpringLoadedDragController.java @@ -18,7 +18,8 @@ package com.android.launcher2; public class SpringLoadedDragController implements OnAlarmListener { // how long the user must hover over a mini-screen before it unshrinks - final long ENTER_SPRING_LOAD_HOVER_TIME = 1000; + final long ENTER_SPRING_LOAD_HOVER_TIME = 550; + final long ENTER_SPRING_LOAD_CANCEL_HOVER_TIME = 950; final long EXIT_SPRING_LOAD_HOVER_TIME = 200; Alarm mAlarm; @@ -40,7 +41,8 @@ public class SpringLoadedDragController implements OnAlarmListener { // Set a new alarm to expire for the screen that we are hovering over now public void setAlarm(CellLayout cl) { mAlarm.cancelAlarm(); - mAlarm.setAlarm(ENTER_SPRING_LOAD_HOVER_TIME); + mAlarm.setAlarm((cl == null) ? ENTER_SPRING_LOAD_CANCEL_HOVER_TIME : + ENTER_SPRING_LOAD_HOVER_TIME); mScreen = cl; } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index c10bd1aea..11528e4b7 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1539,14 +1539,6 @@ public class Workspace extends SmoothPagedView cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]); cl.setFastRotationY(a * mOldRotationYs[i] + b * mNewRotationYs[i]); } - - // Shrink the hotset the same amount we are shrinking the screens - if (shrinkState == State.SPRING_LOADED && mLauncher.getHotseat() != null) { - View hotseat = mLauncher.getHotseat().getLayout(); - hotseat.fastInvalidate(); - hotseat.setFastScaleX(a * mOldScaleXs[0] + b * mNewScaleXs[0]); - hotseat.setFastScaleY(a * mOldScaleXs[0] + b * mNewScaleXs[0]); - } } }); mAnimator.playTogether(animWithInterpolator); @@ -1820,6 +1812,14 @@ public class Workspace extends SmoothPagedView mUnshrinkAnimationListener.onAnimationEnd(null); } } + + // Unshrink the hotset the same amount we are unshrinking the screens + if (mLauncher.getHotseat() != null) { + View hotseat = mLauncher.getHotseat().getLayout(); + hotseat.setScaleX(finalScaleFactor); + hotseat.setScaleY(finalScaleFactor); + } + Display display = mLauncher.getWindowManager().getDefaultDisplay(); boolean isLandscape = display.getWidth() > display.getHeight(); // on phones, don't scroll the wallpaper horizontally or vertically when switching @@ -1888,14 +1888,6 @@ public class Workspace extends SmoothPagedView b * mNewBackgroundAlphaMultipliers[i]); cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]); } - - // Unshrink the hotset the same amount we are unshrinking the screens - if (mLauncher.getHotseat() != null) { - View hotseat = mLauncher.getHotseat().getLayout(); - hotseat.fastInvalidate(); - hotseat.setFastScaleX(a * mOldScaleXs[0] + b * mNewScaleXs[0]); - hotseat.setFastScaleY(a * mOldScaleXs[0] + b * mNewScaleXs[0]); - } } }); @@ -2333,8 +2325,7 @@ public class Workspace extends SmoothPagedView mDragViewVisualCenter[1], spanX, spanY, dropTargetLayout, mTargetCell); // If the item being dropped is a shortcut and the nearest drop // cell also contains a shortcut, then create a folder with the two shortcuts. - boolean dropInscrollArea = hasMovedLayouts && !hasMovedIntoHotseat; - if (!dropInscrollArea && createUserFolderIfNecessary(cell, container, + if (!mInScrollArea && createUserFolderIfNecessary(cell, container, dropTargetLayout, mTargetCell, false, d.dragView, null)) { return; } @@ -2349,7 +2340,7 @@ public class Workspace extends SmoothPagedView (int) mDragViewVisualCenter[1], mDragInfo.spanX, mDragInfo.spanY, cell, dropTargetLayout, mTargetCell); - if (dropInscrollArea && mState != State.SPRING_LOADED) { + if (mInScrollArea && !hasMovedIntoHotseat && mState != State.SPRING_LOADED) { snapScreen = screen; snapToPage(screen); } @@ -3304,7 +3295,16 @@ public class Workspace extends SmoothPagedView } @Override - public void onEnterScrollArea(int direction) { + public void onEnterScrollArea(int x, int y, int direction) { + // Ignore the scroll area if we are dragging over the hot seat + if (mLauncher.getHotseat() != null) { + Rect r = new Rect(); + mLauncher.getHotseat().getHitRect(r); + if (r.contains(x, y)) { + return; + } + } + if (!isSmall() && !mIsSwitchingState) { mInScrollArea = true; -- cgit v1.2.3