diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-02-17 02:03:05 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-02-17 02:03:05 +0000 |
commit | 775d4c9ac0544c8ba95e9a7817bccc0c63508bcd (patch) | |
tree | 6125bb24684e8f18e8abb778be38c0147b407a6a /src | |
parent | fce9c411ac7fecc5c97fb3e807cf3014bccf7573 (diff) | |
parent | 5df98da8fd2c1997bd6c09a4772f018730345090 (diff) | |
download | android_packages_apps_Trebuchet-775d4c9ac0544c8ba95e9a7817bccc0c63508bcd.tar.gz android_packages_apps_Trebuchet-775d4c9ac0544c8ba95e9a7817bccc0c63508bcd.tar.bz2 android_packages_apps_Trebuchet-775d4c9ac0544c8ba95e9a7817bccc0c63508bcd.zip |
Merge "Setting content bounds in onMeasure as it uses measuredWidth, which might not be available during onCreate" into ub-launcher3-burnaby-polish
am: 5df98da8fd
* commit '5df98da8fd2c1997bd6c09a4772f018730345090':
Setting content bounds in onMeasure as it uses measuredWidth, which might not be available during onCreate
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/BaseContainerView.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 7 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java index 5766e80f7..5ba41ad3f 100644 --- a/src/com/android/launcher3/BaseContainerView.java +++ b/src/com/android/launcher3/BaseContainerView.java @@ -40,10 +40,8 @@ public abstract class BaseContainerView extends FrameLayout implements Insettabl // The bounds of the search bar. Only the left, top, right are used to inset the // search bar and the height is determined by the measurement of the layout private final Rect mFixedSearchBarBounds = new Rect(); - // The computed bounds of the container - protected final Rect mContentBounds = new Rect(); // The computed padding to apply to the container to achieve the container bounds - private final Rect mContentPadding = new Rect(); + protected final Rect mContentPadding = new Rect(); // The inset to apply to the edges and between the search bar and the container private final int mContainerBoundsInset; @@ -128,9 +126,6 @@ public abstract class BaseContainerView extends FrameLayout implements Insettabl // The container padding changed, notify the container. if (!padding.equals(mContentPadding)) { mContentPadding.set(padding); - mContentBounds.set(padding.left, padding.top, - getMeasuredWidth() - padding.right, - getMeasuredHeight() - padding.bottom); onUpdateBackgroundAndPaddings(padding); } } diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index cd5823084..b67e07b33 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -273,7 +273,7 @@ public class DeviceProfile { int allAppsCellWidthGap = res.getDimensionPixelSize(R.dimen.all_apps_icon_width_gap); int availableAppsWidthPx = (recyclerViewWidth > 0) ? recyclerViewWidth : availableWidthPx; - int numAppsCols = (availableAppsWidthPx - appsViewLeftMarginPx) / + int numAppsCols = (availableAppsWidthPx + allAppsCellWidthGap - appsViewLeftMarginPx) / (allAppsIconSizePx + allAppsCellWidthGap); int numPredictiveAppCols = Math.max(inv.minAllAppsPredictionColumns, numAppsCols); allAppsNumCols = numAppsCols; diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 63c03e564..1cb08b931 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -138,6 +138,9 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc private final RecyclerView.LayoutManager mLayoutManager; private final RecyclerView.ItemDecoration mItemDecoration; + // The computed bounds of the container + private final Rect mContentBounds = new Rect(); + private AllAppsRecyclerView mAppsRecyclerView; private AllAppsSearchBarController mSearchBarController; @@ -318,6 +321,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + mContentBounds.set(mContentPadding.left, mContentPadding.top, + MeasureSpec.getSize(widthMeasureSpec) - mContentPadding.right, + MeasureSpec.getSize(heightMeasureSpec) - mContentPadding.bottom); + // Update the number of items in the grid before we measure the view // TODO: mSectionNamesMargin is currently 0, but also account for it, // if it's enabled in the future. |