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

Commit 4d778077 authored by chihtinglo's avatar chihtinglo
Browse files

Style panel with Material designs (4/n)

The following components are styled to follow Material designs in this
modification:
1. Seekbar
   - Creating SeekBarWithIconButtonsView for common usage in SystemUI.
     The Layout includes a Start Icon and an End Icon that could modify
     the progress of the seekbar in the middle.
     The Start Icon will be disabled when the progress reaches 0, and
     the End Icon will be disabled when the progress reaches Max.
     Otherwise, they are enabled

Bug: 257272333
Test: manual - attach videos with the bug
Test: atest SystemUITests:com.android.systemui.common.ui.view.IconDiscreteSliderLinearLayoutTest
Change-Id: If64490a6bdc599c66ae55b8f75e438b11d7c1b54
parent 6a86f35a
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->

<merge xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
              android:id="@+id/seekbar_frame"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:clipChildren="false"
              android:gravity="center_vertical"
              android:orientation="horizontal"
              tools:parentTag="android.widget.LinearLayout">

    <ImageView
        android:id="@+id/icon_start"
        android:layout_width="@dimen/magnification_setting_seekbar_icon_size"
        android:layout_height="@dimen/magnification_setting_seekbar_icon_size"
        android:layout_gravity="center"
        android:background="?android:attr/selectableItemBackgroundBorderless"
        android:adjustViewBounds="true"
        android:focusable="true"
        android:src="@drawable/ic_remove"
        android:tint="?android:attr/textColorPrimary"
        android:tintMode="src_in" />

    <SeekBar
        android:id="@+id/seekbar"
        style="@android:style/Widget.Material.SeekBar.Discrete"
        android:layout_width="0dp"
        android:layout_height="48dp"
        android:layout_gravity="center_vertical"
        android:layout_weight="1" />

    <ImageView
        android:id="@+id/icon_end"
        android:layout_width="@dimen/magnification_setting_seekbar_icon_size"
        android:layout_height="@dimen/magnification_setting_seekbar_icon_size"
        android:layout_gravity="center"
        android:background="?android:attr/selectableItemBackgroundBorderless"
        android:adjustViewBounds="true"
        android:focusable="true"
        android:src="@drawable/ic_add"
        android:tint="?android:attr/textColorPrimary"
        android:tintMode="src_in" />

</merge>
+8 −6
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
    limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/magnifier_panel_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
@@ -145,13 +146,14 @@
        android:textAppearance="@style/TextAppearance.MagnificationSetting.Title"
        android:focusable="true" />

    <SeekBar
        android:id="@+id/magnifier_zoom_seekbar"
        android:layout_height="wrap_content"
    <com.android.systemui.common.ui.view.SeekBarWithIconButtonsView
        android:id="@+id/magnifier_zoom_slider"
        android:layout_width="match_parent"
        android:layout_marginTop="@dimen/magnification_setting_seekbar_margin"
        android:progress="0"
        android:max="6" />
        android:layout_height="wrap_content"
        app:max="6"
        app:progress="0"
        app:iconStartContentDescription="@string/accessibility_control_zoom_out"
        app:iconEndContentDescription="@string/accessibility_control_zoom_in"/>

    <Button
        android:id="@+id/magnifier_done_button"
+7 −0
Original line number Diff line number Diff line
@@ -219,5 +219,12 @@
        <attr name="biometricsEnrollProgressHelp" format="reference|color" />
        <attr name="biometricsEnrollProgressHelpWithTalkback" format="reference|color" />
    </declare-styleable>

    <declare-styleable name="SeekBarWithIconButtonsView_Layout">
        <attr name="max" format="integer" />
        <attr name="progress" format="integer" />
        <attr name="iconStartContentDescription" format="reference" />
        <attr name="iconEndContentDescription" format="reference" />
    </declare-styleable>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -1134,6 +1134,8 @@
    <dimen name="magnification_setting_image_button_padding_horizontal">24dp</dimen>
    <dimen name="magnification_setting_image_button_open_in_full_padding_vertical">16dp</dimen>
    <dimen name="magnification_setting_image_button_open_in_full_padding_horizontal">28dp</dimen>
    <dimen name="magnification_setting_seekbar_icon_size">24dp</dimen>


    <!-- How far from the right edge of the screen you need to drag the window before the button
         repositions to the other side. -->
+4 −2
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.widget.Switch;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.SfVsyncFrameCallbackProvider;
import com.android.systemui.R;
import com.android.systemui.common.ui.view.SeekBarWithIconButtonsView;
import com.android.systemui.util.settings.SecureSettings;

import java.lang.annotation.Retention;
@@ -79,7 +80,7 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
    private final MagnificationGestureDetector mGestureDetector;
    private boolean mSingleTapDetected = false;

    private SeekBar mZoomSeekbar;
    private SeekBarWithIconButtonsView mZoomSeekbar;
    private Switch mAllowDiagonalScrollingSwitch;
    private LinearLayout mPanelView;
    private LinearLayout mSettingView;
@@ -393,7 +394,8 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
        mEditButton = mSettingView.findViewById(R.id.magnifier_edit_button);
        mChangeModeButton = mSettingView.findViewById(R.id.magnifier_full_button);

        mZoomSeekbar = mSettingView.findViewById(R.id.magnifier_zoom_seekbar);
        mZoomSeekbar = mSettingView.findViewById(R.id.magnifier_zoom_slider);

        mZoomSeekbar.setOnSeekBarChangeListener(new ZoomSeekbarChangeListener());

        float scale = mSecureSettings.getFloatForUser(
Loading