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

Commit 81b70eae authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update gesture navigation intent tutorial steps handling" into sc-dev am: c20f6b52

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15082876

Change-Id: Ic171072979dd5865f63cd46d2221dba27bf51243
parents 5c68d6e0 c20f6b52
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.quickstep.interaction;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
@@ -141,21 +142,33 @@ public class GestureSandboxActivity extends FragmentActivity {

    private TutorialType[] getTutorialSteps(Bundle extras) {
        TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
        mCurrentStep = 1;
        mNumSteps = 1;

        if (extras == null || !extras.containsKey(KEY_TUTORIAL_STEPS)) {
            return defaultSteps;
        }

        String[] tutorialStepNames = extras.getStringArray(KEY_TUTORIAL_STEPS);
        Object savedSteps = extras.get(KEY_TUTORIAL_STEPS);
        int currentStep = extras.getInt(KEY_CURRENT_STEP, -1);
        String[] savedStepsNames;

        if (savedSteps instanceof String) {
            savedStepsNames = TextUtils.isEmpty((String) savedSteps)
                    ? null : ((String) savedSteps).split(",");
        } else if (savedSteps instanceof String[]) {
            savedStepsNames = (String[]) savedSteps;
        } else {
            return defaultSteps;
        }

        if (tutorialStepNames == null) {
        if (savedStepsNames == null) {
            return defaultSteps;
        }

        TutorialType[] tutorialSteps = new TutorialType[tutorialStepNames.length];
        for (int i = 0; i < tutorialStepNames.length; i++) {
            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);