[automerge] Added provision to switch the PageIndicator in specific Launchers 2p: 0f2e1b6714 2p: 070def81b0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17399997 Change-Id: I8602328c27fb579601bc93e70730a0df473b6265
This commit is contained in:
committed by
Presubmit Automerger Backend
commit
4e6ea7c31e
@@ -237,8 +237,8 @@ import java.util.stream.Stream;
|
||||
/**
|
||||
* Default launcher application.
|
||||
*/
|
||||
public class Launcher extends StatefulActivity<LauncherState> implements LauncherExterns,
|
||||
Callbacks, InvariantDeviceProfile.OnIDPChangeListener,
|
||||
public class Launcher extends StatefulActivity<LauncherState>
|
||||
implements LauncherExterns, Callbacks, InvariantDeviceProfile.OnIDPChangeListener,
|
||||
PluginListener<LauncherOverlayPlugin>, LauncherOverlayCallbacks {
|
||||
public static final String TAG = "Launcher";
|
||||
|
||||
@@ -304,7 +304,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
private Configuration mOldConfig;
|
||||
|
||||
@Thunk
|
||||
Workspace mWorkspace;
|
||||
Workspace<?> mWorkspace;
|
||||
@Thunk
|
||||
DragLayer mDragLayer;
|
||||
private DragController mDragController;
|
||||
@@ -1527,7 +1527,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
return mAppsView;
|
||||
}
|
||||
|
||||
public Workspace getWorkspace() {
|
||||
public Workspace<?> getWorkspace() {
|
||||
return mWorkspace;
|
||||
}
|
||||
|
||||
@@ -3226,11 +3226,12 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
/** Pauses view updates that should not be run during the app launch animation. */
|
||||
public void pauseExpensiveViewUpdates() {
|
||||
// Pause page indicator animations as they lead to layer trashing.
|
||||
getWorkspace().getPageIndicator().pauseAnimations();
|
||||
mWorkspace.getPageIndicator().pauseAnimations();
|
||||
}
|
||||
|
||||
/** Resumes view updates at the end of the app launch animation. */
|
||||
public void resumeExpensiveViewUpdates() {
|
||||
getWorkspace().getPageIndicator().skipAnimationsToEnd();
|
||||
mWorkspace.getPageIndicator().skipAnimationsToEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.model.data.SearchActionItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.pageindicators.WorkspacePageIndicator;
|
||||
import com.android.launcher3.pageindicators.PageIndicator;
|
||||
import com.android.launcher3.popup.PopupContainerWithArrow;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
@@ -134,8 +134,9 @@ import java.util.stream.Collectors;
|
||||
* The workspace is a wide area with a wallpaper and a finite number of pages.
|
||||
* Each page contains a number of icons, folders or widgets the user can
|
||||
* interact with. A workspace is meant to be used with a fixed width only.
|
||||
* @param <T> Class that extends View and PageIndicator
|
||||
*/
|
||||
public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
implements DropTarget, DragSource, View.OnTouchListener,
|
||||
DragController.DragListener, Insettable, StateHandler<LauncherState>,
|
||||
WorkspaceLayoutManager, LauncherBindableItemsContainer {
|
||||
|
||||
@@ -25,4 +25,24 @@ public interface PageIndicator {
|
||||
void setActiveMarker(int activePage);
|
||||
|
||||
void setMarkersCount(int numMarkers);
|
||||
|
||||
/**
|
||||
* Sets the flag if the Page Indicator should autohide.
|
||||
* @param shouldAutoHide
|
||||
*/
|
||||
default void setShouldAutoHide(boolean shouldAutoHide) {
|
||||
//No-op by default
|
||||
}
|
||||
/**
|
||||
* Pauses all currently running animations.
|
||||
*/
|
||||
default void pauseAnimations() {
|
||||
//No-op by default
|
||||
}
|
||||
/**
|
||||
* Force-ends all currently running or paused animations.
|
||||
*/
|
||||
default void skipAnimationsToEnd() {
|
||||
//No-op by default
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShouldAutoHide(boolean shouldAutoHide) {
|
||||
mShouldAutoHide = shouldAutoHide;
|
||||
if (shouldAutoHide && mLinePaint.getAlpha() > 0) {
|
||||
@@ -236,6 +237,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi
|
||||
/**
|
||||
* Pauses all currently running animations.
|
||||
*/
|
||||
@Override
|
||||
public void pauseAnimations() {
|
||||
for (int i = 0; i < ANIMATOR_COUNT; i++) {
|
||||
if (mAnimators[i] != null) {
|
||||
@@ -247,6 +249,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi
|
||||
/**
|
||||
* Force-ends all currently running or paused animations.
|
||||
*/
|
||||
@Override
|
||||
public void skipAnimationsToEnd() {
|
||||
for (int i = 0; i < ANIMATOR_COUNT; i++) {
|
||||
if (mAnimators[i] != null) {
|
||||
|
||||
Reference in New Issue
Block a user