Update Power Anomaly UI.

For Settings tip & app anomaly banner:

- update app anomaly hint color in dark/light theme
[Banner card]
- update icons to GM3 style
- update text font and button text color
- update button style from outlined to filled.
[Chart view]
- update warning icon size
- update percentage label alignment

Screenshots:
- [Settings]
[light]	https://screenshot.googleplex.com/ERWkD7TmDsLaxdG
[dark]	https://screenshot.googleplex.com/6JKvL5vEQTZtJfd
- [App]
[light]
https://screenshot.googleplex.com/3YoncDhGTzUcAZA
https://screenshot.googleplex.com/3hbGmqoYWSy9H9U
[dark]
https://screenshot.googleplex.com/9XKs8tXmRKL2jJP
https://screenshot.googleplex.com/SU4LTJYWXvpd42r
- [RTL+L10N][Arabic]
[Settings] https://screenshot.googleplex.com/V9HJkPcsoBJmsW8
[Apps]
https://screenshot.googleplex.com/B49VKy2jaZYisWK
https://screenshot.googleplex.com/6VZQ2gESRes8RMH
- [Force RTL][EN]
[Settings] https://screenshot.googleplex.com/4V7coyLf5ueUcGv
[Apps]
https://screenshot.googleplex.com/9UaERwDmrpitqdq
https://screenshot.googleplex.com/3JDfcXi8pmz5Mew

Bug: 309569299
Test: manual
Change-Id: I8bee7f86d602112e0cbbd936b439330aaff7275c
This commit is contained in:
mxyyiyi
2023-11-08 16:52:48 +08:00
parent 7350779738
commit 1817f066ec
14 changed files with 394 additions and 440 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -14,5 +14,5 @@
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/palette_list_color_yellow"/> <item android:color="@color/power_anomaly_app_warning_hint_color"/>
</selector> </selector>

View File

@@ -17,9 +17,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp" android:width="32dp"
android:height="32dp" android:height="32dp"
android:viewportWidth="24" android:viewportWidth="960"
android:viewportHeight="24"> android:viewportHeight="960">
<path <path
android:fillColor="@color/color_accent_selector" android:fillColor="@color/color_accent_selector"
android:pathData="M7,20h4c0,1.1 -0.9,2 -2,2S7,21.1 7,20zM5,19h8v-2H5V19zM16.5,9.5c0,3.82 -2.66,5.86 -3.77,6.5H5.27C4.16,15.36 1.5,13.32 1.5,9.5C1.5,5.36 4.86,2 9,2S16.5,5.36 16.5,9.5zM14.5,9.5C14.5,6.47 12.03,4 9,4S3.5,6.47 3.5,9.5c0,2.47 1.49,3.89 2.35,4.5h6.3C13.01,13.39 14.5,11.97 14.5,9.5zM21.37,7.37L20,8l1.37,0.63L22,10l0.63,-1.37L24,8l-1.37,-0.63L22,6L21.37,7.37zM19,6l0.94,-2.06L22,3l-2.06,-0.94L19,0l-0.94,2.06L16,3l2.06,0.94L19,6z"/> android:pathData="M176,680Q114,643 77,580Q40,517 40,440Q40,323 121.5,241.5Q203,160 320,160Q437,160 518.5,241.5Q600,323 600,440Q600,517 563,580Q526,643 464,680L176,680ZM200,600L440,600Q478,571 499,529.5Q520,488 520,440Q520,357 461.5,298.5Q403,240 320,240Q237,240 178.5,298.5Q120,357 120,440Q120,488 141,529.5Q162,571 200,600ZM176,800L176,720L464,720L464,800L176,800ZM320,920Q287,920 263.5,896.5Q240,873 240,840L400,840Q400,873 376.5,896.5Q353,920 320,920ZM740,401Q740,326 687,273Q634,220 559,220Q634,220 687,167.5Q740,115 740,40Q740,115 792.5,167.5Q845,220 920,220Q845,220 792.5,273Q740,326 740,401ZM320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600Q320,600 320,600L320,600Z"/>
</vector> </vector>

View File

@@ -17,9 +17,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp" android:width="32dp"
android:height="32dp" android:height="32dp"
android:viewportWidth="24" android:viewportWidth="960"
android:viewportHeight="24"> android:viewportHeight="960">
<path <path
android:fillColor="@color/color_battery_anomaly_yellow_selector" android:fillColor="@color/color_battery_anomaly_app_warning_selector"
android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z"/> android:pathData="M40,840L480,80L920,840L40,840ZM178,760L782,760L480,240L178,760ZM480,720Q497,720 508.5,708.5Q520,697 520,680Q520,663 508.5,651.5Q497,640 480,640Q463,640 451.5,651.5Q440,663 440,680Q440,697 451.5,708.5Q463,720 480,720ZM440,600L520,600L520,400L440,400L440,600ZM480,500L480,500L480,500L480,500Z"/>
</vector> </vector>

View File

@@ -4,109 +4,58 @@
android:id="@+id/battery_tips_card" android:id="@+id/battery_tips_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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:orientation="vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:padding="20dp">
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<LinearLayout <ImageView
android:id="@+id/tips_card" 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/battery_tips_all_rounded_bg_ripple" android:layout_marginTop="8dp"
android:orientation="vertical" android:textAlignment="viewStart"
android:padding="24dp"> android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
android:textColor="?android:attr/textColorPrimary" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
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="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorPrimary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="8dp"
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|center_vertical"
android:paddingHorizontal="16dp"
android:layout_marginEnd="8dp"
android:text="@string/battery_tips_card_dismiss_button"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<com.google.android.material.button.MaterialButton
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|center_vertical"
android:text="@string/battery_tips_card_action_button"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
app:strokeColor="@color/color_accent_selector"
app:strokeWidth="1dp" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="1dp"/>
<LinearLayout <LinearLayout
android:id="@+id/feedback_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/battery_tips_half_rounded_bottom_bg" android:layout_marginTop="8dp"
android:gravity="center_vertical|start" android:gravity="end"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingHorizontal="24dp"
android:paddingVertical="16dp"
android:visibility="gone">
<TextView <com.google.android.material.button.MaterialButton
android:layout_width="0dp" android:id="@+id/dismiss_button"
android:layout_height="wrap_content" style="@style/Widget.Material3.Button.TextButton"
android:layout_marginStart="0dp"
android:layout_marginEnd="20dp"
android:layout_weight="1"
android:text="@string/battery_tips_card_feedback_info"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<ImageButton
android:id="@+id/thumb_up"
style="@style/Banner.Dismiss.SettingsLib"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="end|center_vertical"
android:layout_marginEnd="20dp" android:layout_marginEnd="8dp"
android:src="@drawable/ic_battery_tips_thumb_up" /> android:paddingHorizontal="16dp"
android:text="@string/battery_tips_card_dismiss_button"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle2"
android:textColor="@color/color_accent_selector" />
<ImageButton <com.google.android.material.button.MaterialButton
android:id="@+id/thumb_down" android:id="@+id/main_button"
style="@style/Banner.Dismiss.SettingsLib" style="@style/Widget.Material3.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="end|center_vertical"
android:src="@drawable/ic_battery_tips_thumb_down" /> android:paddingHorizontal="16dp"
android:text="@string/battery_tips_card_action_button"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle2"
android:textColor="@color/power_anomaly_primary_button_text_color"
app:backgroundTint="@color/color_accent_selector" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -56,6 +56,9 @@
<!-- Icon tint color for battery usage system icon --> <!-- Icon tint color for battery usage system icon -->
<color name="battery_usage_system_icon_color">@android:color/white</color> <color name="battery_usage_system_icon_color">@android:color/white</color>
<!-- Power anomaly color for icons, button and text -->
<color name="power_anomaly_app_warning_hint_color">#FDD663</color>
<color name="power_anomaly_primary_button_text_color">#2E3300</color>
<!-- UDFPS colors --> <!-- UDFPS colors -->
<color name="udfps_enroll_icon">#7DA7F1</color> <color name="udfps_enroll_icon">#7DA7F1</color>

View File

@@ -1417,7 +1417,7 @@
<string-array name="battery_tips_card_colors" translatable="false"> <string-array name="battery_tips_card_colors" translatable="false">
<item>color_accent_selector</item> <item>color_accent_selector</item>
<item>color_battery_anomaly_yellow_selector</item> <item>color_battery_anomaly_app_warning_selector</item>
</string-array> </string-array>
<!-- The following 4 arrays are for power anomaly tips card. Please keep them the same size. --> <!-- The following 4 arrays are for power anomaly tips card. Please keep them the same size. -->

View File

@@ -169,6 +169,10 @@
<!-- Icon tint color for battery usage system icon --> <!-- Icon tint color for battery usage system icon -->
<color name="battery_usage_system_icon_color">?android:attr/textColorPrimary</color> <color name="battery_usage_system_icon_color">?android:attr/textColorPrimary</color>
<!-- Power anomaly color for icons, button and text -->
<color name="power_anomaly_app_warning_hint_color">#D56E0C</color>
<color name="power_anomaly_primary_button_text_color">#FFFFFF</color>
<!-- UDFPS colors --> <!-- UDFPS colors -->
<color name="udfps_enroll_icon">#699FF3</color> <color name="udfps_enroll_icon">#699FF3</color>
<color name="udfps_moving_target_fill">#C2D7F7</color> <color name="udfps_moving_target_fill">#C2D7F7</color>

View File

@@ -389,7 +389,7 @@
<dimen name="chartview_divider_height">4dp</dimen> <dimen name="chartview_divider_height">4dp</dimen>
<dimen name="chartview_transom_width">4dp</dimen> <dimen name="chartview_transom_width">4dp</dimen>
<dimen name="chartview_transom_radius">4dp</dimen> <dimen name="chartview_transom_radius">4dp</dimen>
<dimen name="chartview_transom_icon_size">12dp</dimen> <dimen name="chartview_transom_icon_size">18dp</dimen>
<dimen name="chartview_transom_padding_top">2dp</dimen> <dimen name="chartview_transom_padding_top">2dp</dimen>
<dimen name="chartview_transom_layout_height">12dp</dimen> <dimen name="chartview_transom_layout_height">12dp</dimen>
<dimen name="chartview_layout_height">182dp</dimen> <dimen name="chartview_layout_height">182dp</dimen>

View File

@@ -10007,6 +10007,9 @@
<!-- Summary of apps anomaly for higher than usual in foreground [CHAR LIMIT=NONE] --> <!-- Summary of apps anomaly for higher than usual in foreground [CHAR LIMIT=NONE] -->
<string name="battery_tips_apps_summary_higher_than_usual_in_foreground"><xliff:g id="app_label" example="Pokemon Go">%1$s</xliff:g> used more battery than usual while in the foreground</string> <string name="battery_tips_apps_summary_higher_than_usual_in_foreground"><xliff:g id="app_label" example="Pokemon Go">%1$s</xliff:g> used more battery than usual while in the foreground</string>
<!-- Content description of the icon in power anomaly banner [CHAR LIMIT=NONE] -->
<string name="battery_usage_anomaly_content_description">Battery usage anomaly</string>
<!-- Label of hint for apps anomaly in battery usage [CHAR LIMIT=NONE] --> <!-- Label of hint for apps anomaly in battery usage [CHAR LIMIT=NONE] -->
<string name="battery_app_item_hint">High battery usage</string> <string name="battery_app_item_hint">High battery usage</string>

View File

@@ -234,7 +234,7 @@ final class AnomalyEventWrapper {
} }
preference.setTitle(titleString); preference.setTitle(titleString);
preference.setIconResourceId(getIconResId()); preference.setIconResourceId(getIconResId());
preference.setMainButtonStrokeColorResourceId(getColorResId()); preference.setButtonColorResourceId(getColorResId());
preference.setMainButtonLabel(getMainBtnString()); preference.setMainButtonLabel(getMainBtnString());
preference.setDismissButtonLabel(getDismissBtnString()); preference.setDismissButtonLabel(getDismissBtnString());
return true; return true;

View File

@@ -378,7 +378,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
mTransomTop = resources.getDimensionPixelSize(R.dimen.chartview_transom_padding_top); mTransomTop = resources.getDimensionPixelSize(R.dimen.chartview_transom_padding_top);
mTransomLineDefaultColor = Utils.getDisabled(mContext, DIVIDER_COLOR); mTransomLineDefaultColor = Utils.getDisabled(mContext, DIVIDER_COLOR);
mTransomLineSelectedColor = mTransomLineSelectedColor =
resources.getColor(R.color.color_battery_anomaly_yellow_selector); resources.getColor(R.color.color_battery_anomaly_app_warning_selector);
final int slotHighlightColor = Utils.getDisabled(mContext, mTransomLineSelectedColor); final int slotHighlightColor = Utils.getDisabled(mContext, mTransomLineSelectedColor);
mTransomIconSize = resources.getDimensionPixelSize(R.dimen.chartview_transom_icon_size); mTransomIconSize = resources.getDimensionPixelSize(R.dimen.chartview_transom_icon_size);
mTransomLinePaint = new Paint(); mTransomLinePaint = new Paint();
@@ -419,11 +419,13 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
private void drawPercentage(Canvas canvas, int index, float offsetY) { private void drawPercentage(Canvas canvas, int index, float offsetY) {
if (mTextPaint != null) { if (mTextPaint != null) {
mTextPaint.setTextAlign(Paint.Align.RIGHT); mTextPaint.setTextAlign(isRTL() ? Paint.Align.RIGHT : Paint.Align.LEFT);
mTextPaint.setColor(mDefaultTextColor); mTextPaint.setColor(mDefaultTextColor);
canvas.drawText( canvas.drawText(
mPercentages[index], mPercentages[index],
isRTL() ? mIndent.left - mTextPadding : getWidth(), isRTL()
? mIndent.left - mTextPadding
: getWidth() - mIndent.width() + mTextPadding,
offsetY + mPercentageBounds[index].height() * .5f, offsetY + mPercentageBounds[index].height() * .5f,
mTextPaint); mTextPaint);
} }

View File

@@ -29,8 +29,6 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder; import androidx.preference.PreferenceViewHolder;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.google.android.material.button.MaterialButton; import com.google.android.material.button.MaterialButton;
@@ -47,11 +45,10 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
void onReject(); void onReject();
} }
private final MetricsFeatureProvider mMetricsFeatureProvider;
private OnConfirmListener mOnConfirmListener; private OnConfirmListener mOnConfirmListener;
private OnRejectListener mOnRejectListener; private OnRejectListener mOnRejectListener;
private int mIconResourceId = 0; private int mIconResourceId = 0;
private int mMainButtonStrokeColorResourceId = 0; private int mButtonColorResourceId = 0;
@VisibleForTesting CharSequence mMainButtonLabel; @VisibleForTesting CharSequence mMainButtonLabel;
@VisibleForTesting CharSequence mDismissButtonLabel; @VisibleForTesting CharSequence mDismissButtonLabel;
@@ -59,9 +56,8 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
public BatteryTipsCardPreference(Context context, AttributeSet attrs) { public BatteryTipsCardPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setLayoutResource(R.layout.battery_tips_card); setLayoutResource(R.layout.battery_tips_card);
setViewId(R.id.battery_tips_card);
setSelectable(false); setSelectable(false);
final FeatureFactory featureFactory = FeatureFactory.getFeatureFactory();
mMetricsFeatureProvider = featureFactory.getMetricsFeatureProvider();
} }
public void setOnConfirmListener(OnConfirmListener listener) { public void setOnConfirmListener(OnConfirmListener listener) {
@@ -72,7 +68,9 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
mOnRejectListener = listener; mOnRejectListener = listener;
} }
/** Sets the icon in tips card. */ /**
* Sets the icon in tips card.
*/
public void setIconResourceId(int resourceId) { public void setIconResourceId(int resourceId) {
if (mIconResourceId != resourceId) { if (mIconResourceId != resourceId) {
mIconResourceId = resourceId; mIconResourceId = resourceId;
@@ -80,15 +78,19 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
} }
} }
/** Sets the stroke color of main button in tips card. */ /**
public void setMainButtonStrokeColorResourceId(int resourceId) { * Sets the background color for main button and the text color for dismiss button.
if (mMainButtonStrokeColorResourceId != resourceId) { */
mMainButtonStrokeColorResourceId = resourceId; public void setButtonColorResourceId(int resourceId) {
if (mButtonColorResourceId != resourceId) {
mButtonColorResourceId = resourceId;
notifyChanged(); notifyChanged();
} }
} }
/** Sets the label of main button in tips card. */ /**
* Sets the label of main button in tips card.
*/
public void setMainButtonLabel(CharSequence label) { public void setMainButtonLabel(CharSequence label) {
if (!TextUtils.equals(mMainButtonLabel, label)) { if (!TextUtils.equals(mMainButtonLabel, label)) {
mMainButtonLabel = label; mMainButtonLabel = label;
@@ -96,7 +98,9 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
} }
} }
/** Sets the label of dismiss button in tips card. */ /**
* Sets the label of dismiss button in tips card.
*/
public void setDismissButtonLabel(CharSequence label) { public void setDismissButtonLabel(CharSequence label) {
if (!TextUtils.equals(mDismissButtonLabel, label)) { if (!TextUtils.equals(mDismissButtonLabel, label)) {
mDismissButtonLabel = label; mDismissButtonLabel = label;
@@ -107,7 +111,7 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
@Override @Override
public void onClick(View view) { public void onClick(View view) {
final int viewId = view.getId(); final int viewId = view.getId();
if (viewId == R.id.main_button || viewId == R.id.tips_card) { if (viewId == R.id.main_button || viewId == R.id.battery_tips_card) {
if (mOnConfirmListener != null) { if (mOnConfirmListener != null) {
mOnConfirmListener.onConfirm(); mOnConfirmListener.onConfirm();
} }
@@ -124,17 +128,21 @@ public class BatteryTipsCardPreference extends Preference implements View.OnClic
((TextView) view.findViewById(R.id.title)).setText(getTitle()); ((TextView) view.findViewById(R.id.title)).setText(getTitle());
LinearLayout tipsCard = (LinearLayout) view.findViewById(R.id.tips_card); final LinearLayout tipsCard = (LinearLayout) view.findViewById(R.id.battery_tips_card);
tipsCard.setOnClickListener(this); tipsCard.setOnClickListener(this);
MaterialButton mainButton = (MaterialButton) view.findViewById(R.id.main_button); final MaterialButton mainButton = (MaterialButton) view.findViewById(R.id.main_button);
mainButton.setOnClickListener(this); mainButton.setOnClickListener(this);
mainButton.setText(mMainButtonLabel); mainButton.setText(mMainButtonLabel);
if (mMainButtonStrokeColorResourceId != 0) { final MaterialButton dismissButton =
mainButton.setStrokeColorResource(mMainButtonStrokeColorResourceId); (MaterialButton) view.findViewById(R.id.dismiss_button);
}
MaterialButton dismissButton = (MaterialButton) view.findViewById(R.id.dismiss_button);
dismissButton.setOnClickListener(this); dismissButton.setOnClickListener(this);
dismissButton.setText(mDismissButtonLabel); dismissButton.setText(mDismissButtonLabel);
if (mButtonColorResourceId != 0) {
final int colorInt = getContext().getColor(mButtonColorResourceId);
mainButton.setBackgroundColor(colorInt);
dismissButton.setTextColor(colorInt);
}
if (mIconResourceId != 0) { if (mIconResourceId != 0) {
((ImageView) view.findViewById(R.id.icon)).setImageResource(mIconResourceId); ((ImageView) view.findViewById(R.id.icon)).setImageResource(mIconResourceId);
} }

View File

@@ -84,8 +84,7 @@ public final class BatteryTipsControllerTest {
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference)
.setTitle("Turn on adaptive brightness to extend battery life"); .setTitle("Turn on adaptive brightness to extend battery life");
verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb); verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb);
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference).setButtonColorResourceId(R.color.color_accent_selector);
.setMainButtonStrokeColorResourceId(R.color.color_accent_selector);
verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings"); verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings");
verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it"); verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it");
// Check proto info // Check proto info
@@ -104,8 +103,7 @@ public final class BatteryTipsControllerTest {
verify(mBatteryTipsCardPreference).setTitle("Reduce screen timeout to extend battery life"); verify(mBatteryTipsCardPreference).setTitle("Reduce screen timeout to extend battery life");
verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb); verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb);
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference).setButtonColorResourceId(R.color.color_accent_selector);
.setMainButtonStrokeColorResourceId(R.color.color_accent_selector);
verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings"); verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings");
verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it"); verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it");
verify(mBatteryTipsCardPreference).setVisible(true); verify(mBatteryTipsCardPreference).setVisible(true);
@@ -134,8 +132,7 @@ public final class BatteryTipsControllerTest {
verify(mBatteryTipsCardPreference).setTitle(testTitle); verify(mBatteryTipsCardPreference).setTitle(testTitle);
verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb); verify(mBatteryTipsCardPreference).setIconResourceId(R.drawable.ic_battery_tips_lightbulb);
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference).setButtonColorResourceId(R.color.color_accent_selector);
.setMainButtonStrokeColorResourceId(R.color.color_accent_selector);
verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings"); verify(mBatteryTipsCardPreference).setMainButtonLabel("View Settings");
verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it"); verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it");
verify(mBatteryTipsCardPreference).setVisible(true); verify(mBatteryTipsCardPreference).setVisible(true);
@@ -159,7 +156,7 @@ public final class BatteryTipsControllerTest {
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference)
.setIconResourceId(R.drawable.ic_battery_tips_warning_icon); .setIconResourceId(R.drawable.ic_battery_tips_warning_icon);
verify(mBatteryTipsCardPreference) verify(mBatteryTipsCardPreference)
.setMainButtonStrokeColorResourceId(R.color.color_battery_anomaly_yellow_selector); .setButtonColorResourceId(R.color.color_battery_anomaly_app_warning_selector);
verify(mBatteryTipsCardPreference).setMainButtonLabel("Check"); verify(mBatteryTipsCardPreference).setMainButtonLabel("Check");
verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it"); verify(mBatteryTipsCardPreference).setDismissButtonLabel("Got it");
verify(mBatteryTipsCardPreference).setVisible(true); verify(mBatteryTipsCardPreference).setVisible(true);