Merge "Update battery strings to respect user 24 hour setting" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-06 18:17:11 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 3 deletions

View File

@@ -144,7 +144,8 @@ public class PowerUtil {
FIFTEEN_MINUTES_MILLIS);
// convert the time to a properly formatted string.
DateFormat fmt = DateFormat.getTimeInstance(DateFormat.SHORT);
String skeleton = android.text.format.DateFormat.getTimeFormatString(context);
DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton);
Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs));
CharSequence timeString = fmt.format(date);

View File

@@ -42,8 +42,8 @@ public class PowerUtilTest {
public static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis();
public static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about";
public static final String ENHANCED_SUFFIX = " based on your usage";
// matches a time (ex: '1:15 PM', '2 AM')
public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* (AM)|(PM)";
// matches a time (ex: '1:15 PM', '2 AM', '23:00')
public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
// matches a percentage with parenthesis (ex: '(10%)')
public static final String PERCENTAGE_REGEX = " \\(\\d?\\d%\\)";