Help talkback to read the hyphen of time frame '{day}{time}-{time}' in PreferenceCategory Title.

Bug: 346707823
Test: atest + manual
Change-Id: I3098ccaffd6396fb1f00e3b57c326980250651f2
This commit is contained in:
mxyyiyi
2024-06-12 16:37:51 +08:00
parent 7f2090d395
commit d047b6da10
4 changed files with 75 additions and 24 deletions

View File

@@ -87,6 +87,7 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
@VisibleForTesting PreferenceGroup mAppListPreferenceGroup;
@VisibleForTesting FooterPreference mFooterPreference;
@VisibleForTesting BatteryDiffData mBatteryDiffData;
@VisibleForTesting String mBatteryUsageBreakdownTitleLastFullChargeText;
@VisibleForTesting String mPercentLessThanThresholdText;
@VisibleForTesting String mPercentLessThanThresholdContentDescription;
@VisibleForTesting boolean mIsHighlightSlot;
@@ -147,9 +148,10 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
private void logPreferenceClickedMetrics(BatteryDiffEntry entry) {
final int attribution = SettingsEnums.OPEN_BATTERY_USAGE;
final int action = entry.isSystemEntry()
? SettingsEnums.ACTION_BATTERY_USAGE_SYSTEM_ITEM
: SettingsEnums.ACTION_BATTERY_USAGE_APP_ITEM;
final int action =
entry.isSystemEntry()
? SettingsEnums.ACTION_BATTERY_USAGE_SYSTEM_ITEM
: SettingsEnums.ACTION_BATTERY_USAGE_APP_ITEM;
final int pageId = SettingsEnums.OPEN_BATTERY_USAGE;
final String packageName =
TextUtils.isEmpty(entry.getPackageName())
@@ -203,6 +205,9 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
mSpinnerPreference = screen.findPreference(SPINNER_PREFERENCE_KEY);
mAppListPreferenceGroup = screen.findPreference(APP_LIST_PREFERENCE_KEY);
mFooterPreference = screen.findPreference(FOOTER_PREFERENCE_KEY);
mBatteryUsageBreakdownTitleLastFullChargeText =
mPrefContext.getString(
R.string.battery_usage_breakdown_title_since_last_full_charge);
final String formatPercentage =
Utils.formatPercentage(BatteryDiffData.SMALL_PERCENTAGE_THRESHOLD, false);
mPercentLessThanThresholdText =
@@ -254,6 +259,7 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
void handleBatteryUsageUpdated(
BatteryDiffData slotUsageData,
String slotTimestamp,
String accessibilitySlotTimestamp,
boolean isAllUsageDataEmpty,
boolean isHighlightSlot,
Optional<AnomalyEventWrapper> optionalAnomalyEventWrapper) {
@@ -276,18 +282,24 @@ public class BatteryUsageBreakdownController extends BasePreferenceController
: null;
}
showCategoryTitle(slotTimestamp);
showCategoryTitle(slotTimestamp, accessibilitySlotTimestamp);
showSpinnerAndAppList();
showFooterPreference(isAllUsageDataEmpty);
}
private void showCategoryTitle(String slotTimestamp) {
mRootPreference.setTitle(
private void showCategoryTitle(String slotTimestamp, String accessibilitySlotTimestamp) {
final String displayTitle =
slotTimestamp == null
? mPrefContext.getString(
R.string.battery_usage_breakdown_title_since_last_full_charge)
? mBatteryUsageBreakdownTitleLastFullChargeText
: mPrefContext.getString(
R.string.battery_usage_breakdown_title_for_slot, slotTimestamp));
R.string.battery_usage_breakdown_title_for_slot, slotTimestamp);
final String accessibilityTitle =
accessibilitySlotTimestamp == null
? mBatteryUsageBreakdownTitleLastFullChargeText
: mPrefContext.getString(
R.string.battery_usage_breakdown_title_for_slot,
accessibilitySlotTimestamp);
mRootPreference.setTitle(Utils.createAccessibleSequence(displayTitle, accessibilityTitle));
mRootPreference.setVisible(true);
}