More storage UI updates.

Storage volumes now have headers with larger fonts and progress bars
to show used versus free space.  Updated Memory to use new formatting
template, and Data Usage to use consistent display logic.

Allocate a unique color for each private volume, and yell when a
volume is running low on space.  Update private volume details to
launch into MediaStore-backed storage backends in a management mode,
and only show detailed items when hosting emulated storage.  Show
details dialog about "Other" and user storage items.

Shortcut into single private volume when it's the only device.  Add
real eject icon.

Bug: 21756698, 20275574, 21326612
Change-Id: If3ecd1d912d3e709c09d3e4da24f368e04dd3f9d
This commit is contained in:
Jeff Sharkey
2015-06-15 21:08:56 -07:00
parent edb7b0d9a9
commit 2597625fd9
17 changed files with 576 additions and 280 deletions

View File

@@ -16,7 +16,6 @@
package com.android.settings.widget;
import static android.net.TrafficStats.GB_IN_BYTES;
import static android.net.TrafficStats.MB_IN_BYTES;
import android.content.Context;
@@ -29,8 +28,11 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
import android.text.format.Time;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -533,33 +535,11 @@ public class ChartDataUsageView extends ChartView {
@Override
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
final CharSequence unit;
final long unitFactor;
if (value < 1000 * MB_IN_BYTES) {
unit = res.getText(com.android.internal.R.string.megabyteShort);
unitFactor = MB_IN_BYTES;
} else {
unit = res.getText(com.android.internal.R.string.gigabyteShort);
unitFactor = GB_IN_BYTES;
}
final double result = (double) value / unitFactor;
final double resultRounded;
final CharSequence size;
if (result < 10) {
size = String.format("%.1f", result);
resultRounded = (unitFactor * Math.round(result * 10)) / 10;
} else {
size = String.format("%.0f", result);
resultRounded = unitFactor * Math.round(result);
}
setText(builder, sSpanSize, size, "^1");
setText(builder, sSpanUnit, unit, "^2");
return (long) resultRounded;
final BytesResult result = Formatter.formatBytes(res, value,
Formatter.FLAG_SHORTER | Formatter.FLAG_CALCULATE_ROUNDED);
setText(builder, sSpanSize, result.value, "^1");
setText(builder, sSpanUnit, result.units, "^2");
return result.roundedBytes;
}
@Override