Impl dismiss action in battery tips cards.

- Use SharedPreferences to record and filter the already dimissed anomaly.

Bug: 291689623
Test: manual
Change-Id: I4fd4a39066591a4a201857f9586b6595b7d5c43b
This commit is contained in:
mxyyiyi
2023-08-17 15:30:22 +08:00
committed by Zaiyue Xue
parent c68e038508
commit d9360ec326
8 changed files with 133 additions and 7 deletions

View File

@@ -108,8 +108,9 @@ public class BatteryTipsController extends BasePreferenceController {
}
// Get card preference strings and navigate fragment info
final int resourceIndex = powerAnomalyEvent.hasKey()
? powerAnomalyEvent.getKey().getNumber() : -1;
final PowerAnomalyKey powerAnomalyKey = powerAnomalyEvent.hasKey()
? powerAnomalyEvent.getKey() : null;
final int resourceIndex = powerAnomalyKey != null ? powerAnomalyKey.getNumber() : -1;
String titleString = getString(powerAnomalyEvent, WarningBannerInfo::getTitleString,
WarningItemInfo::getTitleString, R.array.power_anomaly_titles, resourceIndex);
@@ -134,6 +135,7 @@ public class BatteryTipsController extends BasePreferenceController {
// Updated card preference and main button fragment launcher
mCardPreference.setAnomalyEventId(powerAnomalyEvent.getEventId());
mCardPreference.setPowerAnomalyKey(powerAnomalyKey);
mCardPreference.setTitle(titleString);
mCardPreference.setMainButtonLabel(mainBtnString);
mCardPreference.setDismissButtonLabel(dismissBtnString);