Update the selected period message in battery chart

screenshots: https://drive.google.com/drive/folders/1pxyrmaerZbD2FdEJohnsgqACXXno1Ve5?resourcekey=0-SXu6D9TLvmXDVgVKkZge8Q&usp=sharing
Next cl will change "last 24hr" to "last full charge".

Test: manual
Bug: 236101166
Change-Id: If850d65056add04f0b2ecb6aed418e799ae15fb6
This commit is contained in:
Zaiyue Xue
2022-07-28 11:55:24 +08:00
parent 8d1c50b4dc
commit e2087bb5f3
3 changed files with 118 additions and 19 deletions

View File

@@ -150,10 +150,12 @@ public final class ConvertUtils {
}
/** Converts UTC timestamp to local time day of week data. */
public static String utcToLocalTimeDayOfWeek(final Context context, final long timestamp) {
public static String utcToLocalTimeDayOfWeek(
final Context context, final long timestamp, final boolean isAbbreviation) {
final Locale locale = getLocale(context);
final String pattern = DateFormat.getBestDateTimePattern(locale, "E");
return DateFormat.format(pattern, timestamp).toString().toUpperCase(locale);
final String pattern = DateFormat.getBestDateTimePattern(locale,
isAbbreviation ? "E" : "EEEE");
return DateFormat.format(pattern, timestamp).toString();
}
/** Gets indexed battery usage data for each corresponding time slot. */