Add two extra empty pages on two panel launcher home

Add a new screen ID for the second extra empty page
and add that new screen as well when the existing
extra empty page is added so that users can put items
on both sides of Workspace.

Test: manual
Bug: 196376162
Change-Id: I0b4f2e818407a10d8a7c032788a7bd7a61267779
This commit is contained in:
Andras Kloczl
2021-08-28 00:59:08 +01:00
parent 667bda8448
commit 408a54f2e7
7 changed files with 210 additions and 74 deletions

View File

@@ -23,6 +23,7 @@ import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.IntSet;
public interface WorkspaceLayoutManager {
@@ -30,6 +31,12 @@ public interface WorkspaceLayoutManager {
// The screen id used for the empty screen always present at the end.
int EXTRA_EMPTY_SCREEN_ID = -201;
// The screen id used for the second empty screen always present at the end for two panel home.
int EXTRA_EMPTY_SCREEN_SECOND_ID = -200;
// The screen ids used for the empty screens at the end of the workspaces.
IntSet EXTRA_EMPTY_SCREEN_IDS =
IntSet.wrap(EXTRA_EMPTY_SCREEN_ID, EXTRA_EMPTY_SCREEN_SECOND_ID);
// The is the first screen. It is always present, even if its empty.
int FIRST_SCREEN_ID = 0;
// This is the second page. On two panel home it is always present, even if its empty.
@@ -81,9 +88,9 @@ public interface WorkspaceLayoutManager {
return;
}
}
if (screenId == EXTRA_EMPTY_SCREEN_ID) {
if (EXTRA_EMPTY_SCREEN_IDS.contains(screenId)) {
// This should never happen
throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID");
throw new RuntimeException("Screen id should not be extra empty screen: " + screenId);
}
final CellLayout layout;