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

Commit a628aa81 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add VolumeSliderPreference and SliderVolumizer" into main

parents 66977bcb cd3e8db0
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:gravity="center_vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:clickable="false"
    android:orientation="horizontal">

    <include layout="@layout/settingslib_icon_frame"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="16dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:id="@android:id/title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:singleLine="true"
                android:textAlignment="viewStart"
                android:textAppearance="?android:attr/textAppearanceListItem"
                android:ellipsize="marquee"
                android:fadingEdge="horizontal"/>
            <!-- Preference should place its actual preference widget here. -->
            <LinearLayout
                android:id="@android:id/widget_frame"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:gravity="end|center_vertical"
                android:paddingStart="12dp"
                android:orientation="vertical"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <SeekBar
                android:id="@*android:id/seekbar"
                android:layout_gravity="center_vertical"
                android:paddingStart="0dp"
                android:paddingEnd="12dp"
                android:layout_width="match_parent"
                android:layout_height="48dp"/>

            <TextView
                android:id="@+id/suppression_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start"
                android:textAlignment="viewStart"
                android:singleLine="true"
                android:ellipsize="end"
                android:visibility="gone"
                android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
                android:textColor="?android:attr/textColorSecondary"/>

        </LinearLayout>
    </LinearLayout>

</LinearLayout>
+103 −59
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
<!--
  Copyright (C) 2025 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.
@@ -16,72 +17,115 @@

<LinearLayout
    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="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:gravity="center_vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:clickable="false"
    android:orientation="horizontal">

    <include layout="@layout/settingslib_icon_frame"/>
    android:orientation="horizontal"
    android:background="?android:attr/selectableItemBackground"
    android:clipToPadding="false"
    android:baselineAligned="false">

    <LinearLayout
        android:layout_width="match_parent"
    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="16dp">
        android:layout_weight="1"
        android:paddingVertical="@dimen/settingslib_expressive_space_small1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <TextView
            android:id="@android:id/title"
                android:layout_width="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                android:layout_weight="1"
                android:singleLine="true"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
                android:textAppearance="?android:attr/textAppearanceListItem"
                android:ellipsize="marquee"
                android:fadingEdge="horizontal"/>
            <!-- Preference should place its actual preference widget here. -->
            <LinearLayout
                android:id="@android:id/widget_frame"
            android:textAppearance="@style/TextAppearance.SettingsLib.TitleMedium.Emphasized"
            android:textColor="@color/settingslib_text_color_primary"
            android:maxLines="2"
            android:ellipsize="marquee"/>

        <TextView
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:gravity="end|center_vertical"
                android:paddingStart="12dp"
                android:orientation="vertical"/>
        </LinearLayout>
            android:layout_height="wrap_content"
            android:layout_below="@android:id/title"
            android:layout_alignLeft="@android:id/title"
            android:layout_alignStart="@android:id/title"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
            android:textAppearance="@style/TextAppearance.SettingsLib.TitleMedium"
            android:textColor="@color/settingslib_text_color_secondary"
            android:maxLines="10"/>

        <LinearLayout
        <include
            layout="@layout/settingslib_expressive_layout_slider"
            android:id="@+id/slider_frame"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            android:layout_alignStart="@android:id/summary"
            android:layout_below="@android:id/summary"/>

            <SeekBar
                android:id="@*android:id/seekbar"
                android:layout_gravity="center_vertical"
                android:paddingStart="0dp"
                android:paddingEnd="12dp"
        <LinearLayout
            android:id="@+id/label_frame"
            android:layout_width="match_parent"
                android:layout_height="48dp"/>
            android:layout_height="wrap_content"
            android:layout_below="@id/slider_frame"
            android:orientation="horizontal"
            android:visibility="gone">

            <TextView
                android:id="@android:id/text1"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="start|top"
                android:textAppearance="@style/TextAppearance.SettingsLib.TitleMedium"
                android:textColor="@color/settingslib_text_color_secondary"
                android:gravity="start"
                android:layout_weight="1"/>

            <TextView
                android:id="@android:id/text2"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="end|top"
                android:textAppearance="@style/TextAppearance.SettingsLib.TitleMedium"
                android:textColor="@color/settingslib_text_color_secondary"
                android:gravity="end"
                android:layout_weight="1"/>
        </LinearLayout>

        <TextView
            android:id="@+id/suppression_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|start"
            android:layout_below="@id/label_frame"
            android:textAlignment="viewStart"
            android:singleLine="true"
            android:ellipsize="end"
            android:visibility="gone"
                android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
                android:textColor="?android:attr/textColorSecondary"/>
            android:textAppearance="@style/TextAppearance.SettingsLib.TitleMedium"
            android:textColor="@color/settingslib_text_color_secondary"/>

        </LinearLayout>
    </LinearLayout>
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/icon_frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="48dp"
        android:minHeight="48dp"
        android:gravity="center"
        android:orientation="horizontal">

        <ImageView
            android:id="@android:id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="fitCenter"
            app:maxWidth="48dp"
            app:maxHeight="48dp"/>

    </LinearLayout>
</LinearLayout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public class AudioSharingDeviceVolumePreference extends SeekBarPreference {
    public AudioSharingDeviceVolumePreference(
            Context context, @NonNull CachedBluetoothDevice device) {
        super(context);
        setLayoutResource(R.layout.preference_volume_slider);
        setLayoutResource(R.layout.preference_volume_seekbar);
        mContext = context;
        mCachedDevice = device;
        mBtManager = Utils.getLocalBtManager(mContext);
+4 −4
Original line number Diff line number Diff line
@@ -69,28 +69,28 @@ public class VolumeSeekBarPreference extends SeekBarPreference {
    public VolumeSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        setLayoutResource(R.layout.preference_volume_slider);
        setLayoutResource(R.layout.preference_volume_seekbar);
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mSeekBarVolumizerFactory = new SeekBarVolumizerFactory(context);
    }

    public VolumeSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setLayoutResource(R.layout.preference_volume_slider);
        setLayoutResource(R.layout.preference_volume_seekbar);
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mSeekBarVolumizerFactory = new SeekBarVolumizerFactory(context);
    }

    public VolumeSeekBarPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        setLayoutResource(R.layout.preference_volume_slider);
        setLayoutResource(R.layout.preference_volume_seekbar);
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mSeekBarVolumizerFactory = new SeekBarVolumizerFactory(context);
    }

    public VolumeSeekBarPreference(Context context) {
        super(context);
        setLayoutResource(R.layout.preference_volume_slider);
        setLayoutResource(R.layout.preference_volume_seekbar);
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        mSeekBarVolumizerFactory = new SeekBarVolumizerFactory(context);
    }
Loading