Adds dummy HomeGestureTutorialFragment.
- Adds a new launch target in Dev options - Moves Back handling to the parent TutorialFragment (so all Tutorials can handle it as necessary) - Currently uses a dummy translating rectangle in place of a proper hand animation - No actual home gesture recognition is in place yet Test: Manual Bug: 148542211 Change-Id: Ic5a545eb9f5003914803272c8ffe367220d63336
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep.interaction;
|
||||
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.HOME_NAVIGATION_COMPLETE;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
|
||||
|
||||
/** A {@link TutorialController} for the Home tutorial. */
|
||||
final class HomeGestureTutorialController extends TutorialController {
|
||||
|
||||
HomeGestureTutorialController(HomeGestureTutorialFragment fragment, TutorialType tutorialType) {
|
||||
super(fragment, tutorialType);
|
||||
}
|
||||
|
||||
@Override
|
||||
void transitToController() {
|
||||
super.transitToController();
|
||||
if (mTutorialType != HOME_NAVIGATION_COMPLETE) {
|
||||
mHandCoachingAnimation.startLoopedAnimation(mTutorialType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
Integer getTitleStringId() {
|
||||
switch (mTutorialType) {
|
||||
case HOME_NAVIGATION:
|
||||
return R.string.home_gesture_tutorial_playground_title;
|
||||
case HOME_NAVIGATION_COMPLETE:
|
||||
return R.string.gesture_tutorial_confirm_title;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
Integer getSubtitleStringId() {
|
||||
if (mTutorialType == TutorialType.HOME_NAVIGATION) {
|
||||
return R.string.home_gesture_tutorial_playground_subtitle;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
Integer getActionButtonStringId() {
|
||||
if (mTutorialType == HOME_NAVIGATION_COMPLETE) {
|
||||
return R.string.gesture_tutorial_action_button_label;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
void onActionButtonClicked(View button) {
|
||||
mTutorialFragment.closeTutorial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackGestureAttempted(BackGestureResult result) {
|
||||
switch (mTutorialType) {
|
||||
case HOME_NAVIGATION:
|
||||
break;
|
||||
case HOME_NAVIGATION_COMPLETE:
|
||||
if (result == BackGestureResult.BACK_COMPLETED_FROM_LEFT
|
||||
|| result == BackGestureResult.BACK_COMPLETED_FROM_RIGHT) {
|
||||
mTutorialFragment.closeTutorial();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user