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

Commit 3670fe12 authored by Xinyi Mao's avatar Xinyi Mao Committed by Android (Google) Code Review
Browse files

Merge "Improve battery tips cards." into udc-qpr-dev

parents 20ec9893 2148988c
Loading
Loading
Loading
Loading
+21 −0
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
+36 −46
Original line number Diff line number Diff line
@@ -12,15 +12,10 @@
        android:id="@+id/tips_card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/battery_tips_all_rounded_bg"
        android:background="@drawable/battery_tips_all_rounded_bg_ripple"
        android:orientation="vertical"
        android:padding="24dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

        <ImageView
            android:id="@+id/icon"
            android:layout_width="wrap_content"
@@ -28,21 +23,6 @@
            android:layout_gravity="center_vertical|start"
            android:src="@drawable/ic_battery_tips_lightbulb" />

            <Space
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <ImageButton
                android:id="@+id/dismiss_button"
                style="@style/Banner.Dismiss.SettingsLib"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|end"
                android:layout_marginEnd="0dp"
                android:src="@drawable/ic_battery_tips_close_icon" />
        </LinearLayout>

        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
@@ -53,24 +33,33 @@
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="?android:attr/textColorPrimary" />

        <TextView
            android:id="@+id/summary"
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="8dp"
            android:gravity="start"
            android:maxLines="10"
            android:textAlignment="viewStart"
            android:gravity="end">

            <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"
                android:paddingHorizontal="16dp"
                android:layout_marginEnd="8dp"
                android:text="@string/battery_tips_card_dismiss_button"
                android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:attr/textColorSecondary" />
                android:textColor="?android:attr/colorAccent"
                android:textStyle="bold" />

            <com.google.android.material.button.MaterialButton
            android:id="@+id/action_button"
                android:id="@+id/main_button"
                style="@style/Widget.Material3.Button.OutlinedButton"
                android:paddingHorizontal="16dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end"
            android:layout_marginTop="8dp"
                android:text="@string/battery_tips_card_action_button"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="?android:attr/textColorPrimary"
@@ -78,6 +67,7 @@
                app:strokeColor="?android:attr/colorAccent"
                app:strokeWidth="1dp" />
        </LinearLayout>
    </LinearLayout>

    <Space
        android:layout_width="0dp"
+21 −0
Original line number Diff line number Diff line
@@ -1409,4 +1409,25 @@
    <integer-array name="network_mode_3g_deprecated_carrier_id" translatable="false">
    </integer-array>

    <!-- The following 4 arrays are for power anomaly tips card. Please keep them the same size. -->
    <string-array name="power_anomaly_keys" translatable="false">
        <item>adaptive_brightness</item>
        <item>screen_timeout</item>
    </string-array>

    <string-array name="power_anomaly_titles">
        <item>Turn on adaptive brightness to extend battery life</item>
        <item>Reduce screen timeout to extend battery life</item>
    </string-array>

    <string-array name="power_anomaly_main_btn_strings">
        <item>@string/battery_tips_card_action_button</item>
        <item>@string/battery_tips_card_action_button</item>
    </string-array>

    <string-array name="power_anomaly_dismiss_btn_strings">
        <item>@string/battery_tips_card_dismiss_button</item>
        <item>@string/battery_tips_card_dismiss_button</item>
    </string-array>

</resources>
+4 −13
Original line number Diff line number Diff line
@@ -9651,23 +9651,14 @@
    <string name="app_battery_usage_summary">Set battery usage for apps</string>
    <!-- Label of action button in battery tips card [CHAR LIMIT=NONE] -->
    <string name="battery_tips_card_action_button" translatable="false">Optimize</string>
    <string name="battery_tips_card_action_button" translatable="false">View Settings</string>
    <!-- Label of dismiss button in battery tips card [CHAR LIMIT=NONE] -->
    <string name="battery_tips_card_dismiss_button" translatable="false">Got it</string>
    <!-- Feedback card message in battery tips card [CHAR LIMIT=NONE] -->
    <string name="battery_tips_card_feedback_info" translatable="false">Is this message helpful?</string>
    <!-- Title of battery tips: adaptive brightness [CHAR LIMIT=NONE] -->
    <string name="battery_tips_adaptive_brightness_title" translatable="false">Turn on adaptive brightness to extend battery life</string>
    <!-- Summary of battery tips: adaptive brightness [CHAR LIMIT=NONE] -->
    <string name="battery_tips_adaptive_brightness_summary" translatable="false">It will help reduce your daily battery drain by 10%</string>
    <!-- Title of battery tips: reduce screen timeout [CHAR LIMIT=NONE] -->
    <string name="battery_tips_screen_timeout_title" translatable="false">Reduce screen timeout to extend battery life</string>
    <!-- Summary of battery tips: reduce screen timeout [CHAR LIMIT=NONE] -->
    <string name="battery_tips_screen_timeout_summary" translatable="false">It will help reduce your daily battery drain by 10%</string>
    <!-- Filter title for battery unrestricted[CHAR_LIMIT=50]-->
    <string name="filter_battery_unrestricted_title">Unrestricted</string>
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider

    @Override
    public boolean isBatteryTipsFeedbackEnabled() {
        return true;
        return false;
    }

    @Override
Loading