diff options
Diffstat (limited to 'src/com/android/launcher2/AllAppsPagedView.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsPagedView.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index b4eaa4949..01cf9202f 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -70,6 +70,8 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All private int mLastMeasureWidth = -1; private int mLastMeasureHeight = -1; + private int mMaxCellCountY; + public AllAppsPagedView(Context context) { this(context, null); } @@ -87,7 +89,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All a.recycle(); setSoundEffectsEnabled(false); - Resources r = context.getResources(); + final Resources r = context.getResources(); setDragSlopeThreshold( r.getInteger(R.integer.config_allAppsDrawerDragSlopeThreshold) / 100.0f); @@ -95,6 +97,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All PagedViewCellLayout layout = new PagedViewCellLayout(getContext()); setupPage(layout); mPageContentWidth = layout.getContentWidth(); + mMaxCellCountY = r.getInteger(R.integer.all_apps_view_maxCellCountY); } @Override @@ -174,7 +177,19 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All availableHeight -= mPageLayoutPaddingTop + mPageLayoutPaddingBottom; availableHeight -= cellHeight; // Assume at least one row availableHeight -= screenHeight * 0.16f; - return (1 + availableHeight / (cellHeight + mPageLayoutHeightGap)); + if (availableHeight > 0) { + return Math.min(mMaxCellCountY, + 1 + availableHeight / (cellHeight + mPageLayoutHeightGap)); + } + return 0; + } + + int getCellCountX() { + return mCellCountX; + } + + int getCellCountY() { + return mCellCountY; } void allowHardwareLayerCreation() { |