Merge "Update home, back and overview gesture tutorial introductions to be clearer for blind users" into tm-dev am: 3e8f0c9bb6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18101491 Change-Id: I810be07f3af77bf463ca34d8603a308e90d2c5ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -109,6 +109,8 @@
|
|||||||
<string name="back_gesture_intro_title">Swipe to go back</string>
|
<string name="back_gesture_intro_title">Swipe to go back</string>
|
||||||
<!-- Introduction subtitle for the Back gesture tutorial. [CHAR LIMIT=200] -->
|
<!-- 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="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>
|
||||||
|
<!-- Introduction subtitle for the Back gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=200] -->
|
||||||
|
<string name="back_gesture_spoken_intro_subtitle">To go back to the last screen, swipe with 2 fingers 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>
|
<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] -->
|
<!-- Feedback shown during interactive parts of Home gesture tutorial when the Overview gesture is detected. [CHAR LIMIT=100] -->
|
||||||
@@ -123,6 +125,8 @@
|
|||||||
<string name="home_gesture_intro_title">Swipe to go home</string>
|
<string name="home_gesture_intro_title">Swipe to go home</string>
|
||||||
<!-- Introduction subtitle for the Home gesture tutorial. [CHAR LIMIT=100] -->
|
<!-- Introduction subtitle for the Home gesture tutorial. [CHAR LIMIT=100] -->
|
||||||
<string name="home_gesture_intro_subtitle">Swipe up from the bottom of your screen. This gesture always takes you to the Home screen.</string>
|
<string name="home_gesture_intro_subtitle">Swipe up from the bottom of your screen. This gesture always takes you to the Home screen.</string>
|
||||||
|
<!-- Introduction subtitle for the Home gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=100] -->
|
||||||
|
<string name="home_gesture_spoken_intro_subtitle">Swipe up with 2 fingers from the bottom of the screen. This gesture always takes you to the Home screen.</string>
|
||||||
|
|
||||||
<!-- Feedback shown during interactive parts of Overview gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
|
<!-- Feedback shown during interactive parts of Overview gesture tutorial when the gesture is started too far from the edge. [CHAR LIMIT=100] -->
|
||||||
<string name="overview_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up from the bottom edge of the screen.</string>
|
<string name="overview_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe up from the bottom edge of the screen.</string>
|
||||||
@@ -138,6 +142,8 @@
|
|||||||
<string name="overview_gesture_intro_title">Swipe to switch apps</string>
|
<string name="overview_gesture_intro_title">Swipe to switch apps</string>
|
||||||
<!-- Introduction subtitle for the Overview gesture tutorial. [CHAR LIMIT=100] -->
|
<!-- Introduction subtitle for the Overview gesture tutorial. [CHAR LIMIT=100] -->
|
||||||
<string name="overview_gesture_intro_subtitle">To switch between apps, 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>
|
||||||
|
<!-- Introduction subtitle for the Overview gesture tutorial that will be spoken by screen readers. [CHAR LIMIT=100] -->
|
||||||
|
<string name="overview_gesture_spoken_intro_subtitle">To switch between apps, swipe up with 2 fingers from the bottom of your screen, hold, then release.</string>
|
||||||
|
|
||||||
<!-- Title shown during interactive part of Assistant gesture tutorial. [CHAR LIMIT=30] -->
|
<!-- Title shown during interactive part of Assistant gesture tutorial. [CHAR LIMIT=30] -->
|
||||||
<string name="assistant_gesture_tutorial_playground_title" translatable="false">Tutorial: Assistant</string>
|
<string name="assistant_gesture_tutorial_playground_title" translatable="false">Tutorial: Assistant</string>
|
||||||
|
|||||||
@@ -33,17 +33,22 @@ final class BackGestureTutorialController extends TutorialController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionTitle() {
|
public int getIntroductionTitle() {
|
||||||
return R.string.back_gesture_intro_title;
|
return R.string.back_gesture_intro_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionSubtitle() {
|
public int getIntroductionSubtitle() {
|
||||||
return R.string.back_gesture_intro_subtitle;
|
return R.string.back_gesture_intro_subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getSuccessFeedbackSubtitle() {
|
public int getSpokenIntroductionSubtitle() {
|
||||||
|
return R.string.back_gesture_spoken_intro_subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSuccessFeedbackSubtitle() {
|
||||||
return mTutorialFragment.isAtFinalStep()
|
return mTutorialFragment.isAtFinalStep()
|
||||||
? R.string.back_gesture_feedback_complete_without_follow_up
|
? R.string.back_gesture_feedback_complete_without_follow_up
|
||||||
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
|
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
|
||||||
|
|||||||
@@ -32,17 +32,22 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionTitle() {
|
public int getIntroductionTitle() {
|
||||||
return R.string.home_gesture_intro_title;
|
return R.string.home_gesture_intro_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionSubtitle() {
|
public int getIntroductionSubtitle() {
|
||||||
return R.string.home_gesture_intro_subtitle;
|
return R.string.home_gesture_intro_subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getSuccessFeedbackSubtitle() {
|
public int getSpokenIntroductionSubtitle() {
|
||||||
|
return R.string.home_gesture_spoken_intro_subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSuccessFeedbackSubtitle() {
|
||||||
return mTutorialFragment.isAtFinalStep()
|
return mTutorialFragment.isAtFinalStep()
|
||||||
? R.string.home_gesture_feedback_complete_without_follow_up
|
? R.string.home_gesture_feedback_complete_without_follow_up
|
||||||
: R.string.home_gesture_feedback_complete_with_follow_up;
|
: R.string.home_gesture_feedback_complete_with_follow_up;
|
||||||
|
|||||||
+8
-3
@@ -42,17 +42,22 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionTitle() {
|
public int getIntroductionTitle() {
|
||||||
return R.string.overview_gesture_intro_title;
|
return R.string.overview_gesture_intro_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getIntroductionSubtitle() {
|
public int getIntroductionSubtitle() {
|
||||||
return R.string.overview_gesture_intro_subtitle;
|
return R.string.overview_gesture_intro_subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getSuccessFeedbackSubtitle() {
|
public int getSpokenIntroductionSubtitle() {
|
||||||
|
return R.string.overview_gesture_spoken_intro_subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSuccessFeedbackSubtitle() {
|
||||||
return mTutorialFragment.getNumSteps() > 1 && mTutorialFragment.isAtFinalStep()
|
return mTutorialFragment.getNumSteps() > 1 && mTutorialFragment.isAtFinalStep()
|
||||||
? R.string.overview_gesture_feedback_complete_with_follow_up
|
? R.string.overview_gesture_feedback_complete_with_follow_up
|
||||||
: R.string.overview_gesture_feedback_complete_without_follow_up;
|
: R.string.overview_gesture_feedback_complete_without_follow_up;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ import java.util.ArrayList;
|
|||||||
abstract class TutorialController implements BackGestureAttemptCallback,
|
abstract class TutorialController implements BackGestureAttemptCallback,
|
||||||
NavBarGestureAttemptCallback {
|
NavBarGestureAttemptCallback {
|
||||||
|
|
||||||
private static final String TAG = "TutorialController";
|
private static final String LOG_TAG = "TutorialController";
|
||||||
|
|
||||||
private static final float FINGER_DOT_VISIBLE_ALPHA = 0.7f;
|
private static final float FINGER_DOT_VISIBLE_ALPHA = 0.7f;
|
||||||
private static final float FINGER_DOT_SMALL_SCALE = 0.7f;
|
private static final float FINGER_DOT_SMALL_SCALE = 0.7f;
|
||||||
@@ -217,18 +217,23 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
public Integer getIntroductionTitle() {
|
public int getIntroductionTitle() {
|
||||||
return null;
|
return NO_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
public Integer getIntroductionSubtitle() {
|
public int getIntroductionSubtitle() {
|
||||||
return null;
|
return NO_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
public Integer getSuccessFeedbackSubtitle() {
|
public int getSpokenIntroductionSubtitle() {
|
||||||
return null;
|
return NO_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
public int getSuccessFeedbackSubtitle() {
|
||||||
|
return NO_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showFeedback() {
|
void showFeedback() {
|
||||||
@@ -247,7 +252,16 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
* Show feedback reflecting a successful gesture attempt.
|
* Show feedback reflecting a successful gesture attempt.
|
||||||
**/
|
**/
|
||||||
void showSuccessFeedback() {
|
void showSuccessFeedback() {
|
||||||
showFeedback(getSuccessFeedbackSubtitle(), true);
|
int successSubtitleResId = getSuccessFeedbackSubtitle();
|
||||||
|
if (successSubtitleResId == NO_ID) {
|
||||||
|
// Allow crash since this should never be reached with a tutorial controller used in
|
||||||
|
// production.
|
||||||
|
Log.e(LOG_TAG,
|
||||||
|
"Cannot show success feedback for tutorial step: " + mTutorialType
|
||||||
|
+ ", no success feedback subtitle",
|
||||||
|
new IllegalStateException());
|
||||||
|
}
|
||||||
|
showFeedback(successSubtitleResId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,6 +283,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
isGestureSuccessful
|
isGestureSuccessful
|
||||||
? R.string.gesture_tutorial_nice : R.string.gesture_tutorial_try_again,
|
? R.string.gesture_tutorial_nice : R.string.gesture_tutorial_try_again,
|
||||||
subtitleResId,
|
subtitleResId,
|
||||||
|
NO_ID,
|
||||||
isGestureSuccessful,
|
isGestureSuccessful,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
@@ -276,6 +291,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
void showFeedback(
|
void showFeedback(
|
||||||
int titleResId,
|
int titleResId,
|
||||||
int subtitleResId,
|
int subtitleResId,
|
||||||
|
int spokenSubtitleResId,
|
||||||
boolean isGestureSuccessful,
|
boolean isGestureSuccessful,
|
||||||
boolean useGestureAnimationDelay) {
|
boolean useGestureAnimationDelay) {
|
||||||
mFeedbackTitleView.removeCallbacks(mTitleViewCallback);
|
mFeedbackTitleView.removeCallbacks(mTitleViewCallback);
|
||||||
@@ -287,7 +303,10 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
mFeedbackTitleView.setText(titleResId);
|
mFeedbackTitleView.setText(titleResId);
|
||||||
TextView subtitle =
|
TextView subtitle =
|
||||||
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
|
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
|
||||||
subtitle.setText(subtitleResId);
|
subtitle.setText(spokenSubtitleResId == NO_ID
|
||||||
|
? mContext.getText(subtitleResId)
|
||||||
|
: Utilities.wrapForTts(
|
||||||
|
mContext.getText(subtitleResId), mContext.getString(spokenSubtitleResId)));
|
||||||
if (isGestureSuccessful) {
|
if (isGestureSuccessful) {
|
||||||
if (mTutorialFragment.isAtFinalStep()) {
|
if (mTutorialFragment.isAtFinalStep()) {
|
||||||
showActionButton();
|
showActionButton();
|
||||||
@@ -580,7 +599,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
packageManager.getApplicationInfo(
|
packageManager.getApplicationInfo(
|
||||||
PIXEL_TIPS_APP_PACKAGE_NAME, PackageManager.GET_META_DATA));
|
PIXEL_TIPS_APP_PACKAGE_NAME, PackageManager.GET_META_DATA));
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(TAG,
|
Log.e(LOG_TAG,
|
||||||
"Could not find app label for package name: "
|
"Could not find app label for package name: "
|
||||||
+ PIXEL_TIPS_APP_PACKAGE_NAME
|
+ PIXEL_TIPS_APP_PACKAGE_NAME
|
||||||
+ ". Defaulting to 'Pixel Tips.'",
|
+ ". Defaulting to 'Pixel Tips.'",
|
||||||
@@ -593,7 +612,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
subtitleTextView.setText(
|
subtitleTextView.setText(
|
||||||
mContext.getString(R.string.skip_tutorial_dialog_subtitle, tipsAppName));
|
mContext.getString(R.string.skip_tutorial_dialog_subtitle, tipsAppName));
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "No subtitle view in the skip tutorial dialog to update.");
|
Log.w(LOG_TAG, "No subtitle view in the skip tutorial dialog to update.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Button cancelButton = (Button) contentView.findViewById(
|
Button cancelButton = (Button) contentView.findViewById(
|
||||||
@@ -602,7 +621,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
cancelButton.setOnClickListener(
|
cancelButton.setOnClickListener(
|
||||||
v -> tutorialDialog.dismiss());
|
v -> tutorialDialog.dismiss());
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "No cancel button in the skip tutorial dialog to update.");
|
Log.w(LOG_TAG, "No cancel button in the skip tutorial dialog to update.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Button confirmButton = contentView.findViewById(
|
Button confirmButton = contentView.findViewById(
|
||||||
@@ -613,7 +632,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||||||
tutorialDialog.dismiss();
|
tutorialDialog.dismiss();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "No confirm button in the skip tutorial dialog to update.");
|
Log.w(LOG_TAG, "No confirm button in the skip tutorial dialog to update.");
|
||||||
}
|
}
|
||||||
|
|
||||||
tutorialDialog.getWindow().setBackgroundDrawable(
|
tutorialDialog.getWindow().setBackgroundDrawable(
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.quickstep.interaction;
|
package com.android.quickstep.interaction;
|
||||||
|
|
||||||
|
import static android.view.View.NO_ID;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -211,13 +213,31 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||||||
if (isGestureComplete()) {
|
if (isGestureComplete()) {
|
||||||
mTutorialController.showSuccessFeedback();
|
mTutorialController.showSuccessFeedback();
|
||||||
} else if (!mIntroductionShown) {
|
} else if (!mIntroductionShown) {
|
||||||
Integer introTileStringResId = mTutorialController.getIntroductionTitle();
|
int introTitleResId = mTutorialController.getIntroductionTitle();
|
||||||
Integer introSubtitleResId = mTutorialController.getIntroductionSubtitle();
|
int introSubtitleResId = mTutorialController.getIntroductionSubtitle();
|
||||||
if (introTileStringResId != null && introSubtitleResId != null) {
|
if (introTitleResId == NO_ID) {
|
||||||
mTutorialController.showFeedback(
|
// Allow crash since this should never be reached with a tutorial controller used in
|
||||||
introTileStringResId, introSubtitleResId, false, true);
|
// production.
|
||||||
mIntroductionShown = true;
|
Log.e(LOG_TAG,
|
||||||
|
"Cannot show introduction feedback for tutorial step: " + mTutorialType
|
||||||
|
+ ", no introduction feedback title",
|
||||||
|
new IllegalStateException());
|
||||||
}
|
}
|
||||||
|
if (introTitleResId == NO_ID) {
|
||||||
|
// Allow crash since this should never be reached with a tutorial controller used in
|
||||||
|
// production.
|
||||||
|
Log.e(LOG_TAG,
|
||||||
|
"Cannot show introduction feedback for tutorial step: " + mTutorialType
|
||||||
|
+ ", no introduction feedback subtitle",
|
||||||
|
new IllegalStateException());
|
||||||
|
}
|
||||||
|
mTutorialController.showFeedback(
|
||||||
|
introTitleResId,
|
||||||
|
introSubtitleResId,
|
||||||
|
mTutorialController.getSpokenIntroductionSubtitle(),
|
||||||
|
false,
|
||||||
|
true);
|
||||||
|
mIntroductionShown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user