Merge "Switch from SI to IEC unit when formatting data usage bytes"
This commit is contained in:
committed by
Android (Google) Code Review
commit
287f84d1ed
@@ -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);
|
||||
|
Reference in New Issue
Block a user