mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Adding support for requesting addition of shortcut/widget
on the workspace. Bug: 33584624 Change-Id: I664366822fe8088742faff2cce006239ab0771bc
This commit is contained in:
@@ -70,7 +70,8 @@ public class AddWorkspaceItemsTask extends ExtendedModelTask {
|
||||
ArrayList<Long> workspaceScreens = LauncherModel.loadWorkspaceScreensDb(context);
|
||||
synchronized(dataModel) {
|
||||
for (ItemInfo item : workspaceApps) {
|
||||
if (item instanceof ShortcutInfo) {
|
||||
if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
|
||||
item.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
|
||||
// Short-circuit this logic if the icon exists somewhere on the workspace
|
||||
if (shortcutExists(dataModel, item.getIntent(), item.user)) {
|
||||
continue;
|
||||
@@ -143,6 +144,10 @@ public class AddWorkspaceItemsTask extends ExtendedModelTask {
|
||||
*/
|
||||
protected boolean shortcutExists(BgDataModel dataModel, Intent intent, UserHandle user) {
|
||||
final String intentWithPkg, intentWithoutPkg;
|
||||
if (intent == null) {
|
||||
// Skip items with null intents
|
||||
return true;
|
||||
}
|
||||
if (intent.getComponent() != null) {
|
||||
// If component is not null, an intent with null package will produce
|
||||
// the same result and should also be a match.
|
||||
|
||||
Reference in New Issue
Block a user