Loading quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java +2 −9 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ public class GestureSandboxActivity extends FragmentActivity { @Nullable private TutorialType[] mTutorialSteps; private GestureSandboxFragment mCurrentFragment; private GestureSandboxFragment mPendingFragment; private int mCurrentStep; private int mNumSteps; Loading Loading @@ -177,22 +176,16 @@ public class GestureSandboxActivity extends FragmentActivity { && getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; GestureSandboxFragment recreatedFragment = showRotationPrompt || mPendingFragment == null ? null : mPendingFragment.recreateFragment(); showFragment(showRotationPrompt ? new RotationPromptFragment() : recreatedFragment == null ? mCurrentFragment : recreatedFragment); : mCurrentFragment.canRecreateFragment() ? mCurrentFragment.recreateFragment() : mCurrentFragment); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } private void showFragment(@NonNull GestureSandboxFragment fragment) { if (mCurrentFragment.recreateFragment() != null) { mPendingFragment = mCurrentFragment; } mCurrentFragment = fragment; getSupportFragmentManager().beginTransaction() .replace(R.id.gesture_tutorial_fragment_container, mCurrentFragment) Loading quickstep/src/com/android/quickstep/interaction/GestureSandboxFragment.java +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ public abstract class GestureSandboxFragment extends Fragment { void onDetachedFromWindow() {} boolean canRecreateFragment() { return false; } @Nullable GestureSandboxFragment recreateFragment() { return null; Loading quickstep/src/com/android/quickstep/interaction/MenuFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ public final class MenuFragment extends GestureSandboxFragment { return new MenuFragment(); } @Override boolean canRecreateFragment() { return true; } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Loading quickstep/src/com/android/quickstep/interaction/TutorialFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,11 @@ abstract class TutorialFragment extends GestureSandboxFragment implements OnTouc return newInstance(tutorialType, isGestureComplete(), mFromTutorialMenu); } @Override boolean canRecreateFragment() { return true; } @NonNull abstract TutorialType getDefaultTutorialType(); Loading Loading
quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java +2 −9 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ public class GestureSandboxActivity extends FragmentActivity { @Nullable private TutorialType[] mTutorialSteps; private GestureSandboxFragment mCurrentFragment; private GestureSandboxFragment mPendingFragment; private int mCurrentStep; private int mNumSteps; Loading Loading @@ -177,22 +176,16 @@ public class GestureSandboxActivity extends FragmentActivity { && getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; GestureSandboxFragment recreatedFragment = showRotationPrompt || mPendingFragment == null ? null : mPendingFragment.recreateFragment(); showFragment(showRotationPrompt ? new RotationPromptFragment() : recreatedFragment == null ? mCurrentFragment : recreatedFragment); : mCurrentFragment.canRecreateFragment() ? mCurrentFragment.recreateFragment() : mCurrentFragment); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } private void showFragment(@NonNull GestureSandboxFragment fragment) { if (mCurrentFragment.recreateFragment() != null) { mPendingFragment = mCurrentFragment; } mCurrentFragment = fragment; getSupportFragmentManager().beginTransaction() .replace(R.id.gesture_tutorial_fragment_container, mCurrentFragment) Loading
quickstep/src/com/android/quickstep/interaction/GestureSandboxFragment.java +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ public abstract class GestureSandboxFragment extends Fragment { void onDetachedFromWindow() {} boolean canRecreateFragment() { return false; } @Nullable GestureSandboxFragment recreateFragment() { return null; Loading
quickstep/src/com/android/quickstep/interaction/MenuFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ public final class MenuFragment extends GestureSandboxFragment { return new MenuFragment(); } @Override boolean canRecreateFragment() { return true; } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Loading
quickstep/src/com/android/quickstep/interaction/TutorialFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,11 @@ abstract class TutorialFragment extends GestureSandboxFragment implements OnTouc return newInstance(tutorialType, isGestureComplete(), mFromTutorialMenu); } @Override boolean canRecreateFragment() { return true; } @NonNull abstract TutorialType getDefaultTutorialType(); Loading