Bring back allapps bulk icon loading make it toggleable (#3874)
This commit is contained in:
@@ -326,6 +326,9 @@
|
||||
<string name="show_enable_smart_hide">Show when Full Name is Typed</string>
|
||||
<string name="hide_hidden_apps_search">Hide in Search Results</string>
|
||||
|
||||
<string name="pref_all_apps_bulk_icon_loading_title">Bulk loading</string>
|
||||
<string name="pref_all_apps_bulk_icon_loading_description">Enable loading all apps icons in bulk</string>
|
||||
|
||||
<string name="pref_category_search">Search</string>
|
||||
<string name="show_app_search_bar">Show Search Bar</string>
|
||||
<string name="pref_search_auto_show_keyboard">Automatically Show Keyboard</string>
|
||||
|
||||
@@ -84,6 +84,8 @@ class PreferenceManager private constructor(private val context: Context) : Base
|
||||
val searchResultSettingsEntry = BoolPref("pref_searchResultSettingsEntry", false, recreate)
|
||||
val searchResulRecentSuggestion = BoolPref("pref_searchResultRecentSuggestion", false, recreate)
|
||||
|
||||
val allAppBulkIconLoading = BoolPref("pref_allapps_bulk_icon_loading", false, recreate)
|
||||
|
||||
val themedIcons = BoolPref("themed_icons", true, recreate)
|
||||
val drawerThemedIcons = BoolPref("drawer_themed_icons", false, recreate)
|
||||
val hotseatQsbCornerRadius = FloatPref("pref_hotseatQsbCornerRadius", 1F, recreate)
|
||||
|
||||
@@ -66,6 +66,11 @@ fun AppDrawerPreferences() {
|
||||
valueRange = 0F..1F,
|
||||
showAsPercentage = true,
|
||||
)
|
||||
SwitchPreference(
|
||||
label = stringResource(id = R.string.pref_all_apps_bulk_icon_loading_title),
|
||||
description = stringResource(id = R.string.pref_all_apps_bulk_icon_loading_description),
|
||||
adapter = prefs.allAppBulkIconLoading.getAdapter(),
|
||||
)
|
||||
SuggestionsPreference()
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
import app.lawnchair.LawnchairAppKt;
|
||||
import app.lawnchair.preferences.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Runnable for the thread that loads the contents of the launcher:
|
||||
@@ -939,6 +940,9 @@ public class LoaderTask implements Runnable {
|
||||
// Clear the list of apps
|
||||
mBgAllAppsList.clear();
|
||||
|
||||
var pref = PreferenceManager.getInstance(mApp.getContext());
|
||||
var enableBulkLoading = pref.getAllAppBulkIconLoading().get();
|
||||
|
||||
List<IconRequestInfo<AppInfo>> iconRequestInfos = new ArrayList<>();
|
||||
for (UserHandle user : profiles) {
|
||||
// Query for the set of apps
|
||||
@@ -957,7 +961,7 @@ public class LoaderTask implements Runnable {
|
||||
iconRequestInfos.add(new IconRequestInfo<>(
|
||||
appInfo, app, /* useLowResIcon= */ false));
|
||||
mBgAllAppsList.add(
|
||||
appInfo, app, false);
|
||||
appInfo, app, !enableBulkLoading);
|
||||
}
|
||||
allActivityList.addAll(apps);
|
||||
}
|
||||
@@ -968,7 +972,7 @@ public class LoaderTask implements Runnable {
|
||||
AppInfo promiseAppInfo = mBgAllAppsList.addPromiseApp(
|
||||
mApp.getContext(),
|
||||
PackageInstallInfo.fromInstallingState(info),
|
||||
false);
|
||||
!enableBulkLoading);
|
||||
|
||||
if (promiseAppInfo != null) {
|
||||
iconRequestInfos.add(new IconRequestInfo<>(
|
||||
@@ -979,12 +983,14 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
Trace.beginSection("LoadAllAppsIconsInBulk");
|
||||
try {
|
||||
mIconCache.getTitlesAndIconsInBulk(iconRequestInfos);
|
||||
iconRequestInfos.forEach(iconRequestInfo -> mBgAllAppsList.updateSectionName(iconRequestInfo.itemInfo));
|
||||
} finally {
|
||||
Trace.endSection();
|
||||
if (enableBulkLoading) {
|
||||
Trace.beginSection("LoadAllAppsIconsInBulk");
|
||||
try {
|
||||
mIconCache.getTitlesAndIconsInBulk(iconRequestInfos);
|
||||
iconRequestInfos.forEach(iconRequestInfo -> mBgAllAppsList.updateSectionName(iconRequestInfo.itemInfo));
|
||||
} finally {
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
mBgAllAppsList.setFlags(FLAG_QUIET_MODE_ENABLED,
|
||||
|
||||
Reference in New Issue
Block a user