summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FolderPagedView.java
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-05-10 13:36:09 -0700
committerEd Carrigan <cretin45@gmail.com>2016-05-10 14:55:22 -0700
commit70e60db0360adb5dcd4250c804572c41fa669e9c (patch)
tree781c001424479b754a3a99cc31368f19d6637016 /src/com/android/launcher3/FolderPagedView.java
parent019b74b566d0589ada06a3ea6b6b11be829c106a (diff)
downloadandroid_packages_apps_Trebuchet-70e60db0360adb5dcd4250c804572c41fa669e9c.tar.gz
android_packages_apps_Trebuchet-70e60db0360adb5dcd4250c804572c41fa669e9c.tar.bz2
android_packages_apps_Trebuchet-70e60db0360adb5dcd4250c804572c41fa669e9c.zip
Trebuchet: Index folder contents screen and cells on first load
Issue-id: CYNGNOS-2755 Change-Id: I260d1b098e7759a0134bc40f892b8783452c9528 (cherry picked from commit 499902463bb16aad036a57b9e02b34cb74548acf)
Diffstat (limited to 'src/com/android/launcher3/FolderPagedView.java')
-rw-r--r--src/com/android/launcher3/FolderPagedView.java32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 5d5ac3d5a..9134dc93e 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -18,6 +18,7 @@ package com.android.launcher3;
import android.annotation.SuppressLint;
import android.content.Context;
+import android.graphics.Point;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
@@ -116,34 +117,9 @@ public class FolderPagedView extends PagedView {
*/
public void setupContentDimensions(int count) {
mAllocatedContentSize = count;
- boolean done;
- if (count >= mMaxItemsPerPage) {
- mGridCountX = mMaxCountX;
- mGridCountY = mMaxCountY;
- done = true;
- } else {
- done = false;
- }
-
- while (!done) {
- int oldCountX = mGridCountX;
- int oldCountY = mGridCountY;
- if (mGridCountX * mGridCountY < count) {
- // Current grid is too small, expand it
- if ((mGridCountX <= mGridCountY || mGridCountY == mMaxCountY) && mGridCountX < mMaxCountX) {
- mGridCountX++;
- } else if (mGridCountY < mMaxCountY) {
- mGridCountY++;
- }
- if (mGridCountY == 0) mGridCountY++;
- } else if ((mGridCountY - 1) * mGridCountX >= count && mGridCountY >= mGridCountX) {
- mGridCountY = Math.max(0, mGridCountY - 1);
- } else if ((mGridCountX - 1) * mGridCountY >= count) {
- mGridCountX = Math.max(0, mGridCountX - 1);
- }
- done = mGridCountX == oldCountX && mGridCountY == oldCountY;
- }
-
+ Point point = Utilities.caluclateFolderContentDimensions(count, mMaxCountX, mMaxCountY);
+ mGridCountX = point.x;
+ mGridCountY = point.y;
// Update grid size
for (int i = getPageCount() - 1; i >= 0; i--) {
getPageAt(i).setGridSize(mGridCountX, mGridCountY);