Remove widget panel
- Remove all usage of LEFT_PANEL_ID and fixed left panel code - For preview renderer, load screen 0 + screen 1 instead - Added a split display specific default workspace layout, with a placeholder app to pass test before we implement page pairing(b/196376162) - Known issue: If screenId 1 is deleted, right panel will disappear from Wallpaepr & Style because there is no screenId 1. Will be resovled after page pairing(b/196376162) Bug: 175939730 Test: manual and TaplTestsLauncher3#testWorkSpace Change-Id: Icac1c94165c14a49c17897c45355b6cdc4d87e91
This commit is contained in:
parent
0cba30e990
commit
1e4484669d
|
@ -25,24 +25,24 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<com.android.launcher3.CellLayout
|
||||
android:id="@+id/workspace_left"
|
||||
android:id="@+id/workspace"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:theme="@style/HomeScreenElementTheme"
|
||||
launcher:containerType="workspace"
|
||||
launcher:layout_constraintStart_toStartOf="parent"
|
||||
launcher:layout_constraintTop_toTopOf="parent"
|
||||
launcher:layout_constraintEnd_toStartOf="@id/workspace"
|
||||
launcher:layout_constraintEnd_toStartOf="@id/workspace_right"
|
||||
launcher:layout_constraintBottom_toBottomOf="parent"
|
||||
launcher:pageIndicator="@+id/page_indicator" />
|
||||
|
||||
<com.android.launcher3.CellLayout
|
||||
android:id="@+id/workspace"
|
||||
android:id="@+id/workspace_right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:theme="@style/HomeScreenElementTheme"
|
||||
launcher:containerType="workspace"
|
||||
launcher:layout_constraintStart_toEndOf="@id/workspace_left"
|
||||
launcher:layout_constraintStart_toEndOf="@id/workspace"
|
||||
launcher:layout_constraintTop_toTopOf="parent"
|
||||
launcher:layout_constraintEnd_toEndOf="parent"
|
||||
launcher:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
|
||||
<attr name="dbFile" format="string" />
|
||||
<attr name="defaultLayoutId" format="reference" />
|
||||
<attr name="defaultSplitDisplayLayoutId" format="reference" />
|
||||
<attr name="demoModeLayoutId" format="reference" />
|
||||
<attr name="isScalable" format="boolean" />
|
||||
<attr name="devicePaddingId" format="reference" />
|
||||
|
|
|
@ -94,4 +94,14 @@
|
|||
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MARKET;end" />
|
||||
<favorite launcher:uri="market://details?id=com.android.launcher" />
|
||||
</resolve>
|
||||
|
||||
<!-- Placeholder before we add page pairing in b/196376162 -->
|
||||
<resolve
|
||||
launcher:screen="1"
|
||||
launcher:x="0"
|
||||
launcher:y="-4" >
|
||||
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_GALLERY;end" />
|
||||
<favorite launcher:uri="#Intent;type=images/*;end" />
|
||||
</resolve>
|
||||
|
||||
</favorites>
|
||||
|
|
|
@ -790,7 +790,7 @@ public class DeviceProfile {
|
|||
Point padding = getTotalWorkspacePadding();
|
||||
// availableWidthPx is the screen width of the device. In 2 panels mode, each panel should
|
||||
// only have half of the screen width. In addition, there is only cellLayoutPadding in the
|
||||
// left side of the left panel and the right side of the right panel. There is no
|
||||
// left side of the left most panel and the right most side of the right panel. There is no
|
||||
// cellLayoutPadding in the middle.
|
||||
int screenWidthPx = isTwoPanels
|
||||
? availableWidthPx / 2 - padding.x - cellLayoutPaddingLeftRightPx
|
||||
|
|
|
@ -653,8 +653,10 @@ public class InvariantDeviceProfile {
|
|||
numColumns = a.getInt(R.styleable.GridDisplayOption_numColumns, 0);
|
||||
|
||||
dbFile = a.getString(R.styleable.GridDisplayOption_dbFile);
|
||||
defaultLayoutId = a.getResourceId(
|
||||
R.styleable.GridDisplayOption_defaultLayoutId, 0);
|
||||
defaultLayoutId = a.getResourceId(isSplitDisplay && a.hasValue(
|
||||
R.styleable.GridDisplayOption_defaultSplitDisplayLayoutId)
|
||||
? R.styleable.GridDisplayOption_defaultSplitDisplayLayoutId
|
||||
: R.styleable.GridDisplayOption_defaultLayoutId, 0);
|
||||
demoModeLayoutId = a.getResourceId(
|
||||
R.styleable.GridDisplayOption_demoModeLayoutId, defaultLayoutId);
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import static com.android.launcher3.LauncherState.NO_OFFSET;
|
|||
import static com.android.launcher3.LauncherState.NO_SCALE;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.WorkspaceLayoutManager.LEFT_PANEL_ID;
|
||||
import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions;
|
||||
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
|
||||
|
@ -2099,19 +2098,12 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
? mWorkspace.getCurrentPageScreenIds() : mPagesToBindSynchronously;
|
||||
IntArray actualIds = new IntArray();
|
||||
|
||||
if (mDeviceProfile.isTwoPanels) {
|
||||
actualIds.add(LEFT_PANEL_ID);
|
||||
} else {
|
||||
visibleIds.remove(LEFT_PANEL_ID);
|
||||
}
|
||||
IntSet result = new IntSet();
|
||||
if (visibleIds.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
for (int id : orderedScreenIds.toArray()) {
|
||||
if (id != LEFT_PANEL_ID) {
|
||||
actualIds.add(id);
|
||||
}
|
||||
actualIds.add(id);
|
||||
}
|
||||
int firstId = visibleIds.getArray().get(0);
|
||||
if (actualIds.contains(firstId)) {
|
||||
|
@ -2119,7 +2111,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
|
||||
if (mDeviceProfile.isTwoPanels) {
|
||||
int index = actualIds.indexOf(firstId);
|
||||
int nextIndex = ((int) (index / 2)) * 2;
|
||||
int nextIndex = (index / 2) * 2;
|
||||
if (nextIndex == index) {
|
||||
nextIndex++;
|
||||
}
|
||||
|
@ -2176,12 +2168,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
|
||||
@Override
|
||||
public void bindScreens(IntArray orderedScreenIds) {
|
||||
// Make sure the first screen is at the start if there's no widget panel,
|
||||
// or on the second place if the first is the widget panel
|
||||
boolean isLeftPanelShown =
|
||||
mWorkspace.mWorkspaceScreens.containsKey(LEFT_PANEL_ID);
|
||||
int firstScreenPosition = isLeftPanelShown && orderedScreenIds.size() > 1 ? 1 : 0;
|
||||
|
||||
int firstScreenPosition = 0;
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN &&
|
||||
orderedScreenIds.indexOf(Workspace.FIRST_SCREEN_ID) != firstScreenPosition) {
|
||||
orderedScreenIds.removeValue(Workspace.FIRST_SCREEN_ID);
|
||||
|
@ -2207,11 +2194,6 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
continue;
|
||||
}
|
||||
|
||||
if (screenId == LEFT_PANEL_ID) {
|
||||
// No need to bind the left panel, as its always bound.
|
||||
continue;
|
||||
}
|
||||
|
||||
mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId);
|
||||
}
|
||||
}
|
||||
|
@ -2287,11 +2269,6 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip if the item is on the left widget panel but the panel is not shown
|
||||
if (item.screenId == LEFT_PANEL_ID && !getDeviceProfile().isTwoPanels) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final View view;
|
||||
switch (item.itemType) {
|
||||
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
|
||||
|
|
|
@ -289,7 +289,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
newPage = Utilities.boundToRange(newPage, 0, getPageCount() - 1);
|
||||
|
||||
if (getPanelCount() > 1) {
|
||||
// Always return left panel as new page
|
||||
// Always return left most panel as new page
|
||||
newPage = getLeftmostVisiblePageForIndex(newPage);
|
||||
}
|
||||
return newPage;
|
||||
|
@ -774,7 +774,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
|
||||
if (panelCount > 1) {
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
// In case we have multiple panels, always use left panel's page scroll for all
|
||||
// In case we have multiple panels, always use left most panel's page scroll for all
|
||||
// panels on the screen.
|
||||
int adjustedScroll = outPageScrolls[getLeftmostVisiblePageForIndex(i)];
|
||||
if (outPageScrolls[i] != adjustedScroll) {
|
||||
|
|
|
@ -550,9 +550,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
|||
if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
|
||||
return;
|
||||
}
|
||||
if (isTwoPanelEnabled()) {
|
||||
insertNewWorkspaceScreen(Workspace.LEFT_PANEL_ID, getChildCount());
|
||||
}
|
||||
|
||||
// Add the first page
|
||||
CellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, getChildCount());
|
||||
|
|
|
@ -32,8 +32,6 @@ public interface WorkspaceLayoutManager {
|
|||
int EXTRA_EMPTY_SCREEN_ID = -201;
|
||||
// The is the first screen. It is always present, even if its empty.
|
||||
int FIRST_SCREEN_ID = 0;
|
||||
// This panel is shown on the first page if the panel count is greater than 1.
|
||||
int LEFT_PANEL_ID = -777;
|
||||
|
||||
/**
|
||||
* At bind time, we use the rank (screenId) to compute x and y for hotseat items.
|
||||
|
|
|
@ -188,8 +188,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
|
|||
private boolean itemSupportsAccessibleDrag(ItemInfo item) {
|
||||
if (item instanceof WorkspaceItemInfo) {
|
||||
// Support the action unless the item is in a context menu.
|
||||
return (item.screenId >= 0 || item.screenId == Workspace.LEFT_PANEL_ID)
|
||||
&& item.container != Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
return item.screenId >= 0 && item.container != Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
}
|
||||
return (item instanceof LauncherAppWidgetInfo)
|
||||
|| (item instanceof FolderInfo);
|
||||
|
|
|
@ -266,22 +266,22 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
|||
mHotseat = mRootView.findViewById(R.id.hotseat);
|
||||
mHotseat.resetLayout(false);
|
||||
|
||||
if (mDp.isTwoPanels) {
|
||||
CellLayout leftPanel = mRootView.findViewById(R.id.workspace_left);
|
||||
leftPanel.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.top,
|
||||
mDp.workspacePadding.right,
|
||||
mDp.workspacePadding.bottom);
|
||||
mWorkspaceScreens.put(LEFT_PANEL_ID, leftPanel);
|
||||
}
|
||||
|
||||
CellLayout firstScreen = mRootView.findViewById(R.id.workspace);
|
||||
firstScreen.setPadding(mDp.workspacePadding.left,
|
||||
firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.top,
|
||||
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.right,
|
||||
mDp.workspacePadding.bottom);
|
||||
mWorkspaceScreens.put(FIRST_SCREEN_ID, firstScreen);
|
||||
|
||||
if (mDp.isTwoPanels) {
|
||||
CellLayout rightPanel = mRootView.findViewById(R.id.workspace_right);
|
||||
rightPanel.setPadding(mDp.workspacePadding.left,
|
||||
mDp.workspacePadding.top,
|
||||
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.bottom);
|
||||
mWorkspaceScreens.put(PreviewSurfaceRenderer.SECOND_SCREEN_ID, rightPanel);
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_S) {
|
||||
WallpaperColors wallpaperColors = wallpaperColorsOverride != null
|
||||
? wallpaperColorsOverride
|
||||
|
|
|
@ -67,6 +67,9 @@ public class PreviewSurfaceRenderer {
|
|||
|
||||
private static final int FADE_IN_ANIMATION_DURATION = 200;
|
||||
|
||||
// The is the second screen. It is always present in two panel, even if its empty.
|
||||
static final int SECOND_SCREEN_ID = 1;
|
||||
|
||||
private static final String KEY_HOST_TOKEN = "host_token";
|
||||
private static final String KEY_VIEW_WIDTH = "width";
|
||||
private static final String KEY_VIEW_HEIGHT = "height";
|
||||
|
@ -164,11 +167,14 @@ public class PreviewSurfaceRenderer {
|
|||
@Override
|
||||
public void run() {
|
||||
DeviceProfile deviceProfile = mIdp.getDeviceProfile(previewContext);
|
||||
String query = (deviceProfile.isTwoPanels ? LauncherSettings.Favorites.SCREEN
|
||||
+ " = " + Workspace.LEFT_PANEL_ID + " or " : "")
|
||||
+ LauncherSettings.Favorites.SCREEN + " = " + Workspace.FIRST_SCREEN_ID
|
||||
String query =
|
||||
LauncherSettings.Favorites.SCREEN + " = " + Workspace.FIRST_SCREEN_ID
|
||||
+ " or " + LauncherSettings.Favorites.CONTAINER + " = "
|
||||
+ LauncherSettings.Favorites.CONTAINER_HOTSEAT;
|
||||
if (deviceProfile.isTwoPanels) {
|
||||
query += " or " + LauncherSettings.Favorites.SCREEN + " = "
|
||||
+ SECOND_SCREEN_ID;
|
||||
}
|
||||
loadWorkspace(new ArrayList<>(), LauncherSettings.Favorites.PREVIEW_CONTENT_URI,
|
||||
query);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID;
|
||||
import static com.android.launcher3.WorkspaceLayoutManager.LEFT_PANEL_ID;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
|
@ -297,7 +296,7 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
|||
|
||||
int screenCount = workspaceScreens.size();
|
||||
// First check the preferred screen.
|
||||
IntSet screensToExclude = IntSet.wrap(LEFT_PANEL_ID);
|
||||
IntSet screensToExclude = new IntSet();
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
|
||||
screensToExclude.add(FIRST_SCREEN_ID);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.android.launcher3.InvariantDeviceProfile;
|
|||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.graphics.LauncherPreviewRenderer;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.pm.InstallSessionHelper;
|
||||
|
@ -214,9 +213,6 @@ public class GridSizeMigrationTaskV2 {
|
|||
// Migrate workspace.
|
||||
// First we create a collection of the screens
|
||||
List<Integer> screens = new ArrayList<>();
|
||||
if (idp.getDeviceProfile(mContext).isTwoPanels) {
|
||||
screens.add(Workspace.LEFT_PANEL_ID);
|
||||
}
|
||||
for (int screenId = 0; screenId <= mDestReader.mLastScreenId; screenId++) {
|
||||
screens.add(screenId);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.WorkspaceLayoutManager.LEFT_PANEL_ID;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED;
|
||||
|
@ -179,11 +178,7 @@ public class LoaderTask implements Runnable {
|
|||
// Screen set is never empty
|
||||
IntArray allScreens = mBgDataModel.collectWorkspaceScreens();
|
||||
final int firstScreen = allScreens.get(0);
|
||||
|
||||
IntSet firstScreens = IntSet.wrap(firstScreen);
|
||||
if (firstScreen == LEFT_PANEL_ID && allScreens.size() >= 2) {
|
||||
firstScreens.add(allScreens.get(1));
|
||||
}
|
||||
|
||||
filterCurrentWorkspaceItems(firstScreens, allItems, firstScreenItems,
|
||||
new ArrayList<>() /* otherScreenItems are ignored */);
|
||||
|
|
Loading…
Reference in New Issue