Refactoring some folder binding logic:

> Moving grid calcutation in a separate class
> Moving content saving logic to folder instead of relying on item bind

Bug: 139051851
Change-Id: I81b226dbebe13652482a767c992e8cc8f4f35a60
This commit is contained in:
Sunny Goyal
2019-08-07 09:24:26 -07:00
parent 3cc153813a
commit 11a50747ed
13 changed files with 356 additions and 344 deletions

View File

@@ -57,7 +57,7 @@ import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIconPreviewVerifier;
import com.android.launcher3.folder.FolderGridOrganizer;
import com.android.launcher3.icons.ComponentWithLabel;
import com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic;
import com.android.launcher3.icons.IconCache;
@@ -744,8 +744,8 @@ public class LoaderTask implements Runnable {
}
// Sort the folder items, update ranks, and make sure all preview items are high res.
FolderIconPreviewVerifier verifier =
new FolderIconPreviewVerifier(mApp.getInvariantDeviceProfile());
FolderGridOrganizer verifier =
new FolderGridOrganizer(mApp.getInvariantDeviceProfile());
for (FolderInfo folder : mBgDataModel.folders) {
Collections.sort(folder.contents, Folder.ITEM_POS_COMPARATOR);
verifier.setFolderInfo(folder);