Merge "Switch from SI to IEC unit when formatting data usage bytes"

This commit is contained in:
TreeHugger Robot
2018-04-12 22:28:25 +00:00
committed by Android (Google) Code Review
15 changed files with 109 additions and 129 deletions

View File

@@ -27,6 +27,7 @@ import android.text.format.Formatter;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.graph.UsageView;
@@ -155,7 +156,7 @@ public class ChartDataUsagePreference extends Preference {
private CharSequence getLabel(long bytes, int str, int mLimitColor) {
Formatter.BytesResult result = Formatter.formatBytes(getContext().getResources(),
bytes, Formatter.FLAG_SHORTER);
bytes, Formatter.FLAG_SHORTER | Formatter.FLAG_IEC_UNITS);
CharSequence label = TextUtils.expandTemplate(getContext().getText(str),
result.value, result.units);
return new SpannableStringBuilder().append(label, new ForegroundColorSpan(mLimitColor), 0);