Update gesture nav colors and animation for dark/light theming
- Added light mode gesture feedback animations - Added color resources for the fake launcher wallpaper. Also using these color resources in the feedback animations for consistency - Using fake previous app task color in feedback animations for consistency Bug: 169687177 Test: manual Change-Id: I1d28212e02c2ae750ce6241b64aa90f52b827c76
This commit is contained in:
@@ -48,7 +48,7 @@ final class BackGestureTutorialController extends TutorialController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskThumbnailResId() {
|
||||
protected int getMockAppTaskThumbnailResId(boolean forDarkMode) {
|
||||
return R.drawable.mock_conversation;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,14 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
||||
public class BackGestureTutorialFragment extends TutorialFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
Integer getFeedbackVideoResId() {
|
||||
Integer getFeedbackVideoResId(boolean forDarkMode) {
|
||||
return mTutorialType == TutorialType.RIGHT_EDGE_BACK_NAVIGATION
|
||||
? R.drawable.gesture_tutorial_motion_back_right
|
||||
: R.drawable.gesture_tutorial_motion_back_left;
|
||||
? (forDarkMode
|
||||
? R.drawable.gesture_tutorial_motion_back_right_dark_mode
|
||||
: R.drawable.gesture_tutorial_motion_back_right_light_mode)
|
||||
: (forDarkMode
|
||||
? R.drawable.gesture_tutorial_motion_back_left_dark_mode
|
||||
: R.drawable.gesture_tutorial_motion_back_left_light_mode);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -42,8 +42,8 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskThumbnailResId() {
|
||||
return R.drawable.mock_webpage;
|
||||
protected int getMockAppTaskThumbnailResId(boolean forDarkMode) {
|
||||
return forDarkMode ? R.drawable.mock_webpage_dark_mode : R.drawable.mock_webpage_light_mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,10 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
||||
public class HomeGestureTutorialFragment extends TutorialFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
Integer getFeedbackVideoResId() {
|
||||
return R.drawable.gesture_tutorial_motion_home;
|
||||
Integer getFeedbackVideoResId(boolean forDarkMode) {
|
||||
return forDarkMode
|
||||
? R.drawable.gesture_tutorial_motion_home_dark_mode
|
||||
: R.drawable.gesture_tutorial_motion_home_light_mode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMockAppTaskThumbnailResId() {
|
||||
protected int getMockAppTaskThumbnailResId(boolean forDarkMode) {
|
||||
return R.drawable.mock_conversations_list;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -24,8 +24,10 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
||||
public class OverviewGestureTutorialFragment extends TutorialFragment {
|
||||
@Nullable
|
||||
@Override
|
||||
Integer getFeedbackVideoResId() {
|
||||
return R.drawable.gesture_tutorial_motion_overview;
|
||||
Integer getFeedbackVideoResId(boolean forDarkMode) {
|
||||
return forDarkMode
|
||||
? R.drawable.gesture_tutorial_motion_overview_dark_mode
|
||||
: R.drawable.gesture_tutorial_motion_overview_light_mode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
private AnimatorListenerAdapter mResetTaskView = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mFakeLauncherView.setVisibility(View.INVISIBLE);
|
||||
mFakeHotseatView.setVisibility(View.INVISIBLE);
|
||||
mFakeIconView.setVisibility(View.INVISIBLE);
|
||||
if (mTutorialFragment.getActivity() != null) {
|
||||
DisplayMetrics displayMetrics =
|
||||
@@ -197,7 +197,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
hideFeedback(true);
|
||||
cancelRunningAnimation();
|
||||
mFakePreviousTaskView.setVisibility(View.INVISIBLE);
|
||||
mFakeLauncherView.setVisibility(View.VISIBLE);
|
||||
mFakeHotseatView.setVisibility(View.VISIBLE);
|
||||
mShowPreviousTasks = false;
|
||||
RectFSpringAnim rectAnim =
|
||||
mTaskViewSwipeUpAnimation.handleSwipeUpToHome(finalVelocity);
|
||||
@@ -299,7 +299,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
@Override
|
||||
public RectF getWindowTargetRect() {
|
||||
int fakeHomeIconSizePx = Utilities.dpToPx(60);
|
||||
int fakeHomeIconLeft = mFakeLauncherView.getLeft();
|
||||
int fakeHomeIconLeft = mFakeHotseatView.getLeft();
|
||||
int fakeHomeIconTop = mDp.heightPx - Utilities.dpToPx(216);
|
||||
return new RectF(fakeHomeIconLeft, fakeHomeIconTop,
|
||||
fakeHomeIconLeft + fakeHomeIconSizePx,
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
@@ -66,7 +67,8 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
final ViewGroup mFeedbackView;
|
||||
final ImageView mFeedbackVideoView;
|
||||
final ImageView mGestureVideoView;
|
||||
final ImageView mFakeLauncherView;
|
||||
final RelativeLayout mFakeLauncherView;
|
||||
final ImageView mFakeHotseatView;
|
||||
final ClipIconView mFakeIconView;
|
||||
final View mFakeTaskView;
|
||||
final View mFakePreviousTaskView;
|
||||
@@ -90,6 +92,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
mFeedbackVideoView = rootView.findViewById(R.id.gesture_tutorial_feedback_video);
|
||||
mGestureVideoView = rootView.findViewById(R.id.gesture_tutorial_gesture_video);
|
||||
mFakeLauncherView = rootView.findViewById(R.id.gesture_tutorial_fake_launcher_view);
|
||||
mFakeHotseatView = rootView.findViewById(R.id.gesture_tutorial_fake_hotseat_view);
|
||||
mFakeIconView = rootView.findViewById(R.id.gesture_tutorial_fake_icon_view);
|
||||
mFakeTaskView = rootView.findViewById(R.id.gesture_tutorial_fake_task_view);
|
||||
mFakePreviousTaskView =
|
||||
@@ -113,12 +116,12 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
protected int getMockLauncherResId() {
|
||||
protected int getMockHotseatResId() {
|
||||
return R.drawable.default_sandbox_mock_launcher;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
protected int getMockAppTaskThumbnailResId() {
|
||||
protected int getMockAppTaskThumbnailResId(boolean forDarkMode) {
|
||||
return R.drawable.default_sandbox_app_task_thumbnail;
|
||||
}
|
||||
|
||||
@@ -312,8 +315,8 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
updateDrawables();
|
||||
|
||||
mGestureCompleted = false;
|
||||
if (mFakeLauncherView != null) {
|
||||
mFakeLauncherView.setVisibility(View.INVISIBLE);
|
||||
if (mFakeHotseatView != null) {
|
||||
mFakeHotseatView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,10 +347,14 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
|
||||
mContext, getMockWallpaperResId()));
|
||||
mTutorialFragment.updateFeedbackVideo();
|
||||
mFakeLauncherView.setImageDrawable(AppCompatResources.getDrawable(
|
||||
mContext, getMockLauncherResId()));
|
||||
mFakeLauncherView.setBackgroundColor(
|
||||
mContext.getColor(Utilities.isDarkTheme(mContext)
|
||||
? R.color.fake_wallpaper_color_dark_mode
|
||||
: R.color.fake_wallpaper_color_light_mode));
|
||||
mFakeHotseatView.setImageDrawable(AppCompatResources.getDrawable(
|
||||
mContext, getMockHotseatResId()));
|
||||
mFakeTaskView.setBackground(AppCompatResources.getDrawable(
|
||||
mContext, getMockAppTaskThumbnailResId()));
|
||||
mContext, getMockAppTaskThumbnailResId(Utilities.isDarkTheme(mContext))));
|
||||
mFakeTaskView.animate().alpha(1).setListener(
|
||||
AnimatorListeners.forSuccessCallback(() -> mFakeTaskView.animate().cancel()));
|
||||
mFakePreviousTaskView.setBackground(AppCompatResources.getDrawable(
|
||||
|
||||
@@ -38,6 +38,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.quickstep.interaction.TutorialController.TutorialType;
|
||||
|
||||
abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
||||
@@ -96,7 +97,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable Integer getFeedbackVideoResId() {
|
||||
@Nullable Integer getFeedbackVideoResId(boolean forDarkMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -176,8 +177,12 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
||||
}
|
||||
|
||||
boolean updateFeedbackVideo() {
|
||||
Integer feedbackVideoResId = getFeedbackVideoResId();
|
||||
if (feedbackVideoResId == null || getContext() == null || !updateGestureVideo()) {
|
||||
if (getContext() == null) {
|
||||
return false;
|
||||
}
|
||||
Integer feedbackVideoResId = getFeedbackVideoResId(Utilities.isDarkTheme(getContext()));
|
||||
|
||||
if (feedbackVideoResId == null || !updateGestureVideo()) {
|
||||
return false;
|
||||
}
|
||||
mTutorialAnimation = (AnimatedVectorDrawable) getContext().getDrawable(feedbackVideoResId);
|
||||
|
||||
Reference in New Issue
Block a user