From c100e8eae7d67ad5bd78767494b62b8fae5d1779 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 9 Aug 2011 16:02:43 -0700 Subject: Tablet/AllApps fixes. - Fixing regression where the power button did not dismiss Apps/Customize - Fixing regression in number of icons in portrain in AC, and removing legacy peek var for calculations (5122724) - Fixing spacing in shop button on tablet - Fixing bug where the apps pane was being changed as we were animating (5139543) Change-Id: I3a3e5f224fd92e99072c830d13423d195179e7c7 --- res/layout-large/market_button.xml | 35 ++++++++++++++++++++++ res/layout/apps_customize_pane.xml | 21 ++----------- res/layout/market_button.xml | 31 +++++++++++++++++++ res/values-large-port/dimens.xml | 8 ++--- res/values-large/dimens.xml | 4 --- res/values-xlarge-port/dimens.xml | 5 ---- res/values/dimens.xml | 1 - .../android/launcher2/AppsCustomizeTabHost.java | 19 ++++++++++++ src/com/android/launcher2/Launcher.java | 16 ++++------ src/com/android/launcher2/PagedViewCellLayout.java | 4 +-- 10 files changed, 97 insertions(+), 47 deletions(-) create mode 100644 res/layout-large/market_button.xml create mode 100644 res/layout/market_button.xml diff --git a/res/layout-large/market_button.xml b/res/layout-large/market_button.xml new file mode 100644 index 000000000..ad5f6da0d --- /dev/null +++ b/res/layout-large/market_button.xml @@ -0,0 +1,35 @@ + + + diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml index 788d4c335..05e7fc124 100644 --- a/res/layout/apps_customize_pane.xml +++ b/res/layout/apps_customize_pane.xml @@ -35,27 +35,12 @@ android:layout_gravity="left" android:background="@drawable/tab_unselected_holo" android:tabStripEnabled="false" /> - + android:layout_gravity="right" /> + + diff --git a/res/values-large-port/dimens.xml b/res/values-large-port/dimens.xml index e0651b22b..4e1cf8fc9 100644 --- a/res/values-large-port/dimens.xml +++ b/res/values-large-port/dimens.xml @@ -18,10 +18,6 @@ 96dp 96dp - - 12dp 64dp @@ -40,6 +36,6 @@ 36dp 25dp 10dp - 20dp - 20dp + 10dp + 10dp \ No newline at end of file diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml index 234fcdb0a..3fe53b541 100644 --- a/res/values-large/dimens.xml +++ b/res/values-large/dimens.xml @@ -33,10 +33,6 @@ 56dp 96dp 96dp - - 48dp 36dp 36dp diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml index 4f532805a..0850e8c75 100644 --- a/res/values-xlarge-port/dimens.xml +++ b/res/values-xlarge-port/dimens.xml @@ -15,11 +15,6 @@ --> - - 48dp - 36dp diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 641f8ea36..39342377d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -41,7 +41,6 @@ 72dp 80dp - 0dp 18dp 10dp 10dp diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 25001b19a..8f067faa5 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -45,6 +45,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona private ViewGroup mTabsContainer; private AppsCustomizePagedView mAppsCustomizePane; + private boolean mInTransition; + private boolean mResetAfterTransition; + public AppsCustomizeTabHost(Context context, AttributeSet attrs) { super(context, attrs); mLayoutInflater = LayoutInflater.from(context); @@ -223,9 +226,20 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona return super.getDescendantFocusability(); } + void reset() { + if (mInTransition) { + // Defer to after the transition to reset + mResetAfterTransition = true; + } else { + // Reset immediately + mAppsCustomizePane.reset(); + } + } + /* LauncherTransitionable overrides */ @Override public void onLauncherTransitionStart(Animator animation, boolean toWorkspace) { + mInTransition = true; // isHardwareAccelerated() checks if we're attached to a window and if that // window is HW accelerated-- we were sometimes not attached to a window // and buildLayer was throwing an IllegalStateException @@ -240,10 +254,15 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona if (!toWorkspace && !LauncherApplication.isScreenLarge()) { mAppsCustomizePane.showScrollingIndicator(false); } + if (mResetAfterTransition) { + mAppsCustomizePane.reset(); + mResetAfterTransition = false; + } } @Override public void onLauncherTransitionEnd(Animator animation, boolean toWorkspace) { + mInTransition = false; if (animation != null) { setLayerType(LAYER_TYPE_NONE, null); } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 1b105d23a..414cf282b 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -915,10 +915,11 @@ public final class Launcher extends Activity mDragLayer.clearAllResizeFrames(); updateRunning(); - // Reset AllApps to it's initial state only if we are not in the middle of + // Reset AllApps to its initial state only if we are not in the middle of // processing a multi-step drop - if (mAppsCustomizeContent != null && mPendingAddInfo.container == ItemInfo.NO_ID) { - mAppsCustomizeContent.reset(); + if (mAppsCustomizeTabHost != null && mPendingAddInfo.container == ItemInfo.NO_ID) { + mAppsCustomizeTabHost.reset(); + showWorkspace(false); } } else if (Intent.ACTION_USER_PRESENT.equals(action)) { mUserPresent = true; @@ -1091,8 +1092,8 @@ public final class Launcher extends Activity } // Reset AllApps to its initial state - if (mAppsCustomizeContent != null) { - mAppsCustomizeContent.reset(); + if (mAppsCustomizeTabHost != null) { + mAppsCustomizeTabHost.reset(); } } } @@ -2465,11 +2466,6 @@ public final class Launcher extends Activity sAppMarketIcon = updateTextButtonWithIconFromExternalActivity( R.id.market_button, activityName, R.drawable.ic_launcher_market_holo); marketButton.setVisibility(View.VISIBLE); - - // Remove the shop icon text in the Phone UI - if (!LauncherApplication.isScreenLarge()) { - ((TextView) marketButton).setText(""); - } } else { // We should hide and disable the view so that we don't try and restore the visibility // of it when we swap between drag & normal states from IconDropTarget subclasses. diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index bec00ec0c..63cf9e8bf 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -46,7 +46,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page { private int mWidthGap; private int mHeightGap; private int mMaxGap; - private float mPeekWidth; protected PagedViewCellLayoutChildren mChildren; private PagedViewCellLayoutChildren mHolographicChildren; private boolean mAllowHardwareLayerCreation = false; @@ -71,7 +70,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page { resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width); mOriginalCellHeight = mCellHeight = resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height); - mPeekWidth = resources.getDimensionPixelSize(R.dimen.apps_customize_peek_width); mCellCountX = LauncherModel.getCellCountX(); mCellCountY = LauncherModel.getCellCountY(); mOriginalHeightGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1; @@ -366,7 +364,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page { // The space for a page assuming that we want to show half of a column of the previous and // next pages is the width - left padding (current & next page) - right padding (previous & // current page) - half cell width (for previous and next pages) - int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight) - (2 * mPeekWidth)); + int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight)); // We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap)); -- cgit v1.2.3