Merge changes from topic "free_up_space_card_preference" into sc-dev

* changes:
  Tweak UI of CardPreference and ContextualCard
  'Free up space' uses CardPreference
This commit is contained in:
TreeHugger Robot
2021-06-09 16:45:54 +00:00
committed by Android (Google) Code Review
8 changed files with 7 additions and 42 deletions

View File

@@ -1117,22 +1117,6 @@
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;contextual_card_stroke_color&quot;>#1f000000&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="106"
column="5"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -4285,22 +4269,6 @@
column="44"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;item name=&quot;strokeColor&quot;>@color/contextual_card_stroke_color&lt;/item>"
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="475"
column="34"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"

View File

@@ -29,6 +29,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-8dp"
layout="@layout/preference_material" />
layout="@layout/settingslib_preference" />
</com.google.android.material.card.MaterialCardView>
</FrameLayout>

View File

@@ -103,9 +103,7 @@
<color name="homepage_wallpaper_background">#E51AD1</color>
<color name="homepage_notification_background">#DD4C9D</color>
<color name="contextual_card_stroke_color">#1f000000</color>
<color name="contextual_card_dismissal_background">@*android:color/material_grey_100</color>
<color name="contextual_card_background">@*android:color/background_device_default_light</color>
<!-- End of dashboard/homepage icon background colors -->
<color name="switchbar_background_color">@*android:color/material_grey_600</color>

View File

@@ -13,7 +13,8 @@
limitations under the License.
-->
<resources>
<resources
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<style name="Widget.ActionBar.Base"
parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid"/>
@@ -472,11 +473,9 @@
<item name="android:layout_marginBottom">@dimen/contextual_card_vertical_margin</item>
<item name="android:layout_marginStart">@dimen/contextual_card_side_margin</item>
<item name="android:layout_marginEnd">@dimen/contextual_card_side_margin</item>
<item name="cardBackgroundColor">@color/contextual_card_background</item>
<item name="cardBackgroundColor">?androidprv:attr/colorSurface</item>
<item name="cardCornerRadius">@dimen/contextual_card_corner_radius</item>
<item name="cardElevation">0dp</item>
<item name="strokeColor">@color/contextual_card_stroke_color</item>
<item name="strokeWidth">1dp</item>
<item name="rippleColor">?android:attr/colorControlHighlight</item>
</style>

View File

@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/storage_settings">
<Preference
<com.android.settings.widget.CardPreference
android:key="free_up_space"
android:order="4"
android:title="@string/storage_free_up_space_title"

View File

@@ -38,7 +38,7 @@
android:icon="@drawable/ic_storage"
android:order="3"
settings:controller="com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController"/>
<Preference
<com.android.settings.widget.CardPreference
android:key="free_up_space"
android:order="4"
android:title="@string/storage_free_up_space_title"

View File

@@ -29,6 +29,7 @@ import com.google.android.material.card.MaterialCardView;
* Preference that wrapped by {@link MaterialCardView}, only support to set icon, title and summary
*/
public class CardPreference extends Preference {
public CardPreference(Context context) {
this(context, null /* attrs */);
}

View File

@@ -45,5 +45,4 @@ public class CardPreferenceTest {
public void getLayoutResource() {
assertThat(mCardPreference.getLayoutResource()).isEqualTo(R.layout.card_preference_layout);
}
}