Merge "Animate overivew actions view hiding on scroll." into tm-dev am: 10b77ab7e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17414979 Change-Id: I4239e456eb3a2c9875e3304853e8231eca602f04 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -58,7 +58,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
|||||||
HIDDEN_NON_ZERO_ROTATION,
|
HIDDEN_NON_ZERO_ROTATION,
|
||||||
HIDDEN_NO_TASKS,
|
HIDDEN_NO_TASKS,
|
||||||
HIDDEN_NO_RECENTS,
|
HIDDEN_NO_RECENTS,
|
||||||
HIDDEN_FOCUSED_SCROLL,
|
|
||||||
HIDDEN_SPLIT_SCREEN})
|
HIDDEN_SPLIT_SCREEN})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface ActionsHiddenFlags { }
|
public @interface ActionsHiddenFlags { }
|
||||||
@@ -66,8 +65,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
|||||||
public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 0;
|
public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 0;
|
||||||
public static final int HIDDEN_NO_TASKS = 1 << 1;
|
public static final int HIDDEN_NO_TASKS = 1 << 1;
|
||||||
public static final int HIDDEN_NO_RECENTS = 1 << 2;
|
public static final int HIDDEN_NO_RECENTS = 1 << 2;
|
||||||
public static final int HIDDEN_FOCUSED_SCROLL = 1 << 3;
|
public static final int HIDDEN_SPLIT_SCREEN = 1 << 3;
|
||||||
public static final int HIDDEN_SPLIT_SCREEN = 1 << 4;
|
|
||||||
|
|
||||||
@IntDef(flag = true, value = {
|
@IntDef(flag = true, value = {
|
||||||
DISABLED_SCROLLING,
|
DISABLED_SCROLLING,
|
||||||
|
|||||||
@@ -375,6 +375,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
// OverScroll constants
|
// OverScroll constants
|
||||||
private static final int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
|
private static final int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
|
||||||
|
|
||||||
|
private static final int DEFAULT_ACTIONS_VIEW_ALPHA_ANIMATION_DURATION = 300;
|
||||||
|
|
||||||
private static final int DISMISS_TASK_DURATION = 300;
|
private static final int DISMISS_TASK_DURATION = 300;
|
||||||
private static final int ADDITION_TASK_DURATION = 200;
|
private static final int ADDITION_TASK_DURATION = 200;
|
||||||
private static final float INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.55f;
|
private static final float INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.55f;
|
||||||
@@ -648,6 +650,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
private TaskView mMovingTaskView;
|
private TaskView mMovingTaskView;
|
||||||
|
|
||||||
private OverviewActionsView mActionsView;
|
private OverviewActionsView mActionsView;
|
||||||
|
private ObjectAnimator mActionsViewAlphaAnimator;
|
||||||
|
private float mActionsViewAlphaAnimatorFinalValue;
|
||||||
|
|
||||||
private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
|
private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
|
||||||
new MultiWindowModeChangedListener() {
|
new MultiWindowModeChangedListener() {
|
||||||
@@ -1133,6 +1137,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
|
return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFocusedTaskInExpectedScrollPosition() {
|
||||||
|
TaskView focusedTask = getFocusedTaskView();
|
||||||
|
return focusedTask != null && isTaskInExpectedScrollPosition(indexOfChild(focusedTask));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link TaskView} that has taskId matching {@code taskId} or null if no match.
|
* Returns a {@link TaskView} that has taskId matching {@code taskId} or null if no match.
|
||||||
*/
|
*/
|
||||||
@@ -1179,13 +1188,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
@Override
|
@Override
|
||||||
protected void onPageBeginTransition() {
|
protected void onPageBeginTransition() {
|
||||||
super.onPageBeginTransition();
|
super.onPageBeginTransition();
|
||||||
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true);
|
if (!mActivity.getDeviceProfile().isTablet) {
|
||||||
|
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPageEndTransition() {
|
protected void onPageEndTransition() {
|
||||||
super.onPageEndTransition();
|
super.onPageEndTransition();
|
||||||
if (isClearAllHidden()) {
|
if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
|
||||||
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
|
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
|
||||||
}
|
}
|
||||||
if (getNextPage() > 0) {
|
if (getNextPage() > 0) {
|
||||||
@@ -1786,16 +1797,24 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateActionsViewFocusedScroll() {
|
private void updateActionsViewFocusedScroll() {
|
||||||
boolean hiddenFocusedScroll;
|
|
||||||
if (showAsGrid()) {
|
if (showAsGrid()) {
|
||||||
TaskView focusedTaskView = getFocusedTaskView();
|
float actionsViewAlphaValue = isFocusedTaskInExpectedScrollPosition() ? 1 : 0;
|
||||||
hiddenFocusedScroll = focusedTaskView == null
|
// If animation is already in progress towards the same end value, do not restart.
|
||||||
|| !isTaskInExpectedScrollPosition(indexOfChild(focusedTaskView));
|
if (mActionsViewAlphaAnimator == null || !mActionsViewAlphaAnimator.isStarted()
|
||||||
} else {
|
|| (mActionsViewAlphaAnimator.isStarted()
|
||||||
hiddenFocusedScroll = false;
|
&& mActionsViewAlphaAnimatorFinalValue != actionsViewAlphaValue)) {
|
||||||
|
animateActionsViewAlpha(actionsViewAlphaValue,
|
||||||
|
DEFAULT_ACTIONS_VIEW_ALPHA_ANIMATION_DURATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mActionsView.updateHiddenFlags(OverviewActionsView.HIDDEN_FOCUSED_SCROLL,
|
}
|
||||||
hiddenFocusedScroll);
|
|
||||||
|
private void animateActionsViewAlpha(float alphaValue, long duration) {
|
||||||
|
mActionsViewAlphaAnimator = ObjectAnimator.ofFloat(
|
||||||
|
mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, alphaValue);
|
||||||
|
mActionsViewAlphaAnimatorFinalValue = alphaValue;
|
||||||
|
mActionsViewAlphaAnimator.setDuration(duration);
|
||||||
|
mActionsViewAlphaAnimator.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2324,10 +2343,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void animateActionsViewIn() {
|
private void animateActionsViewIn() {
|
||||||
ObjectAnimator anim = ObjectAnimator.ofFloat(
|
if (!showAsGrid() || isFocusedTaskInExpectedScrollPosition()) {
|
||||||
mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, 0, 1);
|
animateActionsViewAlpha(1, TaskView.SCALE_ICON_DURATION);
|
||||||
anim.setDuration(TaskView.SCALE_ICON_DURATION);
|
}
|
||||||
anim.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void animateUpTaskIconScale() {
|
public void animateUpTaskIconScale() {
|
||||||
@@ -3263,7 +3281,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
// Update various scroll-dependent UI.
|
// Update various scroll-dependent UI.
|
||||||
dispatchScrollChanged();
|
dispatchScrollChanged();
|
||||||
updateActionsViewFocusedScroll();
|
updateActionsViewFocusedScroll();
|
||||||
if (isClearAllHidden()) {
|
if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
|
||||||
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING,
|
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user