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

Commit 427c9c31 authored by mxyyiyi's avatar mxyyiyi Committed by Wesley Wang
Browse files

Migrate Tips Card in battery uasge to Settings Card.

before:
[Dark-settings]:https://screenshot.googleplex.com/56EiS3PbtRsh5RR
[Light-app]:https://screenshot.googleplex.com/8UDuFEkkrLUt53D

after:
[Dark-settings]:https://screenshot.googleplex.com/3zKxxGi2Awa6s72
[Light-settings]:https://screenshot.googleplex.com/rsgVh9P62x7itUa
[Dark-app]:https://screenshot.googleplex.com/56EiS3PbtRsh5RR
[Light-app]:https://screenshot.googleplex.com/6bfs2u43nZpHL8y

Bug: 357603119
Test: atest BatteryTipsControllerTest
Flag: EXEMPT bug fix
Change-Id: I25e3b407378b01ef9868326a005554ceb6e94181
parent 37793948
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+0 −21
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+0 −27
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+0 −27
Original line number Diff line number Diff line
<?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>
 No newline at end of file

res/layout/battery_tips_card.xml

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
<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>
 No newline at end of file
Loading