Search in sources :

Example 1 with FolderNameProvider

use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by crdroidandroid.

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;
            }
        }
    }
}
Also used : FolderNameInfos(com.android.launcher3.folder.FolderNameInfos) FolderNameProvider(com.android.launcher3.folder.FolderNameProvider) FolderInfo(com.android.launcher3.model.data.FolderInfo) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 2 with FolderNameProvider

use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by AOSPA.

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;
            }
        }
    }
}
Also used : FolderNameInfos(com.android.launcher3.folder.FolderNameInfos) FolderNameProvider(com.android.launcher3.folder.FolderNameProvider) FolderInfo(com.android.launcher3.model.data.FolderInfo) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 3 with FolderNameProvider

use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by ArrowOS.

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;
        });
    }
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo)

Example 4 with FolderNameProvider

use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_Launcher3 by ProtonAOSP.

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;
            }
        }
    }
}
Also used : FolderNameInfos(com.android.launcher3.folder.FolderNameInfos) FolderNameProvider(com.android.launcher3.folder.FolderNameProvider) FolderInfo(com.android.launcher3.model.data.FolderInfo) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 5 with FolderNameProvider

use of com.android.launcher3.folder.FolderNameProvider in project android_packages_apps_404Launcher by P-404.

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;
            }
        }
    }
}
Also used : FolderNameInfos(com.android.launcher3.folder.FolderNameInfos) FolderNameProvider(com.android.launcher3.folder.FolderNameProvider) FolderInfo(com.android.launcher3.model.data.FolderInfo) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

SuppressLint (android.annotation.SuppressLint)11 FolderNameInfos (com.android.launcher3.folder.FolderNameInfos)6 FolderNameProvider (com.android.launcher3.folder.FolderNameProvider)6 FolderInfo (com.android.launcher3.model.data.FolderInfo)6 ItemInfo (com.android.launcher3.model.data.ItemInfo)6 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)6 ArrayList (java.util.ArrayList)6 Point (android.graphics.Point)5