Setting content bounds in onMeasure as it uses measuredWidth, which might

not be available during onCreate

Also fixing the calculation of allApps column could, which was counting an
additional icon gap

Bug: 27173894
Change-Id: I8be8cccc76d7e7d945cf9383567a3026228b6c86
This commit is contained in:
Sunny Goyal
2016-02-16 14:56:33 -08:00
parent 187b8f547d
commit 94f46d9e5f
3 changed files with 9 additions and 7 deletions

View File

@@ -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.