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

Commit 33b0d91d authored by Fan Zhang's avatar Fan Zhang
Browse files

Add video to each gesture preference screen.

- Refactor GesturePreference to a generic VideoPreference.
- The old video_preference.xml is only for magnification video, so
  renamed.
- And use VideoPreference in gesture setting pages.
- Refactor common logic into GesturePreferenceController.

Bug: 32637613
Test: RunSettingsRoboTests

Change-Id: I58580b01a32873cb32c5dc5bf2ec021d5b1400cc
parent 0d38cea6
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/video_background"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/accessibility_screen_magnification_background"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"
        android:importantForAccessibility="noHideDescendants" />

    <VideoView
        android:id="@+id/video"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/video_background"
        android:layout_centerHorizontal="true"
        android:importantForAccessibility="noHideDescendants" />

</RelativeLayout>
 No newline at end of file
+48 −29
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
<!--
  Copyright (C) 2016 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.
@@ -13,26 +14,44 @@
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<RelativeLayout
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gesture_animation_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:background="@color/gestures_setting_background_color"
    android:clipToPadding="false"
    android:gravity="center"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:orientation="horizontal">

    <com.android.settings.widget.AspectRatioFrameLayout
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:padding="@dimen/gesture_animation_padding">

        <TextureView
            android:id="@+id/video_texture_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"/>

        <ImageView
        android:id="@+id/video_background"
            android:id="@+id/video_preview_image"
            android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/accessibility_screen_magnification_background"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"
        android:importantForAccessibility="noHideDescendants" />

    <VideoView
        android:id="@+id/video"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/video_background"
        android:layout_centerHorizontal="true"
        android:importantForAccessibility="noHideDescendants" />
            android:layout_height="match_parent"
            android:scaleType="fitXY"/>

        <ImageView
            android:id="@+id/video_play_button"
            android:layout_width="@dimen/gestures_play_button_size"
            android:layout_height="@dimen/gestures_play_button_size"
            android:src="@drawable/ic_gesture_play_button"
            android:gravity="center"
            android:layout_gravity="center"/>

    </com.android.settings.widget.AspectRatioFrameLayout>

</LinearLayout>
</RelativeLayout>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -142,6 +142,11 @@
        <attr name="preview" format="reference" />
    </declare-styleable>

    <declare-styleable name="VideoPreference">
        <attr name="animation" format="reference" />
        <attr name="preview" format="reference" />
    </declare-styleable>

    <!-- For AspectRatioFrameLayout -->
    <declare-styleable name="AspectRatioFrameLayout">
        <attr name="aspectRatio" format="float" />
+7 −1
Original line number Diff line number Diff line
@@ -15,7 +15,13 @@
  limitations under the License.
  -->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.android.settings.widget.VideoPreference
        android:key="gesture_double_tap_power_video"
        app:animation="@raw/gesture_double_tap"
        app:preview="@drawable/gesture_double_tap"/>

    <SwitchPreference
        android:key="gesture_double_tap_power"
+7 −1
Original line number Diff line number Diff line
@@ -15,7 +15,13 @@
  limitations under the License.
  -->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.android.settings.widget.VideoPreference
        android:key="gesture_double_tap_screen_video"
        app:animation="@raw/gesture_ambient_tap"
        app:preview="@drawable/gesture_ambient_tap"/>

    <SwitchPreference
        android:key="gesture_double_tap_screen"
Loading