Setting min width of content in customize tray automatically
Change-Id: Idb307dcf21422472ef098702c1bc12e99f138228
This commit is contained in:
@@ -27,8 +27,6 @@
|
||||
|
||||
<dimen name="customization_drawer_height">480dp</dimen>
|
||||
<dimen name="customization_drawer_content_height">420dp</dimen>
|
||||
<dimen name="customization_drawer_content_min_width">952dp</dimen>
|
||||
<dimen name="customization_drawer_tab_widget_width">952dp</dimen>
|
||||
|
||||
<integer name="all_apps_view_cellCountX">7</integer>
|
||||
<integer name="all_apps_view_cellCountY">5</integer>
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
<dimen name="customization_drawer_height">800dp</dimen>
|
||||
<dimen name="customization_drawer_content_height">420dp</dimen>
|
||||
<dimen name="customization_drawer_content_min_width">640dp</dimen>
|
||||
<dimen name="customization_drawer_tab_widget_width">700dp</dimen>
|
||||
|
||||
<integer name="all_apps_view_cellCountX">5</integer>
|
||||
<integer name="all_apps_view_cellCountY">7</integer>
|
||||
|
||||
@@ -172,12 +172,12 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
|
||||
final Resources r = context.getResources();
|
||||
setDragSlopeThreshold(
|
||||
r.getInteger(R.integer.config_customizationDrawerDragSlopeThreshold) / 100.0f);
|
||||
mMinPageWidth = r.getDimensionPixelSize(R.dimen.customization_drawer_content_min_width);
|
||||
|
||||
// Create a dummy page and set it up to find out the content width (used by our parent)
|
||||
PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
|
||||
setupPage(layout);
|
||||
mPageContentWidth = layout.getContentWidth();
|
||||
mMinPageWidth = layout.getWidthBeforeFirstLayout();
|
||||
|
||||
setVisibility(View.GONE);
|
||||
setSoundEffectsEnabled(false);
|
||||
|
||||
@@ -247,9 +247,12 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
|
||||
// Return the distance from the left edge of the content of the leftmost icon to
|
||||
// the right edge of the content of the rightmost icon
|
||||
|
||||
// icons are centered within cells, find out how much offset that accounts for
|
||||
int iconHorizontalOffset = (mCellWidth - Utilities.getIconContentSize());
|
||||
return mCellCountX * mCellWidth + (mCellCountX - 1) * mWidthGap - iconHorizontalOffset;
|
||||
// icons are centered within cells, find out how much padding that accounts for
|
||||
return getWidthBeforeFirstLayout() - (mCellWidth - Utilities.getIconContentSize());
|
||||
}
|
||||
|
||||
int getWidthBeforeFirstLayout() {
|
||||
return mCellCountX * mCellWidth + (mCellCountX - 1) * mWidthGap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user