use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by ProtonAOSP.
the class Folder method updateItemLocationsInDatabaseBatch.
private void updateItemLocationsInDatabaseBatch(boolean isBind) {
FolderGridOrganizer verifier = new FolderGridOrganizer(mActivityContext.getDeviceProfile().inv).setFolderInfo(mInfo);
ArrayList<ItemInfo> items = new ArrayList<>();
int total = mInfo.contents.size();
for (int i = 0; i < total; i++) {
WorkspaceItemInfo itemInfo = mInfo.contents.get(i);
if (verifier.updateRankAndPos(itemInfo, i)) {
items.add(itemInfo);
}
}
if (!items.isEmpty()) {
mLauncherDelegate.getModelWriter().moveItemsInDatabase(items, mInfo.id, 0);
}
if (FeatureFlags.FOLDER_NAME_SUGGEST.get() && !isBind && total > 1) /* no need to update if there's one icon */
{
Executors.MODEL_EXECUTOR.post(() -> {
FolderNameInfos nameInfos = new FolderNameInfos();
FolderNameProvider fnp = FolderNameProvider.newInstance(getContext());
fnp.getSuggestedFolderName(getContext(), mInfo.contents, nameInfos);
mInfo.suggestedFolderNames = nameInfos;
});
}
}
use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by AOSPA.
the class Folder method updateItemLocationsInDatabaseBatch.
private void updateItemLocationsInDatabaseBatch(boolean isBind) {
FolderGridOrganizer verifier = new FolderGridOrganizer(mActivityContext.getDeviceProfile().inv).setFolderInfo(mInfo);
ArrayList<ItemInfo> items = new ArrayList<>();
int total = mInfo.contents.size();
for (int i = 0; i < total; i++) {
WorkspaceItemInfo itemInfo = mInfo.contents.get(i);
if (verifier.updateRankAndPos(itemInfo, i)) {
items.add(itemInfo);
}
}
if (!items.isEmpty()) {
mLauncherDelegate.getModelWriter().moveItemsInDatabase(items, mInfo.id, 0);
}
if (FeatureFlags.FOLDER_NAME_SUGGEST.get() && !isBind && total > 1) /* no need to update if there's one icon */
{
Executors.MODEL_EXECUTOR.post(() -> {
FolderNameInfos nameInfos = new FolderNameInfos();
FolderNameProvider fnp = FolderNameProvider.newInstance(getContext());
fnp.getSuggestedFolderName(getContext(), mInfo.contents, nameInfos);
mInfo.suggestedFolderNames = nameInfos;
});
}
}
Aggregations