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

Commit 5db396ab authored by David Liu's avatar David Liu Committed by Android (Google) Code Review
Browse files

Merge "[Expressive design] create SliderPreference" into main

parents db6bcea4 2d38fe44
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ android_library {
        "SettingsLibSelectorWithWidgetPreference",
        "SettingsLibSettingsSpinner",
        "SettingsLibSettingsTransition",
        "SettingsLibSliderPreference",
        "SettingsLibTopIntroPreference",
        "SettingsLibTwoTargetPreference",
        "SettingsLibUsageProgressBarPreference",
+31 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_library {
    name: "SettingsLibSliderPreference",
    use_resource_processor: true,
    defaults: [
        "SettingsLintDefaults",
    ],

    srcs: ["src/**/*.java"],
    resource_dirs: ["res"],

    static_libs: [
        "androidx.annotation_annotation",
        "androidx.preference_preference",
        "SettingsLibSettingsTheme",
    ],

    sdk_version: "system_current",
    min_sdk_version: "23",
    apex_available: [
        "//apex_available:platform",
    ],
}
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.settingslib.widget.preference.slider">

    <uses-sdk android:minSdkVersion="23" />

</manifest>
+70 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2024 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:clipChildren="false"
    android:gravity="center_vertical">

    <FrameLayout
        android:id="@+id/icon_start_frame"
        android:layout_width="@dimen/settingslib_expressive_space_medium4"
        android:layout_height="@dimen/settingslib_expressive_space_medium4"
        android:clipChildren="false"
        android:focusable="true"
        android:visibility="gone">

        <ImageView
            android:id="@+id/icon_start"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:adjustViewBounds="true"
            android:focusable="false"
            android:tint="?android:attr/textColorPrimary"
            android:tintMode="src_in" />
    </FrameLayout>

    <com.google.android.material.slider.Slider
        android:id="@+id/slider"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:theme="@style/Theme.MaterialComponents.DayNight" />

    <FrameLayout
        android:id="@+id/icon_end_frame"
        android:layout_width="@dimen/settingslib_expressive_space_medium4"
        android:layout_height="@dimen/settingslib_expressive_space_medium4"
        android:clipChildren="false"
        android:focusable="true"
        android:visibility="gone">

        <ImageView
            android:id="@+id/icon_end"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:adjustViewBounds="true"
            android:focusable="false"
            android:tint="?android:attr/textColorPrimary"
            android:tintMode="src_in" />
    </FrameLayout>
</LinearLayout>
+99 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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:gravity="center_vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:orientation="horizontal"
    android:background="?android:attr/selectableItemBackground"
    android:clipToPadding="false"
    android:baselineAligned="false">

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

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:paddingVertical="@dimen/settingslib_expressive_space_small1">

        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
            android:textAppearance="?android:attr/textAppearanceListItem"
            android:maxLines="2"
            android:ellipsize="marquee"/>

        <TextView
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
            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="?android:attr/textAppearanceListItemSecondary"
            android:textColor="?android:attr/textColorSecondary"
            android:maxLines="10"/>

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

        <LinearLayout
            android:id="@+id/label_frame"
            android:layout_width="match_parent"
            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="?android:attr/textAppearanceSmall"
                android:textColor="?android:attr/textColorSecondary"
                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="?android:attr/textAppearanceSmall"
                android:textColor="?android:attr/textColorSecondary"
                android:gravity="end"
                android:layout_weight="1"/>
        </LinearLayout>

    </RelativeLayout>
</LinearLayout>
 No newline at end of file
Loading