Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a29a6994 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I38874b8b,I627ed7c6 into ub-launcher3-rvc-dev

* changes:
  Adds ripple effect for successful Back gestures in tutorial.
  Adds feedback to Home and Back tutorials.
parents 879d3ade e992fab1
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,12 @@
    android:layout_height="match_parent"
    android:background="@color/gesture_tutorial_background_color">

    <View
        android:id="@+id/gesture_tutorial_ripple_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/gesture_tutorial_ripple"/>

    <ImageView
        android:id="@+id/gesture_tutorial_fragment_hand_coaching"
        android:layout_width="match_parent"
@@ -66,6 +72,17 @@
            style="@style/TextAppearance.GestureTutorial.Subtitle"/>
    </LinearLayout>

    <TextView
        android:id="@+id/gesture_tutorial_fragment_feedback_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_centerHorizontal="true"
        android:layout_above="@id/gesture_tutorial_fragment_action_button"
        android:layout_marginStart="@dimen/gesture_tutorial_feedback_margin_start_end"
        android:layout_marginEnd="@dimen/gesture_tutorial_feedback_margin_start_end"
        style="@style/TextAppearance.GestureTutorial.Feedback"/>

    <!-- android:stateListAnimator="@null" removes shadow and normal on click behavior (increase
         of elevation and shadow) which is replaced by ripple effect in android:foreground -->
    <Button
+1 −0
Original line number Diff line number Diff line
@@ -83,5 +83,6 @@
    <!-- Tips Gesture Tutorial -->
    <dimen name="gesture_tutorial_title_margin_start_end">40dp</dimen>
    <dimen name="gesture_tutorial_subtitle_margin_start_end">16dp</dimen>
    <dimen name="gesture_tutorial_feedback_margin_start_end">24dp</dimen>
    <dimen name="gesture_tutorial_button_margin_start_end">18dp</dimen>
</resources>
+16 −0
Original line number Diff line number Diff line
@@ -98,12 +98,22 @@
    <string name="back_gesture_tutorial_playground_title_swipe_inward_right_edge" translatable="false">Try the back gesture</string>
    <!-- Subtitle shown during interactive parts of Back gesture tutorial for right edge. [CHAR LIMIT=60] -->
    <string name="back_gesture_tutorial_engaged_subtitle_swipe_inward_right_edge" translatable="false">Start at the right edge and swipe toward the middle</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_swipe_too_far_from_right_edge" translatable="false">Make sure you swipe from the far right edge</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is cancelled. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_cancelled_right_edge" translatable="false">Make sure you swipe straight to the left and let go</string>

    <!-- Title shown during interactive part of Back gesture tutorial for left edge. [CHAR LIMIT=30] -->
    <string name="back_gesture_tutorial_playground_title_swipe_inward_left_edge" translatable="false">Try the other side</string>
    <!-- Subtitle shown during interactive parts of Back gesture tutorial for left edge. [CHAR LIMIT=60] -->
    <string name="back_gesture_tutorial_engaged_subtitle_swipe_inward_left_edge" translatable="false">That\'s it! Now try swiping from the left edge.</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_swipe_too_far_from_left_edge" translatable="false">Make sure you swipe from the far left edge</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is cancelled. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_cancelled_left_edge" translatable="false">Make sure you swipe straight to the right and let go</string>

    <!-- Feedback shown during interactive parts of Back gesture tutorial when the gesture is within the nav bar region. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_swipe_in_nav_bar" translatable="false">Make sure you don\'t swipe too close to the bottom of the screen</string>
    <!-- Subtitle shown on the confirmation screen after successful gesture. [CHAR LIMIT=60] -->
    <string name="back_gesture_tutorial_confirm_subtitle" translatable="false">To change the sensitivity of the back gesture, go to Settings</string>

@@ -112,6 +122,12 @@
    <string name="home_gesture_tutorial_playground_title" translatable="false">Tutorial: Go Home</string>
    <!-- Subtitle shown during interactive parts of Home gesture tutorial. [CHAR LIMIT=60] -->
    <string name="home_gesture_tutorial_playground_subtitle" translatable="false">Try swiping upward from the bottom edge of the screen</string>
    <!-- Feedback shown during interactive parts of Home gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
    <string name="home_gesture_feedback_swipe_too_far_from_edge" translatable="false">Make sure you swipe from the bottom edge of the screen</string>
    <!-- Feedback shown during interactive parts of Home gesture tutorial when the Overview gesture is detected. [CHAR LIMIT=100] -->
    <string name="home_gesture_feedback_overview_detected" translatable="false">Make sure you don\'t pause before letting go</string>
    <!-- Feedback shown during interactive parts of Home gesture tutorial when the gesture is horizontal instead of vertical. [CHAR LIMIT=100] -->
    <string name="home_gesture_feedback_wrong_swipe_direction" translatable="false">Make sure you swipe straight up</string>

  <!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
  <string name="gesture_tutorial_confirm_title" translatable="false">All set</string>
+8 −0
Original line number Diff line number Diff line
@@ -47,6 +47,14 @@
        <item name="android:textSize">21sp</item>
    </style>

    <style name="TextAppearance.GestureTutorial.Feedback"
        parent="TextAppearance.GestureTutorial">
        <item name="android:gravity">center</item>
        <item name="android:textColor">@color/gesture_tutorial_feedback_color</item>
        <item name="android:letterSpacing">0.03</item>
        <item name="android:textSize">21sp</item>
    </style>

    <style name="TextAppearance.GestureTutorial.ButtonLabel"
        parent="TextAppearance.GestureTutorial.CallToAction">
        <item name="android:gravity">center</item>
+47 −9
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ final class BackGestureTutorialController extends TutorialController {
    void transitToController() {
        super.transitToController();
        if (mTutorialType != BACK_NAVIGATION_COMPLETE) {
            mHandCoachingAnimation.startLoopedAnimation(mTutorialType);
            showHandCoachingAnimation();
        }
    }

@@ -96,16 +96,10 @@ final class BackGestureTutorialController extends TutorialController {
    public void onBackGestureAttempted(BackGestureResult result) {
        switch (mTutorialType) {
            case RIGHT_EDGE_BACK_NAVIGATION:
                if (result == BackGestureResult.BACK_COMPLETED_FROM_RIGHT) {
                    hideHandCoachingAnimation();
                    mTutorialFragment.changeController(LEFT_EDGE_BACK_NAVIGATION);
                }
                handleAttemptFromRight(result);
                break;
            case LEFT_EDGE_BACK_NAVIGATION:
                if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT) {
                    hideHandCoachingAnimation();
                    mTutorialFragment.changeController(BACK_NAVIGATION_COMPLETE);
                }
                handleAttemptFromLeft(result);
                break;
            case BACK_NAVIGATION_COMPLETE:
                if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT
@@ -116,6 +110,50 @@ final class BackGestureTutorialController extends TutorialController {
        }
    }

    private void handleAttemptFromRight(BackGestureResult result) {
        switch (result) {
            case BACK_COMPLETED_FROM_RIGHT:
                hideFeedback();
                hideHandCoachingAnimation();
                showRippleEffect(
                        () -> mTutorialFragment.changeController(LEFT_EDGE_BACK_NAVIGATION));
                break;
            case BACK_CANCELLED_FROM_RIGHT:
                showFeedback(R.string.back_gesture_feedback_cancelled_right_edge);
                break;
            case BACK_COMPLETED_FROM_LEFT:
            case BACK_CANCELLED_FROM_LEFT:
            case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
                showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_right_edge);
                break;
            case BACK_NOT_STARTED_IN_NAV_BAR_REGION:
                showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
                break;
        }
    }

    private void handleAttemptFromLeft(BackGestureResult result) {
        switch (result) {
            case BACK_COMPLETED_FROM_LEFT:
                hideFeedback();
                hideHandCoachingAnimation();
                showRippleEffect(
                        () -> mTutorialFragment.changeController(BACK_NAVIGATION_COMPLETE));
                break;
            case BACK_CANCELLED_FROM_LEFT:
                showFeedback(R.string.back_gesture_feedback_cancelled_left_edge);
                break;
            case BACK_COMPLETED_FROM_RIGHT:
            case BACK_CANCELLED_FROM_RIGHT:
            case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
                showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_left_edge);
                break;
            case BACK_NOT_STARTED_IN_NAV_BAR_REGION:
                showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
                break;
        }
    }

    @Override
    public void onNavBarGestureAttempted(NavBarGestureResult result) {
        if (mTutorialType == BACK_NAVIGATION_COMPLETE) {
Loading