mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Converting ModelTask to an interface instead of an abstract class
This allows extensibility and better use of lambdas Bug: 338282246 Test: Presubmit Flag: None Change-Id: Ia41067f0068b3b631eeb4faf877dc77f8587e1f6
This commit is contained in:
@@ -24,6 +24,7 @@ import android.os.UserHandle;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherModel.ModelUpdateTask;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
@@ -40,7 +41,7 @@ import java.util.Iterator;
|
||||
/**
|
||||
* Task to handle changing of lock state of the user
|
||||
*/
|
||||
public class UserLockStateChangedTask extends BaseModelUpdateTask {
|
||||
public class UserLockStateChangedTask implements ModelUpdateTask {
|
||||
|
||||
@NonNull
|
||||
private final UserHandle mUser;
|
||||
@@ -52,8 +53,9 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(@NonNull final LauncherAppState app, @NonNull final BgDataModel dataModel,
|
||||
@NonNull final AllAppsList apps) {
|
||||
public void execute(@NonNull ModelTaskController taskController, @NonNull BgDataModel dataModel,
|
||||
@NonNull AllAppsList apps) {
|
||||
LauncherAppState app = taskController.getApp();
|
||||
Context context = app.getContext();
|
||||
|
||||
HashMap<ShortcutKey, ShortcutInfo> pinnedShortcuts = new HashMap<>();
|
||||
@@ -98,9 +100,10 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
|
||||
}
|
||||
});
|
||||
}
|
||||
bindUpdatedWorkspaceItems(updatedWorkspaceItemInfos);
|
||||
taskController.bindUpdatedWorkspaceItems(updatedWorkspaceItemInfos);
|
||||
if (!removedKeys.isEmpty()) {
|
||||
deleteAndBindComponentsRemoved(ItemInfoMatcher.ofShortcutKeys(removedKeys),
|
||||
taskController.deleteAndBindComponentsRemoved(
|
||||
ItemInfoMatcher.ofShortcutKeys(removedKeys),
|
||||
"removed during unlock because it's no longer available"
|
||||
+ " (possibly due to clear data)");
|
||||
}
|
||||
@@ -118,6 +121,6 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
|
||||
null, mUser,
|
||||
new ShortcutRequest(context, mUser).query(ShortcutRequest.ALL));
|
||||
}
|
||||
bindDeepShortcuts(dataModel);
|
||||
taskController.bindDeepShortcuts(dataModel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user