use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_404Launcher by P-404.
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 crdroidandroid.
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_Trebuchet by LineageOS.
the class Folder method updateItemLocationsInDatabaseBatch.
private void updateItemLocationsInDatabaseBatch(boolean isBind) {
FolderGridOrganizer verifier = new FolderGridOrganizer(mLauncher.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()) {
mLauncher.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_Trebuchet by LineageOS.
the class LoaderTask method loadFolderNames.
private void loadFolderNames() {
FolderNameProvider provider = FolderNameProvider.newInstance(mApp.getContext(), mBgAllAppsList.data, mBgDataModel.folders);
synchronized (mBgDataModel) {
for (int i = 0; i < mBgDataModel.folders.size(); i++) {
FolderNameInfos suggestionInfos = new FolderNameInfos();
FolderInfo info = mBgDataModel.folders.valueAt(i);
if (info.suggestedFolderNames == null) {
provider.getSuggestedFolderName(mApp.getContext(), info.contents, suggestionInfos);
info.suggestedFolderNames = suggestionInfos;
}
}
}
}
use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by ArrowOS.
the class LoaderTask method loadFolderNames.
private void loadFolderNames() {
FolderNameProvider provider = FolderNameProvider.newInstance(mApp.getContext(), mBgAllAppsList.data, mBgDataModel.folders);
synchronized (mBgDataModel) {
for (int i = 0; i < mBgDataModel.folders.size(); i++) {
FolderNameInfos suggestionInfos = new FolderNameInfos();
FolderInfo info = mBgDataModel.folders.valueAt(i);
if (info.suggestedFolderNames == null) {
provider.getSuggestedFolderName(mApp.getContext(), info.contents, suggestionInfos);
info.suggestedFolderNames = suggestionInfos;
}
}
}
}
Aggregations