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

Commit e2711c25 authored by Saumya Prakash's avatar Saumya Prakash
Browse files

Enforce the correct orientation for the gesture navigation tutorial

The lottie animations used for the gesture navigation tutorial are
designed for specific orientations depending on the device. This change
ensures that users are in the correct orientation for their device. For large screen users in portrait mode, we display a prompt to rotate the screen.

Flag: ENABLE_NEW_GESTURE_TUTORIAL
Fix: 277781713
Bug: 276515961
Test: Manually went through the tutorial starting from both
orientations on handheld, foldable, and tablet to ensure that the prompt
was shown and hidden correctly. Also ensured that gestures cannot be
completed in the background while the prompt is being shown.

Change-Id: I86ae566721f240264177ad4ec7fc12e58d1b95cd
parent 59ec439e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -104,7 +104,8 @@
            android:autoRemoveFromRecents="true"
            android:excludeFromRecents="true"
            android:theme="@style/GestureTutorialActivity"
            android:exported="true">
            android:exported="true"
            android:configChanges="orientation">
            <intent-filter>
                <action android:name="com.android.quickstep.action.GESTURE_SANDBOX"/>
                <category android:name="android.intent.category.DEFAULT"/>
+21 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2023 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.
-->
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="?attr/surfaceContainer" />
    <corners android:radius="@dimen/gesture_tutorial_menu_button_radius" />
</shape>
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2023 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:width="32dp"
    android:height="32dp"
    android:tint="?attr/colorControlNormal"
    android:viewportHeight="960"
    android:viewportWidth="960">
    <path
        android:fillColor="?androidprv:attr/materialColorOnSurface"
        android:pathData="M40,840L480,80L920,840L40,840ZM178,760L782,760L480,240L178,760ZM480,720Q497,720 508.5,708.5Q520,697 520,680Q520,663 508.5,651.5Q497,640 480,640Q463,640 451.5,651.5Q440,663 440,680Q440,697 451.5,708.5Q463,720 480,720ZM440,600L520,600L520,400L440,400L440,600ZM480,500L480,500L480,500L480,500Z" />
</vector>
+76 −3
Original line number Diff line number Diff line
@@ -13,7 +13,80 @@
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/gesture_tutorial_fragment_container"
        android:layout_width="match_parent"
    android:layout_height="match_parent"/>
 No newline at end of file
        android:layout_height="match_parent"

        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <RelativeLayout
        android:id="@+id/rotation_prompt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?attr/surfaceHome"
        android:visibility="gone"

        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/background"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:background="@drawable/rotate_prompt_bg"
            android:padding="24dp">

            <ImageView
                android:id="@+id/icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/rotate_tutorial_warning"

                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintEnd_toEndOf="parent" />

            <TextView
                android:id="@+id/rotate_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:lineSpacingExtra="2sp"
                android:text="@string/gesture_tutorial_rotation_prompt_title"
                android:textAppearance="@style/rotate_prompt_title"

                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/icon"
                app:layout_constraintEnd_toEndOf="parent" />

            <TextView
                android:id="@+id/rotate_screen_subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:gravity="center"
                android:text="@string/gesture_tutorial_rotation_prompt"
                android:textAppearance="@style/rotate_prompt_subtitle"

                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/rotate_title"
                app:layout_constraintEnd_toEndOf="parent" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </RelativeLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,10 @@
    <!-- content description for hotseat items -->
    <string name="hotseat_prediction_content_description">Predicted app: <xliff:g id="title" example="Chrome">%1$s</xliff:g></string>

    <!-- Title of prompt shown before the gesture navigation tutorial to users who need to rotate their screen. [CHAR LIMIT=100] -->
    <string name="gesture_tutorial_rotation_prompt_title">Rotate your device</string>
    <!-- Prompt shown before the gesture navigation tutorial to users who need to rotate their screen to begin. [CHAR LIMIT=100] -->
    <string name="gesture_tutorial_rotation_prompt">Please rotate your device to complete the gesture navigation tutorial</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
    <string name="back_gesture_feedback_swipe_too_far_from_edge">Make sure you swipe from the far-right or far-left edge.</string>
    <!-- Feedback shown during interactive parts of Back gesture tutorial for right edge when the gesture is cancelled. [CHAR LIMIT=100] -->
Loading