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

Commit 2be72ae9 authored by Garvita Jain's avatar Garvita Jain Committed by Android (Google) Code Review
Browse files

Merge "Use Linear progress indicator in UsageProgressBarPreference" into main

parents 61a7063d f1c1b50f
Loading
Loading
Loading
Loading
+81 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:paddingBottom="@dimen/settingslib_expressive_space_small1">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/usage_summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBaseline_toBaselineOf="@id/total_summary"
            android:ellipsize="marquee"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
            android:textSize="14sp"
            android:textAlignment="viewStart"/>
        <TextView
            android:id="@+id/total_summary"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintStart_toEndOf="@id/usage_summary"
            app:layout_constraintEnd_toStartOf="@id/custom_content"
            android:ellipsize="marquee"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
            android:textSize="14sp"
            android:textAlignment="viewEnd"/>
        <FrameLayout
            android:id="@+id/custom_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="@id/total_summary"/>
    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.progressindicator.LinearProgressIndicator
        android:theme="@style/Theme.Material3.DynamicColors.DayNight"
        android:id="@android:id/progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:max="100"
        android:scaleY="1"
        app:trackThickness="@dimen/settingslib_expressive_space_small1"
        app:indicatorTrackGapSize="@dimen/settingslib_expressive_space_extrasmall2"
        style="@style/SettingsLibProgressBarStyle.Linear.Expressive" />

    <TextView
        android:id="@+id/bottom_summary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:visibility="gone"
        android:ellipsize="marquee"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
        android:textSize="14sp"/>
</LinearLayout>
+8 −2
Original line number Diff line number Diff line
@@ -64,7 +64,10 @@ public class UsageProgressBarPreference extends Preference implements GroupSecti
     */
    public UsageProgressBarPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        setLayoutResource(R.layout.preference_usage_progress_bar);
        int resId = SettingsThemeHelper.isExpressiveTheme(context)
                ? R.layout.preference_usage_progress_bar_expressive
                : R.layout.preference_usage_progress_bar;
        setLayoutResource(resId);
    }

    /**
@@ -76,7 +79,10 @@ public class UsageProgressBarPreference extends Preference implements GroupSecti
     */
    public UsageProgressBarPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        setLayoutResource(R.layout.preference_usage_progress_bar);
        int resId = SettingsThemeHelper.isExpressiveTheme(context)
                ? R.layout.preference_usage_progress_bar_expressive
                : R.layout.preference_usage_progress_bar;
        setLayoutResource(resId);
    }

    /**