diff --git a/res/drawable-large-hdpi/portal_ring_inner_holo.png b/res/drawable-large-hdpi/portal_ring_inner_holo.png new file mode 100644 index 0000000000..1e89e781cc Binary files /dev/null and b/res/drawable-large-hdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-large-hdpi/portal_ring_outer_holo.png b/res/drawable-large-hdpi/portal_ring_outer_holo.png new file mode 100644 index 0000000000..275777989b Binary files /dev/null and b/res/drawable-large-hdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-large-mdpi/portal_container_holo.9.png b/res/drawable-large-mdpi/portal_container_holo.9.png deleted file mode 100644 index 7eef5d7c53..0000000000 Binary files a/res/drawable-large-mdpi/portal_container_holo.9.png and /dev/null differ diff --git a/res/drawable-large-mdpi/portal_ring_inner_holo.png b/res/drawable-large-mdpi/portal_ring_inner_holo.png index c22224f251..c787b01b3e 100644 Binary files a/res/drawable-large-mdpi/portal_ring_inner_holo.png and b/res/drawable-large-mdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-large-mdpi/portal_ring_outer_holo.png b/res/drawable-large-mdpi/portal_ring_outer_holo.png index b94c948f46..1cac4539b6 100644 Binary files a/res/drawable-large-mdpi/portal_ring_outer_holo.png and b/res/drawable-large-mdpi/portal_ring_outer_holo.png differ diff --git a/res/drawable-large-xhdpi/portal_ring_inner_holo.png b/res/drawable-large-xhdpi/portal_ring_inner_holo.png new file mode 100644 index 0000000000..f937012f63 Binary files /dev/null and b/res/drawable-large-xhdpi/portal_ring_inner_holo.png differ diff --git a/res/drawable-large-xhdpi/portal_ring_outer_holo.png b/res/drawable-large-xhdpi/portal_ring_outer_holo.png new file mode 100644 index 0000000000..f347061343 Binary files /dev/null and b/res/drawable-large-xhdpi/portal_ring_outer_holo.png differ diff --git a/res/layout-large/workspace.xml b/res/layout-large/workspace.xml index abed5a8f54..327afaf00d 100644 --- a/res/layout-large/workspace.xml +++ b/res/layout-large/workspace.xml @@ -15,11 +15,11 @@ --> + diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml index 2f8d99529b..8a5d4aeb60 100644 --- a/res/layout-port/launcher.xml +++ b/res/layout-port/launcher.xml @@ -51,6 +51,8 @@ android:id="@+id/workspace" android:layout_width="match_parent" android:layout_height="match_parent" + android:paddingTop="@dimen/qsb_bar_height" + android:paddingBottom="@dimen/button_bar_height" launcher:defaultScreen="2" launcher:cellCountX="4" launcher:cellCountY="4" diff --git a/res/layout/workspace_screen.xml b/res/layout/workspace_screen.xml index ede0d99071..c7d30ced75 100644 --- a/res/layout/workspace_screen.xml +++ b/res/layout/workspace_screen.xml @@ -17,9 +17,8 @@ 10dip - @dimen/qsb_bar_height - @dimen/button_bar_height + + 12dp + 12dp + 0dp 0dp 8dp diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml index ea79a5a4d7..437a51110d 100644 --- a/res/values-land/styles.xml +++ b/res/values-land/styles.xml @@ -18,6 +18,11 @@ --> + + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 309bf6db47..cb354b4b34 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -21,7 +21,7 @@ 80dp -1dp -1dp - 8dp + 16dp 74dp 80dp 12dp diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index c2d13410d9..b6bc5dc521 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -183,7 +183,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(android.animation.Animator animation) { - mAppsCustomizePane.flashScrollingIndicator(); + if (!LauncherApplication.isScreenLarge()) { + mAppsCustomizePane.flashScrollingIndicator(); + } } }); anim.start(); @@ -250,7 +252,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona setLayerType(LAYER_TYPE_NONE, null); } - if (!toWorkspace) { + if (!toWorkspace && !LauncherApplication.isScreenLarge()) { mAppsCustomizePane.flashScrollingIndicator(); } } diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 518c79fc28..9440b89d30 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -906,11 +906,6 @@ public class CellLayout extends ViewGroup { int vFreeSpace = vSpace - (mCountY * mOriginalCellHeight); mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0); mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0); - int remainingHSpace = hFreeSpace - (numWidthGaps * mWidthGap); - int remainingVSpace = vFreeSpace - (numHeightGaps * mHeightGap); - mCellWidth = mOriginalCellWidth + remainingHSpace / mCountX; - mCellHeight = mOriginalCellHeight + remainingVSpace / mCountY; - mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); } else { mWidthGap = mOriginalWidthGap; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index cd62ee1f3c..400c8813a2 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2040,6 +2040,7 @@ public final class Launcher extends Activity // Shrink workspaces away if going to AppsCustomize from workspace mWorkspace.shrink(Workspace.State.SMALL, animated); + hideHotseat(animated); if (animated) { final ValueAnimator scaleAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration); @@ -2141,6 +2142,7 @@ public final class Launcher extends Activity if (!springLoaded) { mWorkspace.unshrink(animated); } + showHotseat(animated); if (animated) { if (mStateAnimation != null) mStateAnimation.cancel(); mStateAnimation = new AnimatorSet(); @@ -2297,7 +2299,6 @@ public final class Launcher extends Activity // Hide the search bar and hotseat mSearchDeleteBar.hideSearchBar(animated); - hideHotseat(animated); // Change the state *after* we've called all the transition code mState = State.APPS_CUSTOMIZE; @@ -2357,7 +2358,6 @@ public final class Launcher extends Activity // Show the search bar and hotseat mSearchDeleteBar.showSearchBar(animated); - showHotseat(animated); // Set focus to the AppsCustomize button if (mAllAppsButton != null) { diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java index 94163acc6b..9b2458758c 100644 --- a/src/com/android/launcher2/LauncherApplication.java +++ b/src/com/android/launcher2/LauncherApplication.java @@ -19,6 +19,7 @@ package com.android.launcher2; import android.app.Application; import android.app.SearchManager; import android.content.ContentResolver; +import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; @@ -116,6 +117,11 @@ public class LauncherApplication extends Application { return sIsScreenLarge; } + public static boolean isScreenLandscape(Context context) { + return context.getResources().getConfiguration().orientation == + Configuration.ORIENTATION_LANDSCAPE; + } + public static float getScreenDensity() { return sScreenDensity; } diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 292ccd740c..48360feb13 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -578,9 +578,9 @@ public abstract class PagedView extends ViewGroup { protected void updateAdjacentPagesAlpha() { if (mFadeInAdjacentScreens) { if (mDirtyPageAlpha || (mTouchState == TOUCH_STATE_SCROLLING) || !mScroller.isFinished()) { - int screenWidth = getMeasuredWidth(); + int screenWidth = getMeasuredWidth() - mPaddingLeft - mPaddingRight; int halfScreenSize = screenWidth / 2; - int screenCenter = mScrollX + halfScreenSize; + int screenCenter = mScrollX + halfScreenSize + mPaddingLeft; final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { View layout = (View) getChildAt(i); @@ -1265,11 +1265,13 @@ public abstract class PagedView extends ViewGroup { } protected int getRelativeChildOffset(int index) { - return (getMeasuredWidth() - getChildWidth(index)) / 2; + int padding = mPaddingLeft + mPaddingRight; + return mPaddingLeft + (getMeasuredWidth() - padding - getChildWidth(index)) / 2; } - protected int getScaledRelativeChildOffset(int index) { - return (getMeasuredWidth() - getScaledMeasuredWidth(getChildAt(index))) / 2; + int padding = mPaddingLeft + mPaddingRight; + return mPaddingLeft + (getMeasuredWidth() - padding - + getScaledMeasuredWidth(getChildAt(index))) / 2; } protected int getChildOffset(int index) { @@ -1762,7 +1764,7 @@ public abstract class PagedView extends ViewGroup { int numPages = getChildCount(); int pageWidth = getMeasuredWidth(); - int maxPageWidth = (numPages * getMeasuredWidth()) + ((numPages - 1) * mPageSpacing); + int maxPageWidth = (numPages * getChildWidth(0)) + ((numPages - 1) * mPageSpacing); int trackWidth = pageWidth - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight; int indicatorWidth = mScrollIndicator.getMeasuredWidth() - mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight(); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 10b218a316..ecc5483970 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)) {