Merge "Fix data usage format strings" into nyc-dev

This commit is contained in:
Jason Monk
2016-06-08 19:11:51 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 5 deletions

View File

@@ -7238,13 +7238,13 @@
<string name="ethernet">Ethernet</string>
<!-- Format string for amount of cellular data used [CHAR LIMIT=30] -->
<string name="cell_data_template"><xliff:g name="units" example="GB">%1$s</xliff:g> cellular data</string>
<string name="cell_data_template"><xliff:g id="number" example="128">^1</xliff:g><small><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></small><small><small> cellular data</small></small></string>
<!-- Format string for amount of wifi data used [CHAR LIMIT=30] -->
<string name="wifi_data_template"><xliff:g name="units" example="GB">%1$s</xliff:g> Wi-Fi data</string>
<string name="wifi_data_template"><xliff:g id="number" example="128">^1</xliff:g><small><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></small><small><small> Wi-Fi data</small></small></string>
<!-- Format string for amount of ethernet data used [CHAR LIMIT=30] -->
<string name="ethernet_data_template"><xliff:g name="units" example="GB">%1$s</xliff:g> ethernet data</string>
<string name="ethernet_data_template"><xliff:g id="number" example="128">^1</xliff:g><small><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></small><small><small> ethernet data</small></small></string>
<!-- Format for a summary describing the amount of data before the user is warned [CHAR LIMIT=NONE] -->
<string name="cell_warning_only"><xliff:g name="amount" example="1 GB">%1$s</xliff:g> Data warning</string>

View File

@@ -32,6 +32,7 @@ import android.support.v7.preference.PreferenceScreen;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.Menu;
import android.view.MenuInflater;
@@ -189,8 +190,8 @@ public class DataUsageSummary extends DataUsageBase implements Indexable {
if (mSummaryPreference != null) {
Formatter.BytesResult usedResult = Formatter.formatBytes(context.getResources(),
info.usageLevel, Formatter.FLAG_SHORTER);
mSummaryPreference.setAmount(usedResult.value);
mSummaryPreference.setUnits(getString(mDataUsageTemplate, usedResult.units));
mSummaryPreference.setTitle(TextUtils.expandTemplate(getText(mDataUsageTemplate),
usedResult.value, usedResult.units));
long limit = info.limitLevel;
if (limit <= 0) {
limit = info.warningLevel;