Snap for 7981334 from 35f3a45487 to tm-release
Change-Id: I23c47afab370aa8f5f7b34cef031f16fc01df02d
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -55,4 +60,14 @@ public class QuickSwitchState extends BackgroundAppState {
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -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();
|
||||
|
||||
@@ -196,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
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user