diff options
author | Adam Cohen <adamcohen@google.com> | 2014-08-14 12:57:28 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2014-08-14 13:15:32 -0700 |
commit | a00673c7d9f3fcfc81a6e1c6aa7b831951331e84 (patch) | |
tree | 3ee6a8e89c1dad5b19914da79ae77199699aff33 /src/com/android/launcher3/AppsCustomizePagedView.java | |
parent | 63f1ec00fbbd109130d1e476371dbc9a87bb544d (diff) | |
download | android_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.tar.gz android_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.tar.bz2 android_packages_apps_Trebuchet-a00673c7d9f3fcfc81a6e1c6aa7b831951331e84.zip |
Fix issues with the new widget layout
-> use first layout instead of first measure to determine size
-> fix issue where we were doubly accounting for padding of
AppsCustomizePagedView
-> show page backgrounds by default, hide fake page by default
-> stripping some dead code related to the market button
and all apps cling
Change-Id: I787bdf1092c821b780670098fb219a8a68914bc8
Diffstat (limited to 'src/com/android/launcher3/AppsCustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher3/AppsCustomizePagedView.java | 48 |
1 files changed, 7 insertions, 41 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 2e81b9326..787bf96d2 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -214,7 +214,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int mWidgetLoadingId = -1; PendingAddWidgetInfo mCreateWidgetInfo = null; private boolean mDraggingWidget = false; - boolean mPageBackgroundsVisible; + boolean mPageBackgroundsVisible = true; private Toast mWidgetInstructionToast; @@ -376,52 +376,19 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mWidgetSpacingLayout.measure(widthSpec, heightSpec); final boolean hostIsTransitioning = getTabHost().isInTransition(); - - // Restore the page int page = getPageForComponent(mSaveInstanceStateItemIndex); invalidatePageData(Math.max(0, page), hostIsTransitioning); - - // Show All Apps cling if we are finished transitioning, otherwise, we will try again when - // the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be - // returned while animating) - if (!hostIsTransitioning) { - post(new Runnable() { - @Override - public void run() { - showAllAppsCling(); - } - }); - } } - void showAllAppsCling() { - if (!mHasShownAllAppsCling && isDataReady()) { - mHasShownAllAppsCling = true; - // Calculate the position for the cling punch through - int[] offset = new int[2]; - int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY); - mLauncher.getDragLayer().getLocationInDragLayer(this, offset); - // PagedViews are centered horizontally but top aligned - // Note we have to shift the items up now that Launcher sits under the status bar - pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + - offset[0]; - pos[1] += offset[1] - mLauncher.getDragLayer().getPaddingTop(); - } - } + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int width = MeasureSpec.getSize(widthMeasureSpec); - int height = MeasureSpec.getSize(heightMeasureSpec); if (!isDataReady()) { if ((LauncherAppState.isDisableAllApps() || !mApps.isEmpty()) && !mWidgets.isEmpty()) { setDataIsReady(); - setMeasuredDimension(width, height); - onDataReady(width, height); + onDataReady(getMeasuredWidth(), getMeasuredHeight()); } } - - super.onMeasure(widthMeasureSpec, heightMeasureSpec); } public void onPackagesUpdated(ArrayList<Object> widgetsAndShortcuts) { @@ -1179,11 +1146,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // Calculate the dimensions of each cell we are giving to each widget final ArrayList<Object> items = new ArrayList<Object>(); - int contentWidth = mContentWidth - getPaddingLeft() - getPaddingRight() - - layout.getPaddingLeft() - layout.getPaddingRight(); + int contentWidth = mContentWidth - layout.getPaddingLeft() - layout.getPaddingRight(); final int cellWidth = contentWidth / mWidgetCountX; - int contentHeight = mContentHeight - getPaddingTop() - getPaddingBottom() - - layout.getPaddingTop() - layout.getPaddingBottom(); + int contentHeight = mContentHeight - layout.getPaddingTop() - layout.getPaddingBottom(); + final int cellHeight = contentHeight / mWidgetCountY; // Prepare the set of widgets to load previews for in the background |