Snap for 7981408 from b5a051ca0b
to sc-d2-release
Change-Id: Ibd6d2389480a8c61c357546009bb2d12f7ea59d2
This commit is contained in:
commit
ea38774323
|
@ -60,6 +60,7 @@ message ContainerInfo {
|
|||
PredictedHotseatContainer predicted_hotseat_container = 10;
|
||||
TaskSwitcherContainer task_switcher_container = 11;
|
||||
TaskBarContainer task_bar_container = 12;
|
||||
WallpapersContainer wallpapers_container = 13;
|
||||
ExtendedContainers extended_containers = 20;
|
||||
}
|
||||
}
|
||||
|
@ -247,6 +248,12 @@ message FolderContainer {
|
|||
}
|
||||
}
|
||||
|
||||
// Represents wallpapers container for quick switching.
|
||||
message WallpapersContainer {
|
||||
// Number of wallpapers in the container.
|
||||
optional int32 cardinality = 1;
|
||||
}
|
||||
|
||||
// Represents state of EditText field before update.
|
||||
enum FromState {
|
||||
// Default value.
|
||||
|
|
|
@ -49,13 +49,15 @@ import java.util.function.Supplier;
|
|||
|
||||
public static final int FLAG_RESUMED = 1 << 0;
|
||||
public static final int FLAG_RECENTS_ANIMATION_RUNNING = 1 << 1;
|
||||
public static final int FLAG_TRANSITION_STATE_START_STASHED = 1 << 2;
|
||||
public static final int FLAG_TRANSITION_STATE_COMMITTED_STASHED = 1 << 3;
|
||||
public static final int FLAG_TRANSITION_STATE_RUNNING = 1 << 2;
|
||||
|
||||
/** Equivalent to an int with all 1s for binary operation purposes */
|
||||
private static final int FLAGS_ALL = ~0;
|
||||
|
||||
private final AnimatedFloat mIconAlignmentForResumedState =
|
||||
new AnimatedFloat(this::onIconAlignmentRatioChanged);
|
||||
new AnimatedFloat(this::onIconAlignmentRatioChangedForAppAndHomeTransition);
|
||||
private final AnimatedFloat mIconAlignmentForGestureState =
|
||||
new AnimatedFloat(this::onIconAlignmentRatioChanged);
|
||||
new AnimatedFloat(this::onIconAlignmentRatioChangedForAppAndHomeTransition);
|
||||
private final AnimatedFloat mIconAlignmentForLauncherState =
|
||||
new AnimatedFloat(this::onIconAlignmentRatioChangedForStateTransition);
|
||||
|
||||
|
@ -64,8 +66,9 @@ import java.util.function.Supplier;
|
|||
private MultiValueAlpha.AlphaProperty mIconAlphaForHome;
|
||||
private BaseQuickstepLauncher mLauncher;
|
||||
|
||||
private int mPrevState;
|
||||
private Integer mPrevState;
|
||||
private int mState;
|
||||
private LauncherState mLauncherState = LauncherState.NORMAL;
|
||||
|
||||
private boolean mIsAnimatingToLauncherViaGesture;
|
||||
private boolean mIsAnimatingToLauncherViaResume;
|
||||
|
@ -75,15 +78,20 @@ import java.util.function.Supplier;
|
|||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
updateStateForFlag(FLAG_TRANSITION_STATE_START_STASHED,
|
||||
toState.isTaskbarStashed());
|
||||
if (toState != mLauncherState) {
|
||||
// Treat FLAG_TRANSITION_STATE_RUNNING as a changed flag even if a previous
|
||||
// state transition was already running, so we update the new target.
|
||||
mPrevState &= ~FLAG_TRANSITION_STATE_RUNNING;
|
||||
mLauncherState = toState;
|
||||
}
|
||||
updateStateForFlag(FLAG_TRANSITION_STATE_RUNNING, true);
|
||||
applyState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
updateStateForFlag(FLAG_TRANSITION_STATE_COMMITTED_STASHED,
|
||||
finalState.isTaskbarStashed());
|
||||
mLauncherState = finalState;
|
||||
updateStateForFlag(FLAG_TRANSITION_STATE_RUNNING, false);
|
||||
applyState();
|
||||
}
|
||||
};
|
||||
|
@ -100,7 +108,7 @@ import java.util.function.Supplier;
|
|||
(Consumer<Float>) alpha -> mLauncher.getHotseat().setIconsAlpha(alpha > 0 ? 0 : 1));
|
||||
|
||||
mIconAlignmentForResumedState.finishAnimation();
|
||||
onIconAlignmentRatioChanged();
|
||||
onIconAlignmentRatioChangedForAppAndHomeTransition();
|
||||
|
||||
mLauncher.getStateManager().addStateListener(mStateListener);
|
||||
}
|
||||
|
@ -121,9 +129,10 @@ import java.util.function.Supplier;
|
|||
// If going home, align the icons to hotseat
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
|
||||
// Update stashed flags first to ensure goingToUnstashedLauncherState() returns correctly.
|
||||
TaskbarStashController stashController = mControllers.taskbarStashController;
|
||||
stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
|
||||
toState.isTaskbarStashed());
|
||||
toState.isTaskbarStashed(mLauncher));
|
||||
stashController.updateStateForFlag(FLAG_IN_APP, false);
|
||||
|
||||
updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, true);
|
||||
|
@ -182,10 +191,11 @@ import java.util.function.Supplier;
|
|||
|
||||
public Animator applyState(long duration, boolean start) {
|
||||
Animator animator = null;
|
||||
if (mPrevState != mState) {
|
||||
int changedFlags = mPrevState ^ mState;
|
||||
animator = onStateChangeApplied(changedFlags, duration, start);
|
||||
if (mPrevState == null || mPrevState != mState) {
|
||||
// If this is our initial state, treat all flags as changed.
|
||||
int changedFlags = mPrevState == null ? FLAGS_ALL : mPrevState ^ mState;
|
||||
mPrevState = mState;
|
||||
animator = onStateChangeApplied(changedFlags, duration, start);
|
||||
}
|
||||
return animator;
|
||||
}
|
||||
|
@ -195,7 +205,8 @@ import java.util.function.Supplier;
|
|||
if (hasAnyFlag(changedFlags, FLAG_RESUMED)) {
|
||||
boolean isResumed = isResumed();
|
||||
ObjectAnimator anim = mIconAlignmentForResumedState
|
||||
.animateToValue(isResumed ? 1 : 0)
|
||||
.animateToValue(isResumed && goingToUnstashedLauncherState()
|
||||
? 1 : 0)
|
||||
.setDuration(duration);
|
||||
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
|
@ -219,7 +230,8 @@ import java.util.function.Supplier;
|
|||
if (hasAnyFlag(changedFlags, FLAG_RECENTS_ANIMATION_RUNNING)) {
|
||||
boolean isRecentsAnimationRunning = isRecentsAnimationRunning();
|
||||
Animator animator = mIconAlignmentForGestureState
|
||||
.animateToValue(isRecentsAnimationRunning ? 1 : 0);
|
||||
.animateToValue(isRecentsAnimationRunning && goingToUnstashedLauncherState()
|
||||
? 1 : 0);
|
||||
if (isRecentsAnimationRunning) {
|
||||
animator.setDuration(duration);
|
||||
}
|
||||
|
@ -237,14 +249,21 @@ import java.util.function.Supplier;
|
|||
animatorSet.play(animator);
|
||||
}
|
||||
|
||||
if (hasAnyFlag(changedFlags, FLAG_TRANSITION_STATE_START_STASHED)) {
|
||||
playStateTransitionAnim(isTransitionStateStartStashed(), animatorSet, duration,
|
||||
false /* committed */);
|
||||
if (hasAnyFlag(changedFlags, FLAG_RESUMED | FLAG_RECENTS_ANIMATION_RUNNING)) {
|
||||
boolean goingToLauncher = hasAnyFlag(FLAG_RESUMED | FLAG_RECENTS_ANIMATION_RUNNING);
|
||||
animatorSet.play(mTaskbarBackgroundAlpha.animateToValue(goingToLauncher ? 0 : 1)
|
||||
.setDuration(duration));
|
||||
}
|
||||
|
||||
if (hasAnyFlag(changedFlags, FLAG_TRANSITION_STATE_COMMITTED_STASHED)) {
|
||||
playStateTransitionAnim(isTransitionStateCommittedStashed(), animatorSet, duration,
|
||||
true /* committed */);
|
||||
if (hasAnyFlag(changedFlags, FLAG_TRANSITION_STATE_RUNNING)) {
|
||||
boolean committed = !hasAnyFlag(FLAG_TRANSITION_STATE_RUNNING);
|
||||
playStateTransitionAnim(animatorSet, duration, committed);
|
||||
|
||||
if (committed && mLauncherState == LauncherState.QUICK_SWITCH) {
|
||||
// We're about to be paused, set immediately to ensure seamless handoff.
|
||||
updateStateForFlag(FLAG_RESUMED, false);
|
||||
applyState(0 /* duration */);
|
||||
}
|
||||
}
|
||||
|
||||
if (start) {
|
||||
|
@ -253,17 +272,24 @@ import java.util.function.Supplier;
|
|||
return animatorSet;
|
||||
}
|
||||
|
||||
private void playStateTransitionAnim(boolean isTransitionStateStashed,
|
||||
AnimatorSet animatorSet, long duration, boolean committed) {
|
||||
/** Returns whether we're going to a state where taskbar icons should align with launcher. */
|
||||
private boolean goingToUnstashedLauncherState() {
|
||||
return !mControllers.taskbarStashController.isInStashedLauncherState();
|
||||
}
|
||||
|
||||
private void playStateTransitionAnim(AnimatorSet animatorSet, long duration,
|
||||
boolean committed) {
|
||||
boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher);
|
||||
float toAlignment = mLauncherState.isTaskbarAlignedWithHotseat(mLauncher) ? 1 : 0;
|
||||
|
||||
TaskbarStashController controller = mControllers.taskbarStashController;
|
||||
controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
|
||||
isTransitionStateStashed);
|
||||
controller.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState);
|
||||
Animator stashAnimator = controller.applyStateWithoutStart(duration);
|
||||
if (stashAnimator != null) {
|
||||
stashAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (isTransitionStateStashed && committed) {
|
||||
if (isInStashedState && committed) {
|
||||
// Reset hotseat alpha to default
|
||||
mLauncher.getHotseat().setIconsAlpha(1);
|
||||
}
|
||||
|
@ -271,14 +297,16 @@ import java.util.function.Supplier;
|
|||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mIconAlphaForHome.setValue(mLauncher.getHotseat().getIconsAlpha());
|
||||
if (mLauncher.getHotseat().getIconsAlpha() > 0) {
|
||||
mIconAlphaForHome.setValue(mLauncher.getHotseat().getIconsAlpha());
|
||||
}
|
||||
}
|
||||
});
|
||||
animatorSet.play(stashAnimator);
|
||||
animatorSet.play(mIconAlignmentForLauncherState.animateToValue(
|
||||
getCurrentIconAlignmentRatioForLauncherState(),
|
||||
isTransitionStateStashed ? 0 : 1));
|
||||
}
|
||||
|
||||
animatorSet.play(mIconAlignmentForLauncherState.animateToValue(toAlignment)
|
||||
.setDuration(duration));
|
||||
}
|
||||
|
||||
private boolean isResumed() {
|
||||
|
@ -289,20 +317,15 @@ import java.util.function.Supplier;
|
|||
return (mState & FLAG_RECENTS_ANIMATION_RUNNING) != 0;
|
||||
}
|
||||
|
||||
private boolean isTransitionStateStartStashed() {
|
||||
return (mState & FLAG_TRANSITION_STATE_START_STASHED) != 0;
|
||||
}
|
||||
|
||||
private boolean isTransitionStateCommittedStashed() {
|
||||
return (mState & FLAG_TRANSITION_STATE_COMMITTED_STASHED) != 0;
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChangedForStateTransition() {
|
||||
if (!isResumed()) {
|
||||
return;
|
||||
}
|
||||
onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioForLauncherState);
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChanged() {
|
||||
onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatio);
|
||||
private void onIconAlignmentRatioChangedForAppAndHomeTransition() {
|
||||
onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioBetweenAppAndHome);
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChanged(Supplier<Float> alignmentSupplier) {
|
||||
|
@ -313,13 +336,11 @@ import java.util.function.Supplier;
|
|||
mControllers.taskbarViewController.setLauncherIconAlignment(
|
||||
alignment, mLauncher.getDeviceProfile());
|
||||
|
||||
mTaskbarBackgroundAlpha.updateValue(1 - alignment);
|
||||
|
||||
// Switch taskbar and hotseat in last frame
|
||||
setTaskbarViewVisible(alignment < 1);
|
||||
}
|
||||
|
||||
private float getCurrentIconAlignmentRatio() {
|
||||
private float getCurrentIconAlignmentRatioBetweenAppAndHome() {
|
||||
return Math.max(mIconAlignmentForResumedState.value, mIconAlignmentForGestureState.value);
|
||||
}
|
||||
|
||||
|
|
|
@ -216,6 +216,13 @@ public class TaskbarStashController {
|
|||
return hasAnyFlag(FLAGS_STASHED_IN_APP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar should be stashed in the current LauncherState.
|
||||
*/
|
||||
public boolean isInStashedLauncherState() {
|
||||
return hasAnyFlag(FLAG_IN_STASHED_LAUNCHER_STATE) && supportsVisualStashing();
|
||||
}
|
||||
|
||||
private boolean hasAnyFlag(int flagMask) {
|
||||
return hasAnyFlag(mState, flagMask);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class AllAppsState extends LauncherState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarStashed() {
|
||||
public boolean isTaskbarStashed(Launcher launcher) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ public class BackgroundAppState extends OverviewState {
|
|||
return super.getVisibleElements(launcher)
|
||||
& ~OVERVIEW_ACTIONS
|
||||
& ~CLEAR_ALL_BUTTON
|
||||
& ~VERTICAL_SWIPE_INDICATOR
|
||||
| TASKBAR;
|
||||
& ~VERTICAL_SWIPE_INDICATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -92,7 +92,7 @@ public class OverviewState extends LauncherState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarStashed() {
|
||||
public boolean isTaskbarStashed(Launcher launcher) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states;
|
|||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
@ -42,6 +43,10 @@ public class QuickSwitchState extends BackgroundAppState {
|
|||
|
||||
@Override
|
||||
public int getWorkspaceScrimColor(Launcher launcher) {
|
||||
DeviceProfile dp = launcher.getDeviceProfile();
|
||||
if (dp.isTaskbarPresentInApps) {
|
||||
return launcher.getColor(R.color.taskbar_background);
|
||||
}
|
||||
return Themes.getAttrColor(launcher, R.attr.overviewScrimColor);
|
||||
}
|
||||
|
||||
|
@ -53,6 +58,16 @@ public class QuickSwitchState extends BackgroundAppState {
|
|||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
return TASKBAR;
|
||||
return NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarStashed(Launcher launcher) {
|
||||
return !launcher.getDeviceProfile().isTaskbarPresentInApps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarAlignedWithHotseat(Launcher launcher) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package com.android.launcher3.uioverrides.states;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
|
||||
/**
|
||||
|
@ -38,12 +36,6 @@ public class SplitScreenSelectState extends OverviewState {
|
|||
@Override
|
||||
public float getSplitSelectTranslation(Launcher launcher) {
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
int splitPosition = recentsView.getSplitPlaceholder().getActiveSplitStagePosition();
|
||||
if (!recentsView.shouldShiftThumbnailsForSplitSelect()) {
|
||||
return 0f;
|
||||
}
|
||||
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
|
||||
int direction = orientationHandler.getSplitTranslationDirectionFactor(splitPosition);
|
||||
return launcher.getResources().getDimension(R.dimen.split_placeholder_size) * direction;
|
||||
return recentsView.getSplitSelectTranslation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,8 +236,10 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
|||
// - RecentsView fade (if it's empty)
|
||||
PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2));
|
||||
xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
|
||||
// Use QuickSwitchState instead of OverviewState to determine scrim color,
|
||||
// since we need to take potential taskbar into account.
|
||||
xAnim.setViewBackgroundColor(mLauncher.getScrimView(),
|
||||
toState.getWorkspaceScrimColor(mLauncher), LINEAR);
|
||||
QUICK_SWITCH.getWorkspaceScrimColor(mLauncher), LINEAR);
|
||||
if (mRecentsView.getTaskViewCount() == 0) {
|
||||
xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR);
|
||||
}
|
||||
|
@ -310,6 +312,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
|||
}
|
||||
});
|
||||
overviewAnim.start();
|
||||
|
||||
// Create an empty state transition so StateListeners get onStateTransitionStart().
|
||||
mLauncher.getStateManager().createAnimationToNewWorkspace(
|
||||
OVERVIEW, config.duration, StateAnimationConfig.SKIP_ALL_ANIMATIONS)
|
||||
.dispatchOnStart();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -384,6 +391,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
|
|||
config.animFlags = SKIP_ALL_ANIMATIONS;
|
||||
updateNonOverviewAnim(targetState, config);
|
||||
nonOverviewAnim = mNonOverviewAnim.getAnimationPlayer();
|
||||
mNonOverviewAnim.dispatchOnStart();
|
||||
|
||||
new WorkspaceRevealAnim(mLauncher, false /* animateOverviewScrim */).start();
|
||||
} else {
|
||||
|
|
|
@ -129,7 +129,7 @@ public class FloatingTaskView extends FrameLayout {
|
|||
public void update(RectF position, float progress, float windowRadius) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
|
||||
|
||||
float dX = position.left - lp.getMarginStart();
|
||||
float dX = position.left - mStartingPosition.left;
|
||||
float dY = position.top - lp.topMargin;
|
||||
|
||||
setTranslationX(dX);
|
||||
|
@ -150,15 +150,25 @@ public class FloatingTaskView extends FrameLayout {
|
|||
mOrientationHandler.setSecondaryScale(mSplitPlaceholderView.getIconView(), childScaleY);
|
||||
}
|
||||
|
||||
public void updateOrientationHandler(PagedOrientationHandler orientationHandler) {
|
||||
mOrientationHandler = orientationHandler;
|
||||
mSplitPlaceholderView.getIconView().setRotation(mOrientationHandler.getDegreesRotated());
|
||||
}
|
||||
|
||||
protected void initPosition(RectF pos, InsettableFrameLayout.LayoutParams lp) {
|
||||
mStartingPosition.set(pos);
|
||||
lp.ignoreInsets = true;
|
||||
// Position the floating view exactly on top of the original
|
||||
lp.topMargin = Math.round(pos.top);
|
||||
lp.setMarginStart(Math.round(pos.left));
|
||||
if (mIsRtl) {
|
||||
lp.setMarginStart(mLauncher.getDeviceProfile().widthPx - Math.round(pos.right));
|
||||
} else {
|
||||
lp.setMarginStart(Math.round(pos.left));
|
||||
}
|
||||
|
||||
// Set the properties here already to make sure they are available when running the first
|
||||
// animation frame.
|
||||
int left = lp.leftMargin;
|
||||
int left = (int) pos.left;
|
||||
layout(left, lp.topMargin, left + lp.width, lp.topMargin + lp.height);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
|||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -171,10 +170,13 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
protected void onOrientationChanged() {
|
||||
super.onOrientationChanged();
|
||||
// If overview is in modal state when rotate, reset it to overview state without running
|
||||
// animation.
|
||||
setModalStateEnabled(false);
|
||||
if (mActivity.isInState(OVERVIEW_SPLIT_SELECT)) {
|
||||
onRotateInSplitSelectionState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ import android.text.TextPaint;
|
|||
import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -629,7 +630,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
* this doesn't get adjusted to reflect the new child count after the taskView is dismissed/
|
||||
* removed from recentsView
|
||||
*/
|
||||
private int mSplitHiddenTaskViewIndex;
|
||||
private int mSplitHiddenTaskViewIndex = -1;
|
||||
@Nullable
|
||||
private FloatingTaskView mFirstFloatingTaskView;
|
||||
@Nullable
|
||||
|
@ -1620,7 +1621,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
|| !mOrientationHandler.equals(oldOrientationHandler)) {
|
||||
// Changed orientations, update controllers so they intercept accordingly.
|
||||
mActivity.getDragLayer().recreateControllers();
|
||||
setModalStateEnabled(false);
|
||||
onOrientationChanged();
|
||||
}
|
||||
|
||||
boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0
|
||||
|
@ -1639,6 +1640,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
setCurrentPage(mCurrentPage);
|
||||
}
|
||||
|
||||
protected void onOrientationChanged() {
|
||||
}
|
||||
|
||||
// Update task size and padding that are dependent on DeviceProfile and insets.
|
||||
private void updateSizeAndPadding() {
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
|
@ -3333,7 +3337,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
* {@link #mFirstFloatingTaskView}.
|
||||
*/
|
||||
public boolean shouldShiftThumbnailsForSplitSelect() {
|
||||
return !mActivity.getDeviceProfile().isTablet;
|
||||
return !mActivity.getDeviceProfile().isTablet || !mActivity.getDeviceProfile().isLandscape;
|
||||
}
|
||||
|
||||
protected void onDismissAnimationEnds() {
|
||||
|
@ -3519,6 +3523,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateRecentsRotation();
|
||||
onOrientationChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3833,13 +3838,18 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
* Apply scroll offset to children of RecentsView when entering split select.
|
||||
*/
|
||||
public void applySplitPrimaryScrollOffset() {
|
||||
float taskSplitScrollOffsetPrimary = 0f;
|
||||
float clearAllSplitScrollOffsetPrimar = 0f;
|
||||
if (isSplitPlaceholderFirstInGrid()) {
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
requireTaskViewAt(i).setSplitScrollOffsetPrimary(mSplitPlaceholderSize);
|
||||
}
|
||||
taskSplitScrollOffsetPrimary = mSplitPlaceholderSize;
|
||||
} else if (isSplitPlaceholderLastInGrid()) {
|
||||
mClearAllButton.setSplitSelectScrollOffsetPrimary(-mSplitPlaceholderSize);
|
||||
clearAllSplitScrollOffsetPrimar = -mSplitPlaceholderSize;
|
||||
}
|
||||
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
requireTaskViewAt(i).setSplitScrollOffsetPrimary(taskSplitScrollOffsetPrimary);
|
||||
}
|
||||
mClearAllButton.setSplitSelectScrollOffsetPrimary(clearAllSplitScrollOffsetPrimar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3959,6 +3969,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
|
||||
/** TODO(b/181707736) More gracefully handle exiting split selection state */
|
||||
private void resetFromSplitSelectionState() {
|
||||
if (mSplitHiddenTaskViewIndex == -1) {
|
||||
return;
|
||||
}
|
||||
if (!mActivity.getDeviceProfile().overviewShowAsGrid) {
|
||||
int pageToSnapTo = mCurrentPage;
|
||||
if (mSplitHiddenTaskViewIndex <= pageToSnapTo) {
|
||||
|
@ -3987,6 +4000,41 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how much additional translation there should be for each of the child TaskViews.
|
||||
* Note that the translation can be its primary or secondary dimension.
|
||||
*/
|
||||
public float getSplitSelectTranslation() {
|
||||
int splitPosition = getSplitPlaceholder().getActiveSplitStagePosition();
|
||||
if (!shouldShiftThumbnailsForSplitSelect()) {
|
||||
return 0f;
|
||||
}
|
||||
PagedOrientationHandler orientationHandler = getPagedOrientationHandler();
|
||||
int direction = orientationHandler.getSplitTranslationDirectionFactor(
|
||||
splitPosition, mActivity.getDeviceProfile());
|
||||
return mActivity.getResources().getDimension(R.dimen.split_placeholder_size) * direction;
|
||||
}
|
||||
|
||||
protected void onRotateInSplitSelectionState() {
|
||||
mOrientationHandler.getInitialSplitPlaceholderBounds(mSplitPlaceholderSize,
|
||||
mActivity.getDeviceProfile(),
|
||||
mSplitSelectStateController.getActiveSplitStagePosition(), mTempRect);
|
||||
mTempRectF.set(mTempRect);
|
||||
// TODO(194414938) set correct corner radius
|
||||
mFirstFloatingTaskView.updateOrientationHandler(mOrientationHandler);
|
||||
mFirstFloatingTaskView.update(mTempRectF, /*progress=*/1f, /*windowRadius=*/0f);
|
||||
|
||||
PagedOrientationHandler orientationHandler = getPagedOrientationHandler();
|
||||
Pair<FloatProperty, FloatProperty> taskViewsFloat =
|
||||
orientationHandler.getSplitSelectTaskOffset(
|
||||
TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION,
|
||||
mActivity.getDeviceProfile());
|
||||
taskViewsFloat.first.set(this, getSplitSelectTranslation());
|
||||
taskViewsFloat.second.set(this, 0f);
|
||||
|
||||
applySplitPrimaryScrollOffset();
|
||||
}
|
||||
|
||||
private void updateDeadZoneRects() {
|
||||
// Get the deadzone rect surrounding the clear all button to not dismiss overview to home
|
||||
mClearAllButtonDeadZoneRect.setEmpty();
|
||||
|
|
|
@ -57,10 +57,9 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
|||
public static final int ALL_APPS_CONTENT = 1 << 1;
|
||||
public static final int VERTICAL_SWIPE_INDICATOR = 1 << 2;
|
||||
public static final int OVERVIEW_ACTIONS = 1 << 3;
|
||||
public static final int TASKBAR = 1 << 4;
|
||||
public static final int CLEAR_ALL_BUTTON = 1 << 5;
|
||||
public static final int WORKSPACE_PAGE_INDICATOR = 1 << 6;
|
||||
public static final int SPLIT_PLACHOLDER_VIEW = 1 << 7;
|
||||
public static final int CLEAR_ALL_BUTTON = 1 << 4;
|
||||
public static final int WORKSPACE_PAGE_INDICATOR = 1 << 5;
|
||||
public static final int SPLIT_PLACHOLDER_VIEW = 1 << 6;
|
||||
|
||||
// Flag indicating workspace has multiple pages visible.
|
||||
public static final int FLAG_MULTI_PAGE = BaseState.getFlag(0);
|
||||
|
@ -186,7 +185,7 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
|||
}
|
||||
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
return HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR | TASKBAR;
|
||||
return HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,10 +196,16 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
|||
return (getVisibleElements(launcher) & elements) == elements;
|
||||
}
|
||||
|
||||
public boolean isTaskbarStashed() {
|
||||
/** Returns whether taskbar is stashed and thus should replace hotseat with a handle */
|
||||
public boolean isTaskbarStashed(Launcher launcher) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns whether taskbar is aligned with the hotseat vs position inside apps */
|
||||
public boolean isTaskbarAlignedWithHotseat(Launcher launcher) {
|
||||
return !isTaskbarStashed(launcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fraction shift in the vertical translation UI and related properties
|
||||
*
|
||||
|
|
|
@ -92,9 +92,6 @@ public final class FeatureFlags {
|
|||
public static final BooleanFlag ENABLE_DEVICE_SEARCH = new DeviceFlag(
|
||||
"ENABLE_DEVICE_SEARCH", true, "Allows on device search in all apps");
|
||||
|
||||
public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false,
|
||||
"Use homescreen search box to complete allApps searches");
|
||||
|
||||
public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(
|
||||
"ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps.");
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SEARCH_
|
|||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SETTINGS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WALLPAPERS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.EXTENDED_CONTAINERS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
||||
|
@ -55,6 +56,7 @@ import com.android.launcher3.logger.LauncherAtom.SettingsContainer;
|
|||
import com.android.launcher3.logger.LauncherAtom.Shortcut;
|
||||
import com.android.launcher3.logger.LauncherAtom.ShortcutsContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.TaskSwitcherContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.WallpapersContainer;
|
||||
import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers;
|
||||
import com.android.launcher3.model.ModelWriter;
|
||||
import com.android.launcher3.util.ContentWriter;
|
||||
|
@ -428,6 +430,10 @@ public class ItemInfo {
|
|||
return ContainerInfo.newBuilder()
|
||||
.setTaskSwitcherContainer(TaskSwitcherContainer.getDefaultInstance())
|
||||
.build();
|
||||
case CONTAINER_WALLPAPERS:
|
||||
return ContainerInfo.newBuilder()
|
||||
.setWallpapersContainer(WallpapersContainer.getDefaultInstance())
|
||||
.build();
|
||||
case EXTENDED_CONTAINERS:
|
||||
return ContainerInfo.newBuilder()
|
||||
.setExtendedContainers(getExtendedContainer())
|
||||
|
|
|
@ -90,9 +90,4 @@ public class SpringLoadedState extends LauncherState {
|
|||
public float getWorkspaceBackgroundAlpha(Launcher launcher) {
|
||||
return 0.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
return (super.getVisibleElements(launcher) | HOTSEAT_ICONS) & ~TASKBAR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition) {
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition, DeviceProfile deviceProfile) {
|
||||
if (stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
@ -95,7 +95,8 @@ public interface PagedOrientationHandler {
|
|||
int getScrollOffsetStart(View view, Rect insets);
|
||||
int getScrollOffsetEnd(View view, Rect insets);
|
||||
int getSecondaryTranslationDirectionFactor();
|
||||
int getSplitTranslationDirectionFactor(@StagePosition int stagePosition);
|
||||
int getSplitTranslationDirectionFactor(@StagePosition int stagePosition,
|
||||
DeviceProfile deviceProfile);
|
||||
ChildBounds getChildBounds(View child, int childStart, int pageCenter, boolean layoutChild);
|
||||
void setMaxScroll(AccessibilityEvent event, int maxScroll);
|
||||
boolean getRecentsRtlSetting(Resources resources);
|
||||
|
|
|
@ -261,8 +261,8 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition) {
|
||||
if (stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition, DeviceProfile deviceProfile) {
|
||||
if (deviceProfile.isLandscape && stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
|
|
|
@ -37,7 +37,6 @@ import android.widget.LinearLayout;
|
|||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
@ -53,7 +52,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition) {
|
||||
public int getSplitTranslationDirectionFactor(int stagePosition, DeviceProfile deviceProfile) {
|
||||
if (stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
return -1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue