Improve Hybird hotseat cache support
Loads list of cached apps and shows predicted app icons with the rest of workspace items. -> Extracted prediction caching logic into a model layer Bug: 155029837 Test: Manual Change-Id: I6981594a910f5fe4e8e8cf8fe39db0cb856e7acd
This commit is contained in:
1 parent
43e789ff9b
commit
385e93249e
10 files changed
+211
-35
No files matched your search
@@ -17,6 +17,7 @@
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
|
||||
import static com.android.launcher3.model.ModelUtils.getMissingHotseatRanks;
|
||||
import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially;
|
||||
|
||||
import android.util.Log;
|
||||
@@ -196,6 +197,10 @@ public abstract class BaseLoaderResults {
|
||||
// Load items on the current page.
|
||||
bindWorkspaceItems(currentWorkspaceItems, mainExecutor);
|
||||
bindAppWidgets(currentAppWidgets, mainExecutor);
|
||||
|
||||
// Locate available spots for prediction using currentWorkspaceItems
|
||||
IntArray gaps = getMissingHotseatRanks(currentWorkspaceItems, idp.numHotseatIcons);
|
||||
bindPredictedItems(gaps, mainExecutor);
|
||||
// In case of validFirstPage, only bind the first screen, and defer binding the
|
||||
// remaining screens after first onDraw (and an optional the fade animation whichever
|
||||
// happens later).
|
||||
@@ -247,6 +252,11 @@ public abstract class BaseLoaderResults {
|
||||
}
|
||||
}
|
||||
|
||||
private void bindPredictedItems(IntArray ranks, final Executor executor) {
|
||||
executeCallbacksTask(
|
||||
c -> c.bindPredictedItems(mBgDataModel.cachedPredictedItems, ranks), executor);
|
||||
}
|
||||
|
||||
protected void executeCallbacksTask(CallbackTask task, Executor executor) {
|
||||
executor.execute(() -> {
|
||||
if (mMyBindingId != mBgDataModel.lastBindId) {
|
||||
|
||||
Reference in new issue
Block a user