Merge "Update summary for low battery tip suggestion" into rvc-dev am: 5303beba69 am: cfd6d1954d
Change-Id: I118704f08836305f5b9f49c13b95f98b150c2a0f
This commit is contained in:
@@ -1066,8 +1066,8 @@
|
|||||||
<string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string>
|
<string name="power_discharge_by_only">Should last until about <xliff:g id="time">%1$s</xliff:g></string>
|
||||||
<!-- [CHAR_LIMIT=20] Label for estimated time that phone will run out of battery -->
|
<!-- [CHAR_LIMIT=20] Label for estimated time that phone will run out of battery -->
|
||||||
<string name="power_discharge_by_only_short">Until <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
|
<string name="power_discharge_by_only_short">Until <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
|
||||||
<!-- [CHAR_LIMIT=100] Extend the battery life past a certain time -->
|
<!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery -->
|
||||||
<string name="power_suggestion_extend_battery">Extend battery life past <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
|
<string name="power_suggestion_battery_run_out">Battery may run out by <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount -->
|
<!-- [CHAR_LIMIT=60] label for estimated remaining duration of battery when under a certain amount -->
|
||||||
<string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string>
|
<string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class PowerUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (drainTimeMs <= ONE_DAY_MILLIS) {
|
if (drainTimeMs <= ONE_DAY_MILLIS) {
|
||||||
return context.getString(R.string.power_suggestion_extend_battery,
|
return context.getString(R.string.power_suggestion_battery_run_out,
|
||||||
getDateTimeStringFromMs(context, drainTimeMs));
|
getDateTimeStringFromMs(context, drainTimeMs));
|
||||||
} else {
|
} else {
|
||||||
return getMoreThanOneDayShortString(context, drainTimeMs,
|
return getMoreThanOneDayShortString(context, drainTimeMs,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class PowerUtilTest {
|
|||||||
private static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis();
|
private static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis();
|
||||||
private static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about";
|
private static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about";
|
||||||
private static final String ENHANCED_SUFFIX = " based on your usage";
|
private static final String ENHANCED_SUFFIX = " based on your usage";
|
||||||
private static final String EXTEND_PREFIX = "Extend battery life past";
|
private static final String BATTERY_RUN_OUT_PREFIX = "Battery may run out by";
|
||||||
// matches a time (ex: '1:15 PM', '2 AM', '23:00')
|
// matches a time (ex: '1:15 PM', '2 AM', '23:00')
|
||||||
private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
|
private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
|
||||||
// matches a percentage with parenthesis (ex: '(10%)')
|
// matches a percentage with parenthesis (ex: '(10%)')
|
||||||
@@ -189,9 +189,9 @@ public class PowerUtilTest {
|
|||||||
String info = PowerUtil.getBatteryTipStringFormatted(mContext,
|
String info = PowerUtil.getBatteryTipStringFormatted(mContext,
|
||||||
SEVENTEEN_MIN_MILLIS);
|
SEVENTEEN_MIN_MILLIS);
|
||||||
|
|
||||||
// ex: Extend battery life past 1:15 PM
|
// ex: Battery may run out by 1:15 PM
|
||||||
assertThat(info).containsMatch(Pattern.compile(
|
assertThat(info).containsMatch(Pattern.compile(
|
||||||
EXTEND_PREFIX + TIME_OF_DAY_REGEX));
|
BATTERY_RUN_OUT_PREFIX + TIME_OF_DAY_REGEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user