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

@@ -19,11 +19,12 @@ import android.content.Context;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.ProcStatsData.MemInfo;
@@ -76,7 +77,8 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
double usedRam = memInfo.realUsedRam;
double totalRam = memInfo.realTotalRam;
double freeRam = memInfo.realFreeRam;
String usedString = Formatter.formatShortFileSize(context, (long) usedRam);
BytesResult usedResult = Formatter.formatBytes(context.getResources(), (long) usedRam,
Formatter.FLAG_SHORTER);
String totalString = Formatter.formatShortFileSize(context, (long) totalRam);
String freeString = Formatter.formatShortFileSize(context, (long) freeRam);
CharSequence memString;
@@ -87,7 +89,8 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
} else {
memString = memStatesStr[memStatesStr.length - 1];
}
mMemStatus.setText(usedString);
mMemStatus.setText(TextUtils.expandTemplate(getText(R.string.storage_size_large),
usedResult.value, usedResult.units));
float usedRatio = (float)(usedRam / (freeRam + usedRam));
mColors.setRatios(usedRatio, 0, 1 - usedRatio);