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

Commit c6baa9b8 authored by Edgar Wang's avatar Edgar Wang Committed by Android (Google) Code Review
Browse files

Merge "[Expressive design] update UsageProgressBarPreference" into main

parents e608e21b c9b8155f
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        android:layout_height="wrap_content"
        android:paddingHorizontal="@dimen/settingslib_expressive_space_extrasmall4"
        android:paddingBottom="3dp">
        <TextView
            android:id="@+id/usage_summary"
            android:layout_width="wrap_content"
@@ -36,8 +38,8 @@
            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:textAppearance="@style/TextAppearance.SettingsLib.BodyMedium"
            android:textColor="@color/settingslib_materialColorOnSurface"
            android:textAlignment="viewStart"/>
        <TextView
            android:id="@+id/total_summary"
@@ -46,8 +48,8 @@
            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:textAppearance="@style/TextAppearance.SettingsLib.BodyMedium"
            android:textColor="@color/settingslib_materialColorOnSurface"
            android:textAlignment="viewEnd"/>
        <FrameLayout
            android:id="@+id/custom_content"
@@ -71,9 +73,10 @@
        android:id="@+id/bottom_summary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginHorizontal="@dimen/settingslib_expressive_space_extrasmall4"
        android:layout_marginTop="@dimen/settingslib_expressive_space_extrasmall4"
        android:visibility="gone"
        android:ellipsize="marquee"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
        android:textSize="14sp"/>
        android:textAppearance="@style/TextAppearance.SettingsLib.BodyMedium"
        android:textColor="@color/settingslib_materialColorOnSurface"/>
</LinearLayout>
+4 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.TextAppearanceSpan;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@@ -44,6 +44,8 @@ import java.util.regex.Pattern;
 */
public class UsageProgressBarPreference extends Preference implements GroupSectionDividerMixin {

    private static final int NUMBER_TEXT_APPEARANCE =
            com.android.settingslib.widget.theme.R.style.TextAppearance_SettingsLib_DisplayLarge_Emphasized;
    private final Pattern mNumberPattern = Pattern.compile("[\\d]*[\\٫.,]?[\\d]+");

    private CharSequence mUsageSummary;
@@ -224,7 +226,7 @@ public class UsageProgressBarPreference extends Preference implements GroupSecti
        if (matcher.find()) {
            final SpannableString spannableSummary = new SpannableString(summary);
            spannableSummary.setSpan(
                    new AbsoluteSizeSpan(64, true /* dip */),
                    new TextAppearanceSpan(getContext(), NUMBER_TEXT_APPEARANCE),
                    matcher.start(),
                    matcher.end(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);