Merge "Fix the overview tutorial step success animation" into udc-dev am: 8f23be7b6f am: 55d2f3f9ff am: 76699670c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23122638 Change-Id: Icf45935729ca2f31222bdbfb05132423cd916604 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
2f76e6322d
+25
-33
@@ -21,7 +21,6 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_T
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
import android.annotation.Nullable;
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -147,30 +146,11 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
|||||||
showFeedback(R.string.overview_gesture_feedback_swipe_too_far_from_edge);
|
showFeedback(R.string.overview_gesture_feedback_swipe_too_far_from_edge);
|
||||||
break;
|
break;
|
||||||
case OVERVIEW_GESTURE_COMPLETED:
|
case OVERVIEW_GESTURE_COMPLETED:
|
||||||
|
setGestureCompleted();
|
||||||
mTutorialFragment.releaseFeedbackAnimation();
|
mTutorialFragment.releaseFeedbackAnimation();
|
||||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
animateTaskViewToOverview(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get());
|
||||||
onMotionPaused(true /*arbitrary value*/);
|
onMotionPaused(true /*arbitrary value*/);
|
||||||
animateTaskViewToOverview(() -> {
|
if (!ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
||||||
mFakeTaskView.setVisibility(View.INVISIBLE);
|
|
||||||
if(!mTutorialFragment.isLargeScreen()){
|
|
||||||
mFakePreviousTaskView.animateToFillScreen(() -> {
|
|
||||||
mFakeLauncherView.setBackgroundColor(
|
|
||||||
mContext.getColor(
|
|
||||||
R.color.gesture_overview_tutorial_swipe_rect
|
|
||||||
));
|
|
||||||
showSuccessFeedback();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
mFakeLauncherView.setBackgroundColor(
|
|
||||||
mContext.getColor(
|
|
||||||
R.color.gesture_overview_tutorial_swipe_rect
|
|
||||||
));
|
|
||||||
showSuccessFeedback();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
animateTaskViewToOverview(null);
|
|
||||||
onMotionPaused(true /*arbitrary value*/);
|
|
||||||
showSuccessFeedback();
|
showSuccessFeedback();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -191,21 +171,28 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* runnable executed with slight delay to ease the swipe animation after landing on overview
|
* runnable executed with slight delay to ease the swipe animation after landing on overview
|
||||||
* @param runnable
|
|
||||||
*/
|
*/
|
||||||
public void animateTaskViewToOverview(@Nullable Runnable runnable) {
|
public void animateTaskViewToOverview(boolean animateDelayedSuccessFeedback) {
|
||||||
PendingAnimation anim = new PendingAnimation(TASK_VIEW_END_ANIMATION_DURATION_MILLIS);
|
PendingAnimation anim = new PendingAnimation(TASK_VIEW_END_ANIMATION_DURATION_MILLIS);
|
||||||
anim.setFloat(mTaskViewSwipeUpAnimation
|
anim.setFloat(mTaskViewSwipeUpAnimation
|
||||||
.getCurrentShift(), AnimatedFloat.VALUE, 1, ACCEL);
|
.getCurrentShift(), AnimatedFloat.VALUE, 1, ACCEL);
|
||||||
|
|
||||||
anim.addListener(new AnimatorListenerAdapter() {
|
if (animateDelayedSuccessFeedback) {
|
||||||
@Override
|
anim.addListener(new AnimatorListenerAdapter() {
|
||||||
public void onAnimationEnd(Animator animator) {
|
@Override
|
||||||
if (runnable != null) {
|
public void onAnimationEnd(Animator animator) {
|
||||||
new Handler().postDelayed(runnable, 300);
|
new Handler().postDelayed(() -> {
|
||||||
|
mFakeTaskView.setVisibility(View.INVISIBLE);
|
||||||
|
if (!mTutorialFragment.isLargeScreen()) {
|
||||||
|
mFakePreviousTaskView.animateToFillScreen(
|
||||||
|
() -> onSuccessAnimationComplete());
|
||||||
|
} else {
|
||||||
|
onSuccessAnimationComplete();
|
||||||
|
}
|
||||||
|
}, TASK_VIEW_FILL_SCREEN_ANIMATION_DELAY_MILLIS);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
ArrayList<Animator> animators = new ArrayList<>();
|
ArrayList<Animator> animators = new ArrayList<>();
|
||||||
|
|
||||||
@@ -224,4 +211,9 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
|||||||
animset.start();
|
animset.start();
|
||||||
mRunningWindowAnim = SwipeUpAnimationLogic.RunningWindowAnim.wrap(animset);
|
mRunningWindowAnim = SwipeUpAnimationLogic.RunningWindowAnim.wrap(animset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onSuccessAnimationComplete() {
|
||||||
|
setLauncherViewColor(R.color.gesture_overview_tutorial_swipe_rect);
|
||||||
|
showSuccessFeedback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ public class OverviewGestureTutorialFragment extends TutorialFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
super.onAnimationStart(animation);
|
super.onAnimationStart(animation);
|
||||||
controller.animateTaskViewToOverview(null);
|
controller.animateTaskViewToOverview(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
|||||||
private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(24);
|
private static final int FAKE_PREVIOUS_TASK_MARGIN = Utilities.dpToPx(24);
|
||||||
|
|
||||||
protected static final long TASK_VIEW_END_ANIMATION_DURATION_MILLIS = 300;
|
protected static final long TASK_VIEW_END_ANIMATION_DURATION_MILLIS = 300;
|
||||||
|
protected static final long TASK_VIEW_FILL_SCREEN_ANIMATION_DELAY_MILLIS = 300;
|
||||||
private static final long HOME_SWIPE_ANIMATION_DURATION_MILLIS = 625;
|
private static final long HOME_SWIPE_ANIMATION_DURATION_MILLIS = 625;
|
||||||
private static final long OVERVIEW_SWIPE_ANIMATION_DURATION_MILLIS = 1000;
|
private static final long OVERVIEW_SWIPE_ANIMATION_DURATION_MILLIS = 1000;
|
||||||
|
|
||||||
|
|||||||
@@ -316,6 +316,14 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only use this when a gesture is completed, but the feedback shouldn't be shown immediately.
|
||||||
|
* In that case, call this method immediately instead.
|
||||||
|
*/
|
||||||
|
public void setGestureCompleted() {
|
||||||
|
mGestureCompleted = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show feedback reflecting a successful gesture attempt.
|
* Show feedback reflecting a successful gesture attempt.
|
||||||
**/
|
**/
|
||||||
@@ -641,13 +649,17 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setLauncherViewColor(@ColorRes int backgroundColorRes) {
|
||||||
|
mFakeLauncherView.setBackgroundColor(mContext.getColor(backgroundColorRes));
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDrawables() {
|
private void updateDrawables() {
|
||||||
if (mContext != null) {
|
if (mContext != null) {
|
||||||
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
|
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
|
||||||
mContext, getMockWallpaperResId()));
|
mContext, getMockWallpaperResId()));
|
||||||
mTutorialFragment.updateFeedbackAnimation();
|
mTutorialFragment.updateFeedbackAnimation();
|
||||||
mFakeLauncherView.setBackgroundColor(
|
setLauncherViewColor(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||||
mContext.getColor(R.color.gesture_tutorial_fake_wallpaper_color));
|
? getSwipeActionColorResId() : R.color.gesture_tutorial_fake_wallpaper_color);
|
||||||
updateFakeViewLayout(mFakeHotseatView, getMockHotseatResId());
|
updateFakeViewLayout(mFakeHotseatView, getMockHotseatResId());
|
||||||
mHotseatIconView = mFakeHotseatView.findViewById(R.id.hotseat_icon_1);
|
mHotseatIconView = mFakeHotseatView.findViewById(R.id.hotseat_icon_1);
|
||||||
updateFakeViewLayout(mFakeTaskView, getMockAppTaskLayoutResId());
|
updateFakeViewLayout(mFakeTaskView, getMockAppTaskLayoutResId());
|
||||||
@@ -657,11 +669,6 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
getMockPreviousAppTaskThumbnailColorResId()));
|
getMockPreviousAppTaskThumbnailColorResId()));
|
||||||
mFakeIconView.setBackground(AppCompatResources.getDrawable(
|
mFakeIconView.setBackground(AppCompatResources.getDrawable(
|
||||||
mContext, getMockAppIconResId()));
|
mContext, getMockAppIconResId()));
|
||||||
|
|
||||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
|
||||||
mFakeLauncherView.setBackgroundColor(
|
|
||||||
mContext.getColor(getSwipeActionColorResId()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user