Merge "Update battery settings string" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ae9a706ff
@@ -6088,7 +6088,7 @@
|
|||||||
<string name="restricted_app_time_summary">Restricted <xliff:g id="time" example="5 days ago">%1$s</xliff:g></string>
|
<string name="restricted_app_time_summary">Restricted <xliff:g id="time" example="5 days ago">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- Footer message for restrict app details page -->
|
<!-- Footer message for restrict app details page -->
|
||||||
<string name="restricted_app_detail_footer">These apps have been using battery in the background. Restricted apps may not work properly and notifications may be delayed.</string>
|
<string name="restricted_app_detail_footer">These apps are restricted from background battery usage. They may not work as expected, and notifications may be delayed.</string>
|
||||||
|
|
||||||
<!-- Title for auto restriction toggle -->
|
<!-- Title for auto restriction toggle -->
|
||||||
<string name="battery_auto_restriction_title">Use Battery Manager</string>
|
<string name="battery_auto_restriction_title">Use Battery Manager</string>
|
||||||
@@ -6312,7 +6312,7 @@
|
|||||||
<!-- Title for usage time that full charge lasts. [CHAR LIMIT=60] -->
|
<!-- Title for usage time that full charge lasts. [CHAR LIMIT=60] -->
|
||||||
<string name="battery_full_charge_last">Full charge lasts about</string>
|
<string name="battery_full_charge_last">Full charge lasts about</string>
|
||||||
<!-- Description for text in battery footer. [CHAR LIMIT=NONE] -->
|
<!-- Description for text in battery footer. [CHAR LIMIT=NONE] -->
|
||||||
<string name="battery_footer_summary">Battery usage data is approximate and can change based on usage</string>
|
<string name="battery_footer_summary">Battery usage data is approximate and can change based on usage.</string>
|
||||||
<!-- Title for text that shows the amount of time an app has been running while in the foreground. [CHAR LIMIT=80] -->
|
<!-- Title for text that shows the amount of time an app has been running while in the foreground. [CHAR LIMIT=80] -->
|
||||||
<string name="battery_detail_foreground">While in active use</string>
|
<string name="battery_detail_foreground">While in active use</string>
|
||||||
<!-- Title for text that shows the amount of time an app has been running while in the background. [CHAR LIMIT=80] -->
|
<!-- Title for text that shows the amount of time an app has been running while in the background. [CHAR LIMIT=80] -->
|
||||||
@@ -6417,11 +6417,11 @@
|
|||||||
<string name="battery_saver_sticky_title_new">Turn off when charged</string>
|
<string name="battery_saver_sticky_title_new">Turn off when charged</string>
|
||||||
|
|
||||||
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
||||||
<string name="battery_saver_sticky_description_new" product="default">Battery Saver turns off when your phone charges above <xliff:g id="percent" example="90%">%1$s</xliff:g></string>
|
<string name="battery_saver_sticky_description_new" product="default">Battery Saver turns off when your phone charges above <xliff:g id="number" example="88">^1</xliff:g><xliff:g id="unit" example="%">%</xliff:g></string>
|
||||||
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
||||||
<string name="battery_saver_sticky_description_new" product="tablet">Battery Saver turns off when your tablet charges above <xliff:g id="percent" example="90%">%1$s</xliff:g></string>
|
<string name="battery_saver_sticky_description_new" product="tablet">Battery Saver turns off when your tablet charges above <xliff:g id="number" example="88">^1</xliff:g><xliff:g id="unit" example="%">%</xliff:g></string>
|
||||||
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
|
||||||
<string name="battery_saver_sticky_description_new" product="device">Battery Saver turns off when your device charges above <xliff:g id="percent" example="90%">%1$s</xliff:g></string>
|
<string name="battery_saver_sticky_description_new" product="device">Battery Saver turns off when your device charges above <xliff:g id="number" example="88">^1</xliff:g><xliff:g id="unit" example="%">%</xliff:g></string>
|
||||||
|
|
||||||
<!-- Battery saver: Label for seekbar to change battery saver threshold [CHAR_LIMIT=40] -->
|
<!-- Battery saver: Label for seekbar to change battery saver threshold [CHAR_LIMIT=40] -->
|
||||||
<string name="battery_saver_seekbar_title"><xliff:g id="percent">%1$s</xliff:g></string>
|
<string name="battery_saver_seekbar_title"><xliff:g id="percent">%1$s</xliff:g></string>
|
||||||
|
@@ -4,6 +4,8 @@ import android.content.Context;
|
|||||||
import android.icu.text.NumberFormat;
|
import android.icu.text.NumberFormat;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -37,13 +39,11 @@ public class BatterySaverStickyPreferenceController extends TogglePreferenceCont
|
|||||||
@Override
|
@Override
|
||||||
protected void refreshSummary(Preference preference) {
|
protected void refreshSummary(Preference preference) {
|
||||||
super.refreshSummary(preference);
|
super.refreshSummary(preference);
|
||||||
final double stickyShutoffLevel = Settings.Global.getInt(
|
final int stickyShutoffLevel = Settings.Global.getInt(
|
||||||
mContext.getContentResolver(), Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL, 90);
|
mContext.getContentResolver(), Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL, 90);
|
||||||
final String percentage = NumberFormat
|
preference.setSummary(TextUtils.expandTemplate(
|
||||||
.getPercentInstance()
|
mContext.getString(R.string.battery_saver_sticky_description_new),
|
||||||
.format(stickyShutoffLevel / 100.0);
|
NumberFormat.getIntegerInstance().format(stickyShutoffLevel)));
|
||||||
preference.setSummary(
|
|
||||||
mContext.getString(R.string.battery_saver_sticky_description_new, percentage));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user