Merge "Add smartspace removal option as a toggle" into main
This commit is contained in:
commit
0bd2c4ea75
10 files changed
+92
-25
No files matched your search
@@ -28,6 +28,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.BuildConfig.APPLICATION_ID;
|
||||
import static com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WIDGET_TRANSITION;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
|
||||
@@ -44,7 +45,7 @@ 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.FIRST_SCREEN_ID;
|
||||
import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
@@ -426,6 +427,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
private BaseSearchConfig mBaseSearchConfig;
|
||||
private StartupLatencyLogger mStartupLatencyLogger;
|
||||
private CellPosMapper mCellPosMapper = CellPosMapper.DEFAULT;
|
||||
private boolean mIsFirstPagePinnedItemEnabled = QSB_ON_FIRST_SCREEN
|
||||
&& !ENABLE_SMARTSPACE_REMOVAL.get();
|
||||
|
||||
private final CannedAnimationCoordinator mAnimationCoordinator =
|
||||
new CannedAnimationCoordinator(this);
|
||||
@@ -1318,7 +1321,9 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
// Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
|
||||
// default state, otherwise we will update to the wrong offsets in RTL
|
||||
mWorkspace.lockWallpaperToDefaultPage();
|
||||
mWorkspace.bindAndInitFirstWorkspaceScreen();
|
||||
if (!ENABLE_SMARTSPACE_REMOVAL.get()) {
|
||||
mWorkspace.bindAndInitFirstWorkspaceScreen();
|
||||
}
|
||||
mDragController.addDragListener(mWorkspace);
|
||||
|
||||
// Get the search/delete/uninstall bar
|
||||
@@ -2158,16 +2163,23 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
TraceHelper.INSTANCE.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsFirstPagePinnedItemEnabled(boolean isFirstPagePinnedItemEnabled) {
|
||||
mIsFirstPagePinnedItemEnabled = isFirstPagePinnedItemEnabled;
|
||||
mWorkspace.bindAndInitFirstWorkspaceScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindScreens(IntArray orderedScreenIds) {
|
||||
mWorkspace.mPageIndicator.setAreScreensBinding(true);
|
||||
int firstScreenPosition = 0;
|
||||
if ((FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& mIsFirstPagePinnedItemEnabled
|
||||
&& !shouldShowFirstPageWidget())
|
||||
&& orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition) {
|
||||
orderedScreenIds.removeValue(FIRST_SCREEN_ID);
|
||||
orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID);
|
||||
} else if ((!FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
} else if (((!FeatureFlags.QSB_ON_FIRST_SCREEN && !mIsFirstPagePinnedItemEnabled)
|
||||
|| shouldShowFirstPageWidget())
|
||||
&& orderedScreenIds.isEmpty()) {
|
||||
// If there are no screens, we need to have an empty screen
|
||||
@@ -2218,6 +2230,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
for (int i = 0; i < count; i++) {
|
||||
int screenId = orderedScreenIds.get(i);
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& mIsFirstPagePinnedItemEnabled
|
||||
&& !shouldShowFirstPageWidget()
|
||||
&& screenId == FIRST_SCREEN_ID) {
|
||||
// No need to bind the first screen, as its always bound.
|
||||
@@ -3406,6 +3419,10 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
// Overridden
|
||||
}
|
||||
|
||||
public boolean getIsFirstPagePinnedItemEnabled() {
|
||||
return mIsFirstPagePinnedItemEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the animation coordinator for playing one-off animations
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user