mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Only add widgets system shortcut if widgets exist
Before we were adding it in a disabled state, and then enabling it once widgets were bound (if widgets existed for that app). Now we load all widgets when launcher starts so that we can use the values for the purpose of animating the popup container. Then, as the container opens, we reload widgets/shortcuts for that particular app and add/remove the widgets shortcut if necessary. Bug: 34940468 Change-Id: I64bd009442d10d3d1f9a977bdedfdb639a7dd193
This commit is contained in:
@@ -44,6 +44,7 @@ import com.android.launcher3.graphics.LauncherIcons;
|
||||
import com.android.launcher3.util.FlagOp;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.ManagedProfileHeuristic;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -370,6 +371,14 @@ public class PackageUpdatedTask extends ExtendedModelTask {
|
||||
callbacks.notifyWidgetProvidersChanged();
|
||||
}
|
||||
});
|
||||
} else if (Utilities.isAtLeastO() && mOp == OP_ADD) {
|
||||
// Load widgets for the new package.
|
||||
for (int i = 0; i < N; i++) {
|
||||
LauncherModel model = app.getModel();
|
||||
model.refreshAndBindWidgetsAndShortcuts(
|
||||
model.getCallback(), false /* bindFirst */,
|
||||
new PackageUserKey(packages[i], mUser) /* packageUser */);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user