1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.quickstep.interaction; 17 18 import android.app.Activity; 19 20 import androidx.annotation.Nullable; 21 import androidx.fragment.app.Fragment; 22 import androidx.fragment.app.FragmentActivity; 23 24 /** Displays one page of the gesture nav tutorial. */ 25 public abstract class GestureSandboxFragment extends Fragment { 26 onAttachedToWindow()27 void onAttachedToWindow() {} 28 onDetachedFromWindow()29 void onDetachedFromWindow() {} 30 canRecreateFragment()31 boolean canRecreateFragment() { 32 return false; 33 } 34 35 @Nullable recreateFragment()36 GestureSandboxFragment recreateFragment() { 37 return null; 38 } 39 shouldDisableSystemGestures()40 boolean shouldDisableSystemGestures() { 41 return true; 42 } 43 close()44 void close() { 45 FragmentActivity activity = getActivity(); 46 if (activity != null) { 47 activity.setResult(Activity.RESULT_OK); 48 activity.finish(); 49 } 50 } 51 } 52