mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Fix TwoPanelWorkspaceTests" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
90259a6db4
@@ -33,6 +33,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DragSource;
|
||||
@@ -51,6 +52,8 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.touch.ItemLongClickListener;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
@@ -89,10 +92,14 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
|
||||
private List<PredictedAppIcon.PredictedIconOutlineDrawing> mOutlineDrawings = new ArrayList<>();
|
||||
|
||||
private boolean mEnableHotseatLongPressTipForTesting = true;
|
||||
|
||||
private final View.OnLongClickListener mPredictionLongClickListener = v -> {
|
||||
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
|
||||
if (mLauncher.getWorkspace().isSwitchingState()) return false;
|
||||
if (!mLauncher.getOnboardingPrefs().getBoolean(
|
||||
|
||||
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onWorkspaceItemLongClick");
|
||||
if (mEnableHotseatLongPressTipForTesting && !mLauncher.getOnboardingPrefs().getBoolean(
|
||||
OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN)) {
|
||||
Snackbar.show(mLauncher, R.string.hotseat_tip_gaps_filled,
|
||||
R.string.hotseat_prediction_settings, null,
|
||||
@@ -132,6 +139,12 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
onHotseatHierarchyChanged();
|
||||
}
|
||||
|
||||
/** Enables/disabled the hotseat prediction icon long press edu for testing. */
|
||||
@VisibleForTesting
|
||||
public void enableHotseatEdu(boolean enable) {
|
||||
mEnableHotseatLongPressTipForTesting = enable;
|
||||
}
|
||||
|
||||
private void onHotseatHierarchyChanged() {
|
||||
if (mPauseFlags == 0 && !mLauncher.isWorkspaceLoading()) {
|
||||
// Post update after a single frame to avoid layout within layout
|
||||
|
||||
@@ -317,6 +317,12 @@ public class QuickstepLauncher extends Launcher {
|
||||
return mHotseatPredictionController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableHotseatEdu(boolean enable) {
|
||||
super.enableHotseatEdu(enable);
|
||||
mHotseatPredictionController.enableHotseatEdu(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the {@link QuickstepTransitionManager} instance to use for managing transitions.
|
||||
*/
|
||||
|
||||
@@ -3259,6 +3259,10 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
return new LauncherAccessibilityDelegate(this);
|
||||
}
|
||||
|
||||
/** Enables/disabled the hotseat prediction icon long press edu for testing. */
|
||||
@VisibleForTesting
|
||||
public void enableHotseatEdu(boolean enable) {}
|
||||
|
||||
/**
|
||||
* @see LauncherState#getOverviewScaleAndOffset(Launcher)
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
// Pre verifying the screens
|
||||
executeOnLauncher(launcher -> {
|
||||
launcher.enableHotseatEdu(false);
|
||||
assertPagesExist(launcher, 0, 1);
|
||||
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
||||
assertPageEmpty(launcher, 1);
|
||||
@@ -67,6 +68,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
executeOnLauncher(launcher -> launcher.enableHotseatEdu(true));
|
||||
mLauncher.useDefaultWorkspaceLayoutOnReload();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user