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

Commit 4f66dc3b authored by Andy Wickham's avatar Andy Wickham
Browse files

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
parent 86932724
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
<!--
    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.
-->
<!-- Dummy translating rectangle until we have a proper animation. -->
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:aapt="http://schemas.android.com/aapt" >
  <aapt:attr name="android:drawable">
    <vector
        android:height="64dp"
        android:width="64dp"
        android:viewportHeight="600"
        android:viewportWidth="600" >
      <group
          android:name="translationGroup"
          android:pivotX="300.0"
          android:pivotY="300.0"
          android:rotation="180.0" >
        <path
            android:fillColor="#eeeeee"
            android:pathData="M300,70 l 0,-70 70,0  0,140 -70,0 z" />
      </group>
    </vector>
  </aapt:attr>

  <target android:name="translationGroup">
    <aapt:attr name="android:animation">
      <objectAnimator
          android:duration="3000"
          android:propertyName="translateY"
          android:valueFrom="0"
          android:valueTo="-100" />
    </aapt:attr>
  </target>
</animated-vector>
 No newline at end of file
+8 −2
Original line number Diff line number Diff line
@@ -104,11 +104,17 @@
    <!-- Subtitle shown during interactive parts of Back gesture tutorial for left edge. [CHAR LIMIT=60] -->
    <string name="back_gesture_tutorial_engaged_subtitle_swipe_inward_left_edge" translatable="false">That\'s it! Now try swiping from the left edge.</string>

    <!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
    <string name="back_gesture_tutorial_confirm_title" translatable="false">All set</string>
    <!-- Subtitle shown on the confirmation screen after successful gesture. [CHAR LIMIT=60] -->
    <string name="back_gesture_tutorial_confirm_subtitle" translatable="false">To change the sensitivity of the back gesture, go to Settings</string>


    <!-- Title shown during interactive part of Home gesture tutorial. [CHAR LIMIT=30] -->
    <string name="home_gesture_tutorial_playground_title" translatable="false">Tutorial: Go Home</string>
    <!-- Subtitle shown during interactive parts of Home gesture tutorial. [CHAR LIMIT=60] -->
    <string name="home_gesture_tutorial_playground_subtitle" translatable="false">Try swiping upward from the bottom edge of the screen</string>

  <!-- Title shown on the confirmation screen after successful gesture. [CHAR LIMIT=30] -->
  <string name="gesture_tutorial_confirm_title" translatable="false">All set</string>
    <!-- Button text shown on a button on the confirm screen. [CHAR LIMIT=14] -->
    <string name="gesture_tutorial_action_button_label" translatable="false">Done</string>
    <!-- Button text shown on a text button on the confirm screen. [CHAR LIMIT=14] -->
+7 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ final class BackGestureTutorialController extends TutorialController {
            case LEFT_EDGE_BACK_NAVIGATION:
                return R.string.back_gesture_tutorial_playground_title_swipe_inward_left_edge;
            case BACK_NAVIGATION_COMPLETE:
                return R.string.back_gesture_tutorial_confirm_title;
                return R.string.gesture_tutorial_confirm_title;
        }
        return null;
    }
@@ -82,10 +82,12 @@ final class BackGestureTutorialController extends TutorialController {

    @Override
    void onActionButtonClicked(View button) {
        hideHandCoachingAnimation();
        if (button == mActionTextButton) {
            mTutorialFragment.startSystemNavigationSetting();
        mTutorialFragment.closeTutorial();
    }

    @Override
    void onActionTextButtonClicked(View button) {
        mTutorialFragment.startSystemNavigationSetting();
        mTutorialFragment.closeTutorial();
    }

+1 −26
Original line number Diff line number Diff line
@@ -15,29 +15,11 @@
 */
package com.android.quickstep.interaction;

import android.os.Bundle;

import com.android.launcher3.R;
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureAttemptCallback;
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureResult;
import com.android.quickstep.interaction.TutorialController.TutorialType;

/** Shows the Back gesture interactive tutorial. */
public class BackGestureTutorialFragment extends TutorialFragment
        implements BackGestureAttemptCallback {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mEdgeBackGestureHandler.registerBackGestureAttemptCallback(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mEdgeBackGestureHandler.unregisterBackGestureAttemptCallback();
    }

public class BackGestureTutorialFragment extends TutorialFragment {
    @Override
    int getHandAnimationResId() {
        return R.drawable.back_gesture;
@@ -47,11 +29,4 @@ public class BackGestureTutorialFragment extends TutorialFragment
    TutorialController createController(TutorialType type) {
        return new BackGestureTutorialController(this, type);
    }

    @Override
    public void onBackGestureAttempted(BackGestureResult result) {
        if (mTutorialController != null) {
            mTutorialController.onBackGestureAttempted(result);
        }
    }
}
+16 −8
Original line number Diff line number Diff line
@@ -15,11 +15,12 @@
 */
package com.android.quickstep.interaction;

import static com.android.quickstep.interaction.TutorialFragment.KEY_TUTORIAL_TYPE;

import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.Window;
@@ -44,13 +45,7 @@ public class GestureSandboxActivity extends FragmentActivity {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.gesture_tutorial_activity);

        try {
            mFragment = TutorialFragment.newInstance(BackGestureTutorialFragment.class,
                    TutorialType.RIGHT_EDGE_BACK_NAVIGATION);
        } catch (InstantiationException | IllegalAccessException e) {
            Log.wtf(LOG_TAG, "Failed to create tutorial fragment!", e);
            mFragment = new BackGestureTutorialFragment();
        }
        mFragment = TutorialFragment.newInstance(getTutorialType(getIntent().getExtras()));
        getSupportFragmentManager().beginTransaction()
                .add(R.id.gesture_tutorial_fragment_container, mFragment)
                .commit();
@@ -77,6 +72,19 @@ public class GestureSandboxActivity extends FragmentActivity {
        }
    }

    private TutorialType getTutorialType(Bundle extras) {
        TutorialType defaultType = TutorialType.RIGHT_EDGE_BACK_NAVIGATION;

        if (extras == null || !extras.containsKey(KEY_TUTORIAL_TYPE)) {
            return defaultType;
        }
        try {
            return TutorialType.valueOf(extras.getString(KEY_TUTORIAL_TYPE, ""));
        } catch (IllegalArgumentException e) {
            return defaultType;
        }
    }

    private void hideSystemUI() {
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
Loading