Add styles and attributes in SettingsLib

- Add TextAppearance.PreferenceSummary.SettingsLib.
- Update TextAppearance.PreferenceTitle.SettingsLib.
- Update TextAppearance.CategoryTitle.SettingsLib.
- Add settingslib_listPreferredItemPaddingStart.

Fixes: 208402146
Test: manual test
Change-Id: Iccaef4946634befcc254d18be9bb7bbc5b5c1cb8
This commit is contained in:
Sunny Shao
2021-11-30 20:59:48 +08:00
parent 342444597e
commit de3a85047f
8 changed files with 77 additions and 3 deletions

View File

@@ -43,4 +43,8 @@
<color name="settingslib_accent_primary_variant">@android:color/system_accent1_300</color>
<color name="settingslib_text_color_primary_device_default">@android:color/system_neutral1_50</color>
<color name="settingslib_text_color_secondary_device_default">@android:color/system_neutral2_200</color>
<color name="settingslib_text_color_preference_category_title">@android:color/system_accent1_100</color>
</resources>

View File

@@ -65,4 +65,8 @@
<color name="settingslib_background_device_default_light">@android:color/system_neutral1_50</color>
<color name="settingslib_text_color_primary_device_default">@android:color/system_neutral1_900</color>
<color name="settingslib_text_color_secondary_device_default">@android:color/system_neutral2_700</color>
<color name="settingslib_text_color_preference_category_title">@android:color/system_accent1_600</color>
</resources>

View File

@@ -20,4 +20,9 @@
<dimen name="app_icon_min_width">52dp</dimen>
<dimen name="settingslib_preferred_minimum_touch_target">48dp</dimen>
<dimen name="settingslib_dialogCornerRadius">28dp</dimen>
<!-- Left padding of the preference -->
<dimen name="settingslib_listPreferredItemPaddingStart">24dp</dimen>
<!-- Right padding of the preference -->
<dimen name="settingslib_listPreferredItemPaddingEnd">24dp</dimen>
</resources>

View File

@@ -17,13 +17,19 @@
<resources>
<style name="TextAppearance.PreferenceTitle.SettingsLib"
parent="@android:style/TextAppearance.Material.Subhead">
<item name="android:textColor">@color/settingslib_text_color_primary_device_default</item>
<item name="android:fontFamily">@string/settingslib_config_headlineFontFamily</item>
<item name="android:textSize">20sp</item>
</style>
<style name="TextAppearance.PreferenceSummary.SettingsLib"
parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:textColor">@color/settingslib_text_color_secondary_device_default</item>
</style>
<style name="TextAppearance.CategoryTitle.SettingsLib"
parent="@android:style/TextAppearance.DeviceDefault.Medium">
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textColor">@color/settingslib_text_color_preference_category_title</item>
<item name="android:textSize">14sp</item>
</style>

View File

@@ -19,8 +19,8 @@
<!-- Only using in Settings application -->
<style name="Theme.SettingsBase" parent="@android:style/Theme.DeviceDefault.Settings" >
<item name="android:textAppearanceListItem">@style/TextAppearance.PreferenceTitle.SettingsLib</item>
<item name="android:listPreferredItemPaddingStart">24dp</item>
<item name="android:listPreferredItemPaddingLeft">24dp</item>
<item name="android:listPreferredItemPaddingStart">@dimen/settingslib_listPreferredItemPaddingStart</item>
<item name="android:listPreferredItemPaddingLeft">@dimen/settingslib_listPreferredItemPaddingStart</item>
<item name="android:listPreferredItemPaddingEnd">16dp</item>
<item name="android:listPreferredItemPaddingRight">16dp</item>
<item name="preferenceTheme">@style/PreferenceTheme.SettingsLib</item>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<bool name="settingslib_config_icon_space_reserved">true</bool>
</resources>

View File

@@ -21,4 +21,11 @@
<dimen name="app_icon_min_width">56dp</dimen>
<dimen name="two_target_min_width">72dp</dimen>
<dimen name="settingslib_dialogCornerRadius">8dp</dimen>
<!-- Left padding of the preference -->
<dimen name="settingslib_listPreferredItemPaddingStart">16dp</dimen>
<!-- Right padding of the preference -->
<dimen name="settingslib_listPreferredItemPaddingEnd">16dp</dimen>
<!-- Icon size of the preference -->
<dimen name="settingslib_preferenceIconSize">24dp</dimen>
</resources>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<resources>
<style name="TextAppearance.PreferenceTitle.SettingsLib"
parent="@android:style/TextAppearance.Material.Subhead">
</style>
<style name="TextAppearance.PreferenceSummary.SettingsLib"
parent="@style/PreferenceSummaryTextStyle">
</style>
<style name="TextAppearance.CategoryTitle.SettingsLib"
parent="@android:style/TextAppearance.DeviceDefault.Medium">
</style>
</resources>