mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Fix SUW unstash animation.
- Defer any UI updates to taskbar after the SUW unstash animation is created. - Predicted app icons take longer to load, so it's possible that they are added after the animation is created. - This avoids the case where icons are seemingly in the taskbar but do not get animated like the rest of the icons. - We also need to call onAnimationStart for the reveal animation immediately, otherwise the clipToOutline params never get set. Bug: 277712185 Test: flash device, very quickly go through SUW Change-Id: I4c3089da0d20bf91672e2305655c4c37b1f367aa
This commit is contained in:
@@ -54,6 +54,10 @@ public class TaskbarModelCallbacks implements
|
||||
// Initialized in init.
|
||||
private TaskbarControllers mControllers;
|
||||
|
||||
// Used to defer any UI updates during the SUW unstash animation.
|
||||
private boolean mDeferUpdatesForSUW;
|
||||
private Runnable mDeferredUpdates;
|
||||
|
||||
public TaskbarModelCallbacks(
|
||||
TaskbarActivityContext context, TaskbarView container) {
|
||||
mContext = context;
|
||||
@@ -194,10 +198,38 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
hotseatItemInfos = mControllers.taskbarRecentAppsController
|
||||
.updateHotseatItemInfos(hotseatItemInfos);
|
||||
|
||||
if (mDeferUpdatesForSUW) {
|
||||
ItemInfo[] finalHotseatItemInfos = hotseatItemInfos;
|
||||
mDeferredUpdates = () -> {
|
||||
updateHotseatItemsAndBackground(finalHotseatItemInfos);
|
||||
};
|
||||
} else {
|
||||
updateHotseatItemsAndBackground(hotseatItemInfos);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHotseatItemsAndBackground(ItemInfo[] hotseatItemInfos) {
|
||||
mContainer.updateHotseatItems(hotseatItemInfos);
|
||||
mControllers.taskbarViewController.updateIconsBackground();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to defer UI updates after SUW builds the unstash animation.
|
||||
* @param defer if true, defers updates to the UI
|
||||
* if false, posts updates (if any) to the UI
|
||||
*/
|
||||
public void setDeferUpdatesForSUW(boolean defer) {
|
||||
mDeferUpdatesForSUW = defer;
|
||||
|
||||
if (!mDeferUpdatesForSUW) {
|
||||
if (mDeferredUpdates != null) {
|
||||
mContainer.post(mDeferredUpdates);
|
||||
mDeferredUpdates = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRunningTasksChanged() {
|
||||
updateRunningApps();
|
||||
@@ -232,5 +264,7 @@ public class TaskbarModelCallbacks implements
|
||||
pw.println(
|
||||
String.format("%s\tpredicted items count=%s", prefix, mPredictedItems.size()));
|
||||
}
|
||||
pw.println(String.format("%s\tmDeferUpdatesForSUW=%b", prefix, mDeferUpdatesForSUW));
|
||||
pw.println(String.format("%s\tupdates pending=%b", prefix, (mDeferredUpdates != null)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user