Merge "Migrate Tips Card in battery uasge to Settings Card." into main

This commit is contained in:
Treehugger Robot
2024-08-08 15:09:30 +00:00
committed by Android (Google) Code Review
13 changed files with 178 additions and 724 deletions

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/settingslib_materialColorSurfaceBright" />
<corners android:radius="@dimen/battery_tips_card_corner_radius_normal" />
</shape>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 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.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:drawable="@drawable/battery_tips_all_rounded_bg"/>
</ripple>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/settingslib_dialog_background"/>
<corners
android:topLeftRadius="@dimen/battery_tips_card_corner_radius_small"
android:topRightRadius="@dimen/battery_tips_card_corner_radius_small"
android:bottomLeftRadius="@dimen/battery_tips_card_corner_radius_normal"
android:bottomRightRadius="@dimen/battery_tips_card_corner_radius_normal"
/>
</shape>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/settingslib_dialog_background"/>
<corners
android:topLeftRadius="@dimen/battery_tips_card_corner_radius_normal"
android:topRightRadius="@dimen/battery_tips_card_corner_radius_normal"
android:bottomLeftRadius="@dimen/battery_tips_card_corner_radius_small"
android:bottomRightRadius="@dimen/battery_tips_card_corner_radius_small"
/>
</shape>

View File

@@ -1,61 +0,0 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/battery_tips_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="@drawable/battery_tips_all_rounded_bg_ripple"
android:orientation="vertical"
android:padding="20dp">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:contentDescription="@string/battery_usage_anomaly_content_description"
android:src="@drawable/ic_battery_tips_lightbulb" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
android:textColor="@color/settingslib_materialColorOnSurface" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="end"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/dismiss_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="8dp"
android:paddingHorizontal="16dp"
android:text="@string/battery_tips_card_dismiss_button"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle2"
android:textColor="@color/color_accent_selector" />
<com.google.android.material.button.MaterialButton
android:id="@+id/main_button"
style="@style/Widget.Material3.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:paddingHorizontal="16dp"
android:text="@string/battery_tips_card_action_button"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle2"
android:textColor="@color/settingslib_materialColorOnPrimary"
app:backgroundTint="@color/color_accent_selector" />
</LinearLayout>
</LinearLayout>

View File

@@ -27,7 +27,7 @@
"com.android.settings.fuelgauge.batteryusage.BatteryTipsController"
settings:isPreferenceVisible="false">
<com.android.settings.fuelgauge.batteryusage.BatteryTipsCardPreference
<com.android.settings.widget.TipCardPreference
android:key="battery_tips_card"
settings:isPreferenceVisible="false" />