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

Commit 436cce3a authored by YK Hung's avatar YK Hung Committed by Android (Google) Code Review
Browse files

Merge "[Expressive Battery] Update screen on time text preference style." into main

parents fb4be969 45ac3f28
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@
          android:id="@+id/text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginStart="24dp"
          android:layout_marginTop="8dp"
          android:paddingStart="?android:attr/listPreferredItemPaddingStart"
          android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
          android:textAlignment="viewStart"
          android:textAppearance="?android:attr/textAppearanceSmall"
          android:textColor="?android:attr/textColorPrimary" />
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.fuelgauge.BatteryUtils;
import com.android.settingslib.widget.SettingsThemeHelper;

import java.util.Locale;
import java.util.regex.Matcher;
@@ -119,10 +120,11 @@ public class ScreenOnTimeController extends BasePreferenceController {
        }

        final SpannableString spannableText = new SpannableString(text);
        final int enlargeFontSizeDp = SettingsThemeHelper.isExpressiveTheme(context) ? 64 : 36;
        final Matcher matcher = NUMBER_PATTERN.matcher(text);
        while (matcher.find()) {
            spannableText.setSpan(
                    new AbsoluteSizeSpan(36, true /* dip */),
                    new AbsoluteSizeSpan(enlargeFontSizeDp, true /* dip */),
                    matcher.start(),
                    matcher.end(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+2 −1
Original line number Diff line number Diff line
@@ -25,9 +25,10 @@ import androidx.preference.PreferenceViewHolder;

import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settingslib.widget.GroupSectionDividerMixin;

/** A preference for a single text view. */
public class TextViewPreference extends Preference {
public class TextViewPreference extends Preference implements GroupSectionDividerMixin {
    private static final String TAG = "TextViewPreference";

    @VisibleForTesting CharSequence mText;