diff options
23 files changed, 126 insertions, 46 deletions
diff --git a/res/drawable-large-hdpi/portal_ring_inner_holo.png b/res/drawable-large-hdpi/portal_ring_inner_holo.png Binary files differnew file mode 100644 index 000000000..1e89e781c --- /dev/null +++ b/res/drawable-large-hdpi/portal_ring_inner_holo.png diff --git a/res/drawable-large-hdpi/portal_ring_outer_holo.png b/res/drawable-large-hdpi/portal_ring_outer_holo.png Binary files differnew file mode 100644 index 000000000..275777989 --- /dev/null +++ b/res/drawable-large-hdpi/portal_ring_outer_holo.png diff --git a/res/drawable-large-mdpi/portal_container_holo.9.png b/res/drawable-large-mdpi/portal_container_holo.9.png Binary files differdeleted file mode 100644 index 7eef5d7c5..000000000 --- a/res/drawable-large-mdpi/portal_container_holo.9.png +++ /dev/null diff --git a/res/drawable-large-mdpi/portal_ring_inner_holo.png b/res/drawable-large-mdpi/portal_ring_inner_holo.png Binary files differindex c22224f25..c787b01b3 100644 --- a/res/drawable-large-mdpi/portal_ring_inner_holo.png +++ b/res/drawable-large-mdpi/portal_ring_inner_holo.png diff --git a/res/drawable-large-mdpi/portal_ring_outer_holo.png b/res/drawable-large-mdpi/portal_ring_outer_holo.png Binary files differindex b94c948f4..1cac4539b 100644 --- a/res/drawable-large-mdpi/portal_ring_outer_holo.png +++ b/res/drawable-large-mdpi/portal_ring_outer_holo.png diff --git a/res/drawable-large-xhdpi/portal_ring_inner_holo.png b/res/drawable-large-xhdpi/portal_ring_inner_holo.png Binary files differnew file mode 100644 index 000000000..f937012f6 --- /dev/null +++ b/res/drawable-large-xhdpi/portal_ring_inner_holo.png diff --git a/res/drawable-large-xhdpi/portal_ring_outer_holo.png b/res/drawable-large-xhdpi/portal_ring_outer_holo.png Binary files differnew file mode 100644 index 000000000..f34706134 --- /dev/null +++ b/res/drawable-large-xhdpi/portal_ring_outer_holo.png diff --git a/res/layout-large/workspace.xml b/res/layout-large/workspace.xml index abed5a8f5..327afaf00 100644 --- a/res/layout-large/workspace.xml +++ b/res/layout-large/workspace.xml @@ -15,11 +15,11 @@ --> <!-- The workspace contains 5 screens of cells --> + <com.android.launcher2.Workspace xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" - android:paddingTop="?android:attr/actionBarSize" - android:paddingBottom="10dp" + android:paddingTop="@dimen/workspace_content_large_only_top_margin" launcher:defaultScreen="2" launcher:pageSpacing="@dimen/workspace_page_spacing"> <include android:id="@+id/cell1" layout="@layout/workspace_screen" /> diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml index 2f8d99529..8a5d4aeb6 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 ede0d9907..c7d30ced7 100644 --- a/res/layout/workspace_screen.xml +++ b/res/layout/workspace_screen.xml @@ -17,9 +17,8 @@ <com.android.launcher2.CellLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" + style="@style/WorkspaceScreen" - android:layout_width="match_parent" - android:layout_height="match_parent" android:paddingLeft="@dimen/workspace_left_padding" android:paddingRight="@dimen/workspace_right_padding" android:paddingTop="@dimen/workspace_top_padding" diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index c715bfb85..b413c5343 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -20,8 +20,11 @@ <dimen name="toolbar_button_horizontal_padding">10dip</dimen> <!-- Workspace --> - <dimen name="workspace_left_padding">@dimen/qsb_bar_height</dimen> - <dimen name="workspace_right_padding">@dimen/button_bar_height</dimen> + <!-- Block spacing on each side of the screen --> + <dimen name="workspace_left_padding">12dp</dimen> + <dimen name="workspace_right_padding">12dp</dimen> + <!-- We need top/bottom padding for portals to look right, but + really only in spring loaded mode... --> <dimen name="workspace_top_padding">0dp</dimen> <dimen name="workspace_bottom_padding">0dp</dimen> <dimen name="workspace_page_spacing">8dp</dimen> diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml index ea79a5a4d..437a51110 100644 --- a/res/values-land/styles.xml +++ b/res/values-land/styles.xml @@ -18,6 +18,11 @@ --> <resources> +<!-- Workspace --> + <style name="WorkspaceScreen"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">match_parent</item> + </style> <!-- Search Bar --> <style name="SearchDropTargetBar"> <item name="android:orientation">vertical</item> diff --git a/res/values-large-land/dimens.xml b/res/values-large-land/dimens.xml index 12fc8b309..4358ff940 100644 --- a/res/values-large-land/dimens.xml +++ b/res/values-large-land/dimens.xml @@ -16,10 +16,11 @@ <resources> <!-- Workspace --> - <dimen name="workspace_left_padding">25dip</dimen> - <dimen name="workspace_right_padding">25dip</dimen> - <dimen name="workspace_top_padding">15dip</dimen> - <dimen name="workspace_bottom_padding">15dip</dimen> + <dimen name="workspace_left_padding">24dip</dimen> + <dimen name="workspace_right_padding">24dip</dimen> + <!-- We need padding on the screens for portals to look right --> + <dimen name="workspace_top_padding">12dip</dimen> + <dimen name="workspace_bottom_padding">12dip</dimen> <dimen name="workspace_width_gap">32dp</dimen> <dimen name="workspace_height_gap">2dp</dimen> <dimen name="workspace_page_spacing">50dp</dimen> diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml index a0fc814c6..234fcdb0a 100644 --- a/res/values-large/dimens.xml +++ b/res/values-large/dimens.xml @@ -21,9 +21,13 @@ <!-- Workspace --> <dimen name="qsb_bar_height">56dp</dimen> - + <!-- This should be @dimen/qsb_bar_height - @dimen/workspace_top_padding + to fix the extra space given to draw portals --> + <dimen name="workspace_content_large_only_top_margin">36dp</dimen> <dimen name="workspace_cell_width">96dip</dimen> <dimen name="workspace_cell_height">96dip</dimen> + <dimen name="folder_cell_width">96dp</dimen> + <dimen name="folder_cell_height">96dp</dimen> <!-- AppsCustomize --> <dimen name="apps_customize_tab_bar_height">56dp</dimen> diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml index 2d27321ef..9add35759 100644 --- a/res/values-port/dimens.xml +++ b/res/values-port/dimens.xml @@ -18,10 +18,10 @@ <!-- Workspace --> <dimen name="workspace_left_padding">0dp</dimen> <dimen name="workspace_right_padding">0dp</dimen> - <!-- We use the qsb_bar_height (48dp) + 12dp extra padding --> - <dimen name="workspace_top_padding">60dp</dimen> - <!-- We use the button_bar_height (80dp) + 12dp extra padding --> - <dimen name="workspace_bottom_padding">96dp</dimen> + <!-- Block spacing on each side of the screen. And also padding + for the portals to look right. --> + <dimen name="workspace_top_padding">12dp</dimen> + <dimen name="workspace_bottom_padding">12dp</dimen> <dimen name="workspace_page_spacing">8dp</dimen> <integer name="apps_customize_cellCountX">4</integer> diff --git a/res/values-port/styles.xml b/res/values-port/styles.xml new file mode 100644 index 000000000..66a4ca728 --- /dev/null +++ b/res/values-port/styles.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +* Copyright (C) 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--> + +<resources> +<!-- Workspace --> + <style name="WorkspaceScreen"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + </style> +</resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 309bf6db4..cb354b4b3 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -21,7 +21,7 @@ <dimen name="workspace_cell_height">80dp</dimen> <dimen name="workspace_width_gap">-1dp</dimen> <dimen name="workspace_height_gap">-1dp</dimen> - <dimen name="workspace_max_gap">8dp</dimen> + <dimen name="workspace_max_gap">16dp</dimen> <dimen name="folder_cell_width">74dp</dimen> <dimen name="folder_cell_height">80dp</dimen> <dimen name="workspace_divider_padding_left">12dp</dimen> diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index c2d13410d..b6bc5dc52 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 518c79fc2..9440b89d3 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 cd62ee1f3..400c8813a 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 94163acc6..9b2458758 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 292ccd740..48360feb1 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 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)) { |