Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc4d2c2c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update summary for low battery tip suggestion" into rvc-dev am:...

Merge "Update summary for low battery tip suggestion" into rvc-dev am: 5303beba am: cfd6d195 am: 6130335a

Change-Id: I07a6b1e0b086154a93e707c329911274b2e00c77
parents d636ca03 6130335a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1066,8 +1066,8 @@
    <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 -->
    <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 -->
    <string name="power_suggestion_extend_battery">Extend battery life past <xliff:g id="time" example="12 PM">%1$s</xliff:g></string>
    <!-- [CHAR_LIMIT=100] Label for estimated time that phone will run out of battery -->
    <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 -->
    <string name="power_remaining_less_than_duration_only">Less than <xliff:g id="threshold">%1$s</xliff:g> remaining</string>
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public class PowerUtil {
            return null;
        }
        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));
        } else {
            return getMoreThanOneDayShortString(context, drainTimeMs,
+3 −3
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public class PowerUtilTest {
    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 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')
    private static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
    // matches a percentage with parenthesis (ex: '(10%)')
@@ -189,9 +189,9 @@ public class PowerUtilTest {
        String info = PowerUtil.getBatteryTipStringFormatted(mContext,
                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(
                EXTEND_PREFIX + TIME_OF_DAY_REGEX));
                BATTERY_RUN_OUT_PREFIX + TIME_OF_DAY_REGEX));
    }

    @Test