Merge "Update strings for summary tip." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0e7cff80ef
@@ -4995,9 +4995,13 @@
|
||||
<string name="battery_abnormal_apps_summary"><xliff:g id="number">%1$d</xliff:g> apps misbehaving</string>
|
||||
|
||||
<!-- Title for the battery summary tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_summary_title">Battery is in good shape</string>
|
||||
<string name="battery_tip_summary_title">Apps are running normally</string>
|
||||
<!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_summary_summary">Apps are running normally</string>
|
||||
<string name="battery_tip_summary_summary" product="default">Phone has typical background battery usage</string>
|
||||
<!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_summary_summary" product="tablet">Tablet has typical background battery usage</string>
|
||||
<!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_summary_summary" product="device">Device has typical background battery usage</string>
|
||||
<!-- Title for the low battery tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_low_battery_title">Low battery capacity</string>
|
||||
<!-- Summary for the low battery tip [CHAR LIMIT=NONE] -->
|
||||
@@ -5076,9 +5080,11 @@
|
||||
<string name="battery_tip_unrestrict_app_dialog_cancel">Cancel</string>
|
||||
|
||||
<!-- Message for battery tip dialog to show the battery summary -->
|
||||
<string name="battery_tip_dialog_summary_message">Based on your usage, your battery usually lasts about <xliff:g id="time_duration">%1$s</xliff:g> when fully charged.\n\nIf you need to extend your battery life, turn on Battery Saver.</string>
|
||||
<string name="battery_tip_dialog_summary_message" product="default">Your apps are using a normal amount of battery. If apps use too much battery, your phone will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
|
||||
<!-- Message for battery tip dialog to show the battery summary -->
|
||||
<string name="battery_tip_dialog_summary_message_no_estimation">If you need to extend your battery life, turn on Battery Saver</string>
|
||||
<string name="battery_tip_dialog_summary_message" product="tablet">Your apps are using a normal amount of battery. If apps use too much battery, your tablet will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
|
||||
<!-- Message for battery tip dialog to show the battery summary -->
|
||||
<string name="battery_tip_dialog_summary_message" product="device">Your apps are using a normal amount of battery. If apps use too much battery, your device will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
|
||||
|
||||
<!-- Title for the smart battery manager preference [CHAR LIMIT=NONE] -->
|
||||
<string name="smart_battery_manager_title">Battery Manager</string>
|
||||
|
@@ -79,16 +79,8 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
|
||||
|
||||
switch (mBatteryTip.getType()) {
|
||||
case BatteryTip.TipType.SUMMARY:
|
||||
final long averageTimeMs = ((SummaryTip) mBatteryTip).getAverageTimeMs();
|
||||
final String message = context.getString(
|
||||
averageTimeMs == Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN
|
||||
? R.string.battery_tip_dialog_summary_message_no_estimation
|
||||
: R.string.battery_tip_dialog_summary_message,
|
||||
StringUtil.formatElapsedTime(context, averageTimeMs,
|
||||
false /* withSeconds */));
|
||||
|
||||
return new AlertDialog.Builder(context)
|
||||
.setMessage(message)
|
||||
.setMessage(R.string.battery_tip_dialog_summary_message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.create();
|
||||
case BatteryTip.TipType.HIGH_DEVICE_USAGE:
|
||||
|
@@ -199,7 +199,7 @@ public class BatteryTipDialogFragmentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnCreateDialog_summaryTipWithEstimation_fireDialogWithEstimation() {
|
||||
public void testOnCreateDialog_summaryTip_fireDialog() {
|
||||
doReturn(AVERAGE_TIME_MS).when(mSummaryTip).getAverageTimeMs();
|
||||
mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);
|
||||
|
||||
@@ -209,20 +209,8 @@ public class BatteryTipDialogFragmentTest {
|
||||
ShadowAlertDialog shadowDialog = shadowOf(dialog);
|
||||
|
||||
assertThat(shadowDialog.getMessage()).isEqualTo(
|
||||
"Based on your usage, your battery usually lasts about 1 hr when fully charged"
|
||||
+ ".\n\nIf you need to extend your battery life, turn on Battery Saver.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnCreateDialog_summaryTipWithoutEstimation_fireDialogWithoutEstimation() {
|
||||
mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);
|
||||
|
||||
FragmentTestUtil.startFragment(mDialogFragment);
|
||||
|
||||
final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
|
||||
ShadowAlertDialog shadowDialog = shadowOf(dialog);
|
||||
|
||||
assertThat(shadowDialog.getMessage()).isEqualTo(
|
||||
"If you need to extend your battery life, turn on Battery Saver");
|
||||
"Your apps are using a normal amount of battery. If apps use too much battery, "
|
||||
+ "your phone will suggest actions you can take.\n\nYou can always turn"
|
||||
+ " on Battery Saver if you’re running low on battery.");
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ import android.support.v7.preference.PreferenceScreen;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.core.InstrumentedPreferenceFragment;
|
||||
import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
|
||||
@@ -181,7 +182,9 @@ public class BatteryTipPreferenceControllerTest {
|
||||
assertThat(preferenceGroup.getPreferenceCount()).isEqualTo(1);
|
||||
|
||||
final Preference preference = preferenceGroup.getPreference(0);
|
||||
assertThat(preference.getTitle()).isEqualTo("Battery is in good shape");
|
||||
assertThat(preference.getSummary()).isEqualTo("Apps are running normally");
|
||||
assertThat(preference.getTitle()).isEqualTo(
|
||||
mContext.getString(R.string.battery_tip_summary_title));
|
||||
assertThat(preference.getSummary()).isEqualTo(
|
||||
mContext.getString(R.string.battery_tip_summary_summary));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user