mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Fix LauncherProvider newScreenId issue
Remove maxScreenId from LauncherProvider and whenever we need a new screenId, query the database to calculate a new screenId. Also converted and refactored AddWorkspaceItemsTaskTest and added some extra test cases. Test: manual & AddWorkspaceItemsTaskTest.kt Bug: 199160559 Change-Id: I185f6823fed171d778af0130497f5ffaf89c0a70
This commit is contained in:
@@ -869,13 +869,13 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
mWorkspaceScreens.remove(emptyScreenId);
|
||||
mScreenOrder.removeValue(emptyScreenId);
|
||||
|
||||
int newScreenId = -1;
|
||||
int newScreenId = LauncherSettings.Settings.call(getContext().getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_NEW_SCREEN_ID)
|
||||
.getInt(LauncherSettings.Settings.EXTRA_VALUE);
|
||||
// Launcher database isn't aware of empty pages that are already bound, so we need to
|
||||
// skip those IDs manually.
|
||||
while (newScreenId == -1 || mWorkspaceScreens.containsKey(newScreenId)) {
|
||||
newScreenId = LauncherSettings.Settings.call(getContext().getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_NEW_SCREEN_ID)
|
||||
.getInt(LauncherSettings.Settings.EXTRA_VALUE);
|
||||
while (mWorkspaceScreens.containsKey(newScreenId)) {
|
||||
newScreenId++;
|
||||
}
|
||||
|
||||
mWorkspaceScreens.put(newScreenId, cl);
|
||||
|
||||
Reference in New Issue
Block a user