Merge "Update gesture navigation intent tutorial steps handling" into sc-dev am: c20f6b52ab
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15082876 Change-Id: I456f09943cd468bd9844d8b98f218a180ddb169a
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.quickstep.interaction;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -122,9 +123,9 @@ public class GestureSandboxActivity extends FragmentActivity {
|
|||||||
mCurrentTutorialStep = mTutorialSteps[mCurrentStep];
|
mCurrentTutorialStep = mTutorialSteps[mCurrentStep];
|
||||||
mFragment = TutorialFragment.newInstance(mCurrentTutorialStep);
|
mFragment = TutorialFragment.newInstance(mCurrentTutorialStep);
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.replace(R.id.gesture_tutorial_fragment_container, mFragment)
|
.replace(R.id.gesture_tutorial_fragment_container, mFragment)
|
||||||
.runOnCommit(() -> mFragment.onAttachedToWindow())
|
.runOnCommit(() -> mFragment.onAttachedToWindow())
|
||||||
.commit();
|
.commit();
|
||||||
mCurrentStep++;
|
mCurrentStep++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,21 +142,33 @@ public class GestureSandboxActivity extends FragmentActivity {
|
|||||||
|
|
||||||
private TutorialType[] getTutorialSteps(Bundle extras) {
|
private TutorialType[] getTutorialSteps(Bundle extras) {
|
||||||
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
|
TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
|
||||||
|
mCurrentStep = 1;
|
||||||
|
mNumSteps = 1;
|
||||||
|
|
||||||
if (extras == null || !extras.containsKey(KEY_TUTORIAL_STEPS)) {
|
if (extras == null || !extras.containsKey(KEY_TUTORIAL_STEPS)) {
|
||||||
return defaultSteps;
|
return defaultSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] tutorialStepNames = extras.getStringArray(KEY_TUTORIAL_STEPS);
|
Object savedSteps = extras.get(KEY_TUTORIAL_STEPS);
|
||||||
int currentStep = extras.getInt(KEY_CURRENT_STEP, -1);
|
int currentStep = extras.getInt(KEY_CURRENT_STEP, -1);
|
||||||
|
String[] savedStepsNames;
|
||||||
|
|
||||||
if (tutorialStepNames == null) {
|
if (savedSteps instanceof String) {
|
||||||
|
savedStepsNames = TextUtils.isEmpty((String) savedSteps)
|
||||||
|
? null : ((String) savedSteps).split(",");
|
||||||
|
} else if (savedSteps instanceof String[]) {
|
||||||
|
savedStepsNames = (String[]) savedSteps;
|
||||||
|
} else {
|
||||||
return defaultSteps;
|
return defaultSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
TutorialType[] tutorialSteps = new TutorialType[tutorialStepNames.length];
|
if (savedStepsNames == null) {
|
||||||
for (int i = 0; i < tutorialStepNames.length; i++) {
|
return defaultSteps;
|
||||||
tutorialSteps[i] = TutorialType.valueOf(tutorialStepNames[i]);
|
}
|
||||||
|
|
||||||
|
TutorialType[] tutorialSteps = new TutorialType[savedStepsNames.length];
|
||||||
|
for (int i = 0; i < savedStepsNames.length; i++) {
|
||||||
|
tutorialSteps[i] = TutorialType.valueOf(savedStepsNames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentStep = Math.max(currentStep, 1);
|
mCurrentStep = Math.max(currentStep, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user