Merge "Update Gesture navigation tutorial to match new specs" into sc-dev
This commit is contained in:
commit
ae2e5d9231
|
@ -1,96 +0,0 @@
|
|||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<target android:name="_R_G_L_1_G_D_0_P_0">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="1000"
|
||||
android:propertyName="fillAlpha"
|
||||
android:startOffset="0"
|
||||
android:valueFrom="0.25"
|
||||
android:valueTo="0.75"
|
||||
android:valueType="floatType">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
<objectAnimator
|
||||
android:duration="1000"
|
||||
android:propertyName="fillAlpha"
|
||||
android:startOffset="1000"
|
||||
android:valueFrom="0.75"
|
||||
android:valueTo="0.25"
|
||||
android:valueType="floatType">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="_R_G_L_0_G">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="0"
|
||||
android:propertyName="scaleY"
|
||||
android:startOffset="0"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="_R_G_L_0_G">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="0"
|
||||
android:propertyName="scaleY"
|
||||
android:startOffset="783"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="time_group">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="2000"
|
||||
android:propertyName="translateX"
|
||||
android:startOffset="0"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector
|
||||
android:width="412dp"
|
||||
android:height="892dp"
|
||||
android:viewportHeight="892"
|
||||
android:viewportWidth="412">
|
||||
<group android:name="_R_G">
|
||||
<group
|
||||
android:name="_R_G_L_1_G"
|
||||
android:translateX="399.5"
|
||||
android:translateY="446">
|
||||
<path
|
||||
android:name="_R_G_L_1_G_D_0_P_0"
|
||||
android:fillAlpha="0.25"
|
||||
android:fillColor="@color/gesture_tutorial_primary_color"
|
||||
android:fillType="nonZero"
|
||||
android:pathData=" M12.5 -446 C12.5,-446 12.5,446 12.5,446 C12.5,446 -12.5,446 -12.5,446 C-12.5,446 -12.5,-446 -12.5,-446 C-12.5,-446 12.5,-446 12.5,-446c " />
|
||||
</group>
|
||||
<group
|
||||
android:name="_R_G_L_0_G"
|
||||
android:translateX="206"
|
||||
android:translateY="446" />
|
||||
</group>
|
||||
<group android:name="time_group" />
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
</animated-vector>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp"/>
|
||||
<corners android:radius="3dp"/>
|
||||
<size android:width="16dp" android:height="6dp"/>
|
||||
</shape>
|
|
@ -92,7 +92,8 @@
|
|||
android:layout_marginStart="@dimen/gesture_tutorial_feedback_margin_start_end"
|
||||
android:layout_marginEnd="@dimen/gesture_tutorial_feedback_margin_start_end"
|
||||
android:layout_marginTop="24dp"
|
||||
android:padding="24dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:background="@drawable/bg_sandbox_feedback">
|
||||
|
||||
<TextView
|
||||
|
@ -100,6 +101,8 @@
|
|||
style="@style/TextAppearance.GestureTutorial.Feedback.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -111,6 +114,8 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -131,31 +136,36 @@
|
|||
style="@style/TextAppearance.GestureTutorial.ButtonLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/gesture_tutorial_action_button_label_next"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="26dp"
|
||||
android:paddingEnd="26dp"
|
||||
android:text="@string/gesture_tutorial_action_button_label"
|
||||
android:background="@drawable/gesture_tutorial_action_button_background"
|
||||
android:stateListAnimator="@null"
|
||||
android:visibility="invisible"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<Button
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtext"
|
||||
android:id="@+id/gesture_tutorial_fragment_close_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="26dp"
|
||||
android:paddingEnd="26dp"
|
||||
android:text="@string/gesture_tutorial_action_button_label_skip"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
|
||||
app:layout_constraintTop_toTopOf="@id/gesture_tutorial_fragment_action_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/gesture_tutorial_fragment_action_button"
|
||||
app:layout_constraintStart_toStartOf="@id/gesture_tutorial_fragment_action_button"
|
||||
app:layout_constraintEnd_toEndOf="@id/gesture_tutorial_fragment_action_button"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
@ -91,16 +91,10 @@
|
|||
<!-- content description for hotseat items -->
|
||||
<string name="hotseat_prediction_content_description">Predicted app: <xliff:g id="title" example="Chrome">%1$s</xliff:g></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">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">Make sure you swipe from the left edge to the middle of the screen and let go.</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">Make sure you swipe from the far-right edge.</string>
|
||||
<string name="back_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe from the far-right or far-left 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">Make sure you swipe from the right edge to the middle of the screen and let go.</string>
|
||||
<!-- Feedback shown after completing the back gesture step if the user is following the full gesture tutorial flow. [CHAR LIMIT=100] -->
|
||||
<string name="back_gesture_feedback_complete_with_back_right_follow_up">You learned how to swipe from the left to go back.</string>
|
||||
<string name="back_gesture_feedback_cancelled">Make sure you swipe from the right or left edge to the middle of the screen and let go.</string>
|
||||
<!-- Feedback shown after completing the back gesture step if the user is following the full gesture tutorial flow. [CHAR LIMIT=100] -->
|
||||
<string name="back_gesture_feedback_complete_with_overview_follow_up">You learned how to swipe from the right to go back. Next up, learn how to switch apps.</string>
|
||||
<!-- Feedback shown after completing the back gesture step if the user started this tutorial individually. [CHAR LIMIT=100] -->
|
||||
|
@ -110,14 +104,10 @@
|
|||
<!-- Subtitle shown on the confirmation screen after successful gesture. [CHAR LIMIT=60] -->
|
||||
<string name="back_gesture_tutorial_confirm_subtitle">To change the sensitivity of the back gesture, go to Settings</string>
|
||||
<!-- Feedback shown during interactive parts of Home gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
|
||||
<!-- Introduction title for the left edge Back gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="back_left_gesture_intro_title">Swipe from the left to go back</string>
|
||||
<!-- Introduction title for the right edge Back gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="back_right_gesture_intro_title">Swipe from the right to go back</string>
|
||||
<!-- Introduction subtitle for the Back left gesture tutorial. [CHAR LIMIT=200] -->
|
||||
<string name="back_left_gesture_intro_subtitle">To go back to the last screen you were on, swipe from the left edge to the middle of the screen.</string>
|
||||
<!-- Introduction subtitle for the Back right gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="back_right_gesture_intro_subtitle">You can also go back to the last screen by swiping from the right edge to the middle of the screen. Try it now.</string>
|
||||
<!-- Introduction title for the Back gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="back_gesture_intro_title">Swipe to go back</string>
|
||||
<!-- Introduction subtitle for the Back gesture tutorial. [CHAR LIMIT=200] -->
|
||||
<string name="back_gesture_intro_subtitle">To go back to the last screen, swipe from the left or right edge to the middle of the screen.</string>
|
||||
|
||||
<string name="home_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up 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] -->
|
||||
|
@ -146,7 +136,7 @@
|
|||
<!-- Introduction title for the Overview gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="overview_gesture_intro_title">Swipe to switch apps</string>
|
||||
<!-- Introduction subtitle for the Overview gesture tutorial. [CHAR LIMIT=100] -->
|
||||
<string name="overview_gesture_intro_subtitle">Swipe up from the bottom of your screen, hold, then release.</string>
|
||||
<string name="overview_gesture_intro_subtitle">To switch between apps, swipe up from the bottom of your screen, hold, then release.</string>
|
||||
|
||||
<!-- Title shown during interactive part of Assistant gesture tutorial. [CHAR LIMIT=30] -->
|
||||
<string name="assistant_gesture_tutorial_playground_title" translatable="false">Tutorial: Assistant</string>
|
||||
|
@ -176,8 +166,8 @@
|
|||
|
||||
<!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
|
||||
<string name="gesture_tutorial_confirm_title">All set</string>
|
||||
<!-- Button text shown on a button on the feedback popup to proceed to the next tutorial step. [CHAR LIMIT=14] -->
|
||||
<string name="gesture_tutorial_action_button_label_next">Next</string>
|
||||
<!-- Button text shown on a button on the feedback popup to complete the gesture tutorial. [CHAR LIMIT=14] -->
|
||||
<string name="gesture_tutorial_action_button_label">Done</string>
|
||||
<!-- Button text shown on a button to go to Settings. [CHAR LIMIT=14] -->
|
||||
<string name="gesture_tutorial_action_button_label_settings">Settings</string>
|
||||
<!-- Feedback title to try again. [CHAR LIMIT=30] -->
|
||||
|
@ -190,11 +180,11 @@
|
|||
<!-- Title of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_title">All set!</string>
|
||||
<!-- Hint string at the bottom of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_hint">Swipe up to go home</string>
|
||||
<string name="allset_hint">Swipe up to go Home</string>
|
||||
<!-- Description of "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_description">You\u2019re ready to start using your phone</string>
|
||||
<!-- String linking to navigation settings on "All Set" page [CHAR LIMIT=NONE] -->
|
||||
<string name="allset_navigation_settings"><annotation id="link">Navigation settings for accessibility</annotation></string>
|
||||
<string name="allset_navigation_settings"><annotation id="link">System navigation settings</annotation></string>
|
||||
|
||||
<!-- ******* Overview ******* -->
|
||||
<!-- Label for a button that causes the current overview app to be shared. [CHAR_LIMIT=40] -->
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
parent="TextAppearance.GestureTutorial">
|
||||
<item name="android:gravity">start</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:fontFamily">google-sans-display</item>
|
||||
<item name="android:fontFamily">google-sans-regular</item>
|
||||
<item name="android:letterSpacing">0.03</item>
|
||||
<item name="android:textSize">36sp</item>
|
||||
<item name="android:lineHeight">42sp</item>
|
||||
<item name="android:lineHeight">44sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.GestureTutorial.Dialog.Title"
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
*/
|
||||
package com.android.quickstep.interaction;
|
||||
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION;
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION_COMPLETE;
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.LEFT_EDGE_BACK_NAVIGATION;
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
|
||||
|
||||
import android.graphics.PointF;
|
||||
|
||||
|
@ -36,15 +35,12 @@ final class BackGestureTutorialController extends TutorialController {
|
|||
|
||||
@Override
|
||||
public Integer getIntroductionTitle() {
|
||||
return mTutorialType == LEFT_EDGE_BACK_NAVIGATION
|
||||
? R.string.back_left_gesture_intro_title : R.string.back_right_gesture_intro_title;
|
||||
return R.string.back_gesture_intro_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIntroductionSubtitle() {
|
||||
return mTutorialType == LEFT_EDGE_BACK_NAVIGATION
|
||||
? R.string.back_left_gesture_intro_subtitle
|
||||
: R.string.back_right_gesture_intro_subtitle;
|
||||
return R.string.back_gesture_intro_subtitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,11 +54,8 @@ final class BackGestureTutorialController extends TutorialController {
|
|||
return;
|
||||
}
|
||||
switch (mTutorialType) {
|
||||
case RIGHT_EDGE_BACK_NAVIGATION:
|
||||
handleAttemptFromRight(result);
|
||||
break;
|
||||
case LEFT_EDGE_BACK_NAVIGATION:
|
||||
handleAttemptFromLeft(result);
|
||||
case BACK_NAVIGATION:
|
||||
handleBackAttempt(result);
|
||||
break;
|
||||
case BACK_NAVIGATION_COMPLETE:
|
||||
if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT
|
||||
|
@ -73,8 +66,9 @@ final class BackGestureTutorialController extends TutorialController {
|
|||
}
|
||||
}
|
||||
|
||||
private void handleAttemptFromRight(BackGestureResult result) {
|
||||
private void handleBackAttempt(BackGestureResult result) {
|
||||
switch (result) {
|
||||
case BACK_COMPLETED_FROM_LEFT:
|
||||
case BACK_COMPLETED_FROM_RIGHT:
|
||||
mTutorialFragment.releaseGestureVideoView();
|
||||
hideFeedback(true);
|
||||
|
@ -85,39 +79,12 @@ final class BackGestureTutorialController extends TutorialController {
|
|||
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
|
||||
showFeedback(subtitleResId, true);
|
||||
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:
|
||||
mTutorialFragment.releaseGestureVideoView();
|
||||
hideFeedback(true);
|
||||
mFakeTaskView.setBackground(AppCompatResources.getDrawable(mContext,
|
||||
R.drawable.mock_conversations_list));
|
||||
int subtitleResId = mTutorialFragment.isAtFinalStep()
|
||||
? R.string.back_gesture_feedback_complete_without_follow_up
|
||||
: R.string.back_gesture_feedback_complete_with_back_right_follow_up;
|
||||
showFeedback(subtitleResId, true);
|
||||
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:
|
||||
showFeedback(R.string.back_gesture_feedback_cancelled);
|
||||
break;
|
||||
case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
|
||||
showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_left_edge);
|
||||
showFeedback(R.string.back_gesture_feedback_swipe_too_far_from_edge);
|
||||
break;
|
||||
case BACK_NOT_STARTED_IN_NAV_BAR_REGION:
|
||||
showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
|
||||
|
@ -134,8 +101,7 @@ final class BackGestureTutorialController extends TutorialController {
|
|||
if (result == NavBarGestureResult.HOME_GESTURE_COMPLETED) {
|
||||
mTutorialFragment.closeTutorial();
|
||||
}
|
||||
} else if (mTutorialType == LEFT_EDGE_BACK_NAVIGATION
|
||||
|| mTutorialType == RIGHT_EDGE_BACK_NAVIGATION) {
|
||||
} else if (mTutorialType == BACK_NAVIGATION) {
|
||||
showFeedback(R.string.back_gesture_feedback_swipe_in_nav_bar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,17 +28,13 @@ public class BackGestureTutorialFragment extends TutorialFragment {
|
|||
@Nullable
|
||||
@Override
|
||||
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;
|
||||
return R.drawable.gesture_tutorial_motion_back;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
Integer getGestureVideoResId() {
|
||||
return mTutorialType == TutorialType.RIGHT_EDGE_BACK_NAVIGATION
|
||||
? R.drawable.gesture_tutorial_loop_back_right
|
||||
: R.drawable.gesture_tutorial_loop_back_left;
|
||||
return R.drawable.gesture_tutorial_loop_back;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -141,7 +141,7 @@ public class GestureSandboxActivity extends FragmentActivity {
|
|||
}
|
||||
|
||||
private TutorialType[] getTutorialSteps(Bundle extras) {
|
||||
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
|
||||
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.BACK_NAVIGATION};
|
||||
mCurrentStep = 1;
|
||||
mNumSteps = 1;
|
||||
|
||||
|
|
|
@ -82,7 +82,6 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
|||
case HOME_GESTURE_COMPLETED: {
|
||||
mTutorialFragment.releaseGestureVideoView();
|
||||
animateFakeTaskViewHome(finalVelocity, null);
|
||||
showActionButton();
|
||||
int subtitleResId = mTutorialFragment.isAtFinalStep()
|
||||
? R.string.home_gesture_feedback_complete_without_follow_up
|
||||
: R.string.home_gesture_feedback_complete_with_follow_up;
|
||||
|
|
|
@ -36,11 +36,9 @@ public class SandboxModeTutorialController extends SwipeUpGestureTutorialControl
|
|||
showRippleEffect(null);
|
||||
showFeedback(R.string.sandbox_mode_back_gesture_feedback_successful);
|
||||
break;
|
||||
case BACK_CANCELLED_FROM_RIGHT:
|
||||
showFeedback(R.string.back_gesture_feedback_cancelled_right_edge);
|
||||
break;
|
||||
case BACK_CANCELLED_FROM_LEFT:
|
||||
showFeedback(R.string.back_gesture_feedback_cancelled_left_edge);
|
||||
case BACK_CANCELLED_FROM_RIGHT:
|
||||
showFeedback(R.string.back_gesture_feedback_cancelled);
|
||||
break;
|
||||
case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
|
||||
showFeedback(R.string.sandbox_mode_back_gesture_feedback_swipe_too_far_from_edge);
|
||||
|
|
|
@ -59,6 +59,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
private static final int FEEDBACK_ANIMATION_MS = 250;
|
||||
private static final int RIPPLE_VISIBLE_MS = 300;
|
||||
private static final int GESTURE_ANIMATION_DELAY_MS = 1500;
|
||||
private static final int ADVANCE_TUTORIAL_TIMEOUT_MS = 4000;
|
||||
|
||||
final TutorialFragment mTutorialFragment;
|
||||
TutorialType mTutorialType;
|
||||
|
@ -220,7 +221,15 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
|
||||
subtitle.setText(subtitleResId);
|
||||
if (isGestureSuccessful) {
|
||||
showActionButton();
|
||||
hideCloseButton();
|
||||
if (mTutorialFragment.isAtFinalStep()) {
|
||||
showActionButton();
|
||||
}
|
||||
|
||||
if (mFeedbackVideoViewCallback != null) {
|
||||
mFeedbackVideoView.removeCallbacks(mFeedbackVideoViewCallback);
|
||||
mFeedbackVideoViewCallback = null;
|
||||
}
|
||||
}
|
||||
mGestureCompleted = isGestureSuccessful;
|
||||
|
||||
|
@ -248,6 +257,16 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
mFeedbackView.animate()
|
||||
.setDuration(FEEDBACK_ANIMATION_MS)
|
||||
.translationY(0)
|
||||
.withEndAction(() -> {
|
||||
if (isGestureSuccessful && !mTutorialFragment.isAtFinalStep()) {
|
||||
if (mFeedbackViewCallback != null) {
|
||||
mFeedbackView.removeCallbacks(mFeedbackViewCallback);
|
||||
}
|
||||
mFeedbackViewCallback = mTutorialFragment::continueTutorial;
|
||||
mFeedbackView.postDelayed(mFeedbackViewCallback,
|
||||
ADVANCE_TUTORIAL_TIMEOUT_MS);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
mFeedbackTitleView.postDelayed(mTitleViewCallback, FEEDBACK_ANIMATION_MS);
|
||||
}
|
||||
|
@ -352,19 +371,26 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
}
|
||||
}
|
||||
|
||||
void hideActionButton() {
|
||||
void hideCloseButton() {
|
||||
mCloseButton.setVisibility(GONE);
|
||||
}
|
||||
|
||||
void showCloseButton() {
|
||||
mCloseButton.setVisibility(View.VISIBLE);
|
||||
mCloseButton.setTextAppearance(Utilities.isDarkTheme(mContext)
|
||||
? R.style.TextAppearance_GestureTutorial_Feedback_Subtext
|
||||
: R.style.TextAppearance_GestureTutorial_Feedback_Subtext_Dark);
|
||||
}
|
||||
|
||||
void hideActionButton() {
|
||||
showCloseButton();
|
||||
// Invisible to maintain the layout.
|
||||
mActionButton.setVisibility(View.INVISIBLE);
|
||||
mActionButton.setOnClickListener(null);
|
||||
}
|
||||
|
||||
void showActionButton() {
|
||||
mCloseButton.setVisibility(GONE);
|
||||
hideCloseButton();
|
||||
mActionButton.setVisibility(View.VISIBLE);
|
||||
mActionButton.setOnClickListener(this::onActionButtonClicked);
|
||||
}
|
||||
|
@ -461,8 +487,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
|
||||
/** Denotes the type of the tutorial. */
|
||||
enum TutorialType {
|
||||
RIGHT_EDGE_BACK_NAVIGATION,
|
||||
LEFT_EDGE_BACK_NAVIGATION,
|
||||
BACK_NAVIGATION,
|
||||
BACK_NAVIGATION_COMPLETE,
|
||||
HOME_NAVIGATION,
|
||||
HOME_NAVIGATION_COMPLETE,
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
|
||||
if (fragment == null) {
|
||||
fragment = new BackGestureTutorialFragment();
|
||||
tutorialType = TutorialType.RIGHT_EDGE_BACK_NAVIGATION;
|
||||
tutorialType = TutorialType.BACK_NAVIGATION;
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
@ -76,8 +76,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
@Nullable
|
||||
private static TutorialFragment getFragmentForTutorialType(TutorialType tutorialType) {
|
||||
switch (tutorialType) {
|
||||
case RIGHT_EDGE_BACK_NAVIGATION:
|
||||
case LEFT_EDGE_BACK_NAVIGATION:
|
||||
case BACK_NAVIGATION:
|
||||
case BACK_NAVIGATION_COMPLETE:
|
||||
return new BackGestureTutorialFragment();
|
||||
case HOME_NAVIGATION:
|
||||
|
|
|
@ -293,8 +293,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
|
|||
"tutorial_steps",
|
||||
new String[] {
|
||||
"HOME_NAVIGATION",
|
||||
"LEFT_EDGE_BACK_NAVIGATION",
|
||||
"RIGHT_EDGE_BACK_NAVIGATION",
|
||||
"BACK_NAVIGATION",
|
||||
"OVERVIEW_NAVIGATION"}));
|
||||
return true;
|
||||
});
|
||||
|
@ -306,7 +305,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat {
|
|||
launchBackTutorialPreference.setOnPreferenceClickListener(preference -> {
|
||||
startActivity(launchSandboxIntent.putExtra(
|
||||
"tutorial_steps",
|
||||
new String[] {"LEFT_EDGE_BACK_NAVIGATION", "RIGHT_EDGE_BACK_NAVIGATION"}));
|
||||
new String[] {"BACK_NAVIGATION"}));
|
||||
return true;
|
||||
});
|
||||
sandboxCategory.addPreference(launchBackTutorialPreference);
|
||||
|
|
Loading…
Reference in New Issue