[Expressive Battery] Update screen on time text preference style.
For expressive style: - Update the enlarge font size - Remove the background Bug: 349652542 Test: visual Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled Change-Id: If85d2903eec6d1f7c3b58e71daef2409325ac83d
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
android:id="@+id/text"
|
android:id="@+id/text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:layout_marginTop="8dp"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="?android:attr/textColorPrimary" />
|
android:textColor="?android:attr/textColorPrimary" />
|
@@ -30,6 +30,7 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.fuelgauge.BatteryUtils;
|
import com.android.settings.fuelgauge.BatteryUtils;
|
||||||
|
import com.android.settingslib.widget.SettingsThemeHelper;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -119,10 +120,11 @@ public class ScreenOnTimeController extends BasePreferenceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final SpannableString spannableText = new SpannableString(text);
|
final SpannableString spannableText = new SpannableString(text);
|
||||||
|
final int enlargeFontSizeDp = SettingsThemeHelper.isExpressiveTheme(context) ? 64 : 36;
|
||||||
final Matcher matcher = NUMBER_PATTERN.matcher(text);
|
final Matcher matcher = NUMBER_PATTERN.matcher(text);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
spannableText.setSpan(
|
spannableText.setSpan(
|
||||||
new AbsoluteSizeSpan(36, true /* dip */),
|
new AbsoluteSizeSpan(enlargeFontSizeDp, true /* dip */),
|
||||||
matcher.start(),
|
matcher.start(),
|
||||||
matcher.end(),
|
matcher.end(),
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
@@ -25,9 +25,10 @@ import androidx.preference.PreferenceViewHolder;
|
|||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settingslib.widget.GroupSectionDividerMixin;
|
||||||
|
|
||||||
/** A preference for a single text view. */
|
/** 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";
|
private static final String TAG = "TextViewPreference";
|
||||||
|
|
||||||
@VisibleForTesting CharSequence mText;
|
@VisibleForTesting CharSequence mText;
|
||||||
|
Reference in New Issue
Block a user