diff options
author | Winson Chung <winsonc@google.com> | 2011-07-27 17:46:20 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-07-29 11:34:23 -0700 |
commit | 4afe9b31f51022538b30646fe83780e83bf22490 (patch) | |
tree | 24d7c49cb86a062f7a430166a3f7416565896ee8 /src/com/android/launcher2/Workspace.java | |
parent | fec9786f2e7171f6616b8258a8dee8be2d5f1fd4 (diff) | |
download | android_packages_apps_Trebuchet-4afe9b31f51022538b30646fe83780e83bf22490.tar.gz android_packages_apps_Trebuchet-4afe9b31f51022538b30646fe83780e83bf22490.tar.bz2 android_packages_apps_Trebuchet-4afe9b31f51022538b30646fe83780e83bf22490.zip |
Adding ability to add to hotseat from spring loaded mode (5064141).
- Fixing regression where folder items had no text in tablet ui and assets
- Fixing spring loaded frame sizing (5067335)
- Making the cells 80x80 for testing again on the phone ui (5085986)
Change-Id: I52a0f5eaf2dcf4adaf57c5a71da3903892c490a8
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 10b218a31..ecc548397 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -261,7 +261,10 @@ public class Workspace extends SmoothPagedView setDataIsReady(); if (!LauncherApplication.isScreenLarge()) { - mFadeInAdjacentScreens = false; + mCenterPagesVertically = false; + if (!LauncherApplication.isScreenLandscape(context)) { + mFadeInAdjacentScreens = false; + } } mWallpaperManager = WallpaperManager.getInstance(context); @@ -1335,7 +1338,7 @@ public class Workspace extends SmoothPagedView } // we use this to shrink the workspace for the all apps view and the customize view - public void shrink(State shrinkState, boolean animated) { + public void shrink(final State shrinkState, boolean animated) { if (mFirstLayout) { // (mFirstLayout == "first layout has not happened yet") // if we get a call to shrink() as part of our initialization (for example, if @@ -1527,6 +1530,14 @@ 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); @@ -1705,7 +1716,7 @@ public class Workspace extends SmoothPagedView mNewRotationYs = new float[childCount]; } - void unshrink(boolean animated, boolean springLoaded) { + void unshrink(boolean animated, final boolean springLoaded) { if (mFirstLayout) { // (mFirstLayout == "first layout has not happened yet") // cancel any pending shrinks that were set earlier @@ -1742,18 +1753,22 @@ public class Workspace extends SmoothPagedView final CellLayout cl = (CellLayout)getChildAt(i); float finalAlphaValue = 0f; float rotation = 0f; - if (LauncherApplication.isScreenLarge()) { - finalAlphaValue = (i == mCurrentPage) ? 1.0f : 0.0f; + // Set the final alpha depending on whether we are fading side pages. On phone ui, + // we don't do any of the rotation, or the fading alpha in portrait. See the + // ctor and screenScrolled(). + if (mFadeInAdjacentScreens) { + finalAlphaValue = (i == mCurrentPage) ? 1f : 0f; + } else { + finalAlphaValue = 1f; + } + + if (LauncherApplication.isScreenLarge()) { if (i < mCurrentPage) { rotation = WORKSPACE_ROTATION; } else if (i > mCurrentPage) { rotation = -WORKSPACE_ROTATION; } - } else { - // Don't hide the side panes on the phone if we don't also update the side pages - // alpha. See screenScrolled(). - finalAlphaValue = 1f; } float finalAlphaMultiplierValue = 1f; @@ -1864,6 +1879,14 @@ 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]); + } } }); @@ -2259,7 +2282,8 @@ public class Workspace extends SmoothPagedView // new current/default screen, so any subsequent taps add items to that screen if (!mLauncher.isAllAppsVisible()) { int dragTargetIndex = indexOfChild(mDragTargetLayout); - if (mCurrentPage != dragTargetIndex && (isSmall() || mIsSwitchingState)) { + if (dragTargetIndex > -1 && mCurrentPage != dragTargetIndex && + (isSmall() || mIsSwitchingState)) { scrollToNewPageWithoutMovingPages(dragTargetIndex); } } @@ -2767,19 +2791,27 @@ public class Workspace extends SmoothPagedView if (mInScrollArea) return; if (mIsSwitchingState) return; + Rect r = new Rect(); CellLayout layout = null; ItemInfo item = (ItemInfo) d.dragInfo; // Ensure that we have proper spans for the item that we are dropping if (item.spanX < 0 || item.spanY < 0) throw new RuntimeException("Improper spans found"); - mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, - d.dragView, mDragViewVisualCenter); + d.dragView, mDragViewVisualCenter); // Identify whether we have dragged over a side page if (isSmall()) { - layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0], + if (mLauncher.getHotseat() != null) { + mLauncher.getHotseat().getHitRect(r); + if (r.contains(d.x, d.y)) { + layout = mLauncher.getHotseat().getLayout(); + } + } + if (layout == null) { + layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0], mDragViewVisualCenter[1], true); + } if (layout != mDragTargetLayout) { // Cancel all intermediate folder states cleanupFolderCreation(d); @@ -2798,12 +2830,15 @@ public class Workspace extends SmoothPagedView boolean isInSpringLoadedMode = (mState == State.SPRING_LOADED); if (isInSpringLoadedMode) { - mSpringLoadedDragController.setAlarm(mDragTargetLayout); + if (mLauncher.isHotseatLayout(layout)) { + mSpringLoadedDragController.cancel(); + } else { + mSpringLoadedDragController.setAlarm(mDragTargetLayout); + } } } } else { // Test to see if we are over the hotseat otherwise just use the current page - Rect r = new Rect(); if (mLauncher.getHotseat() != null) { mLauncher.getHotseat().getHitRect(r); if (r.contains(d.x, d.y)) { |