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

@@ -17,52 +17,27 @@
package com.android.settings.deviceinfo;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape;
import android.os.UserHandle;
import android.preference.Preference;
import com.android.settings.R;
public class StorageItemPreference extends Preference {
public final int color;
public final int userHandle;
public StorageItemPreference(Context context, int titleRes, int colorRes) {
this(context, context.getText(titleRes), colorRes, UserHandle.USER_NULL);
public StorageItemPreference(Context context, int titleRes) {
this(context, context.getText(titleRes), UserHandle.USER_NULL);
}
public StorageItemPreference(
Context context, CharSequence title, int colorRes, int userHandle) {
public StorageItemPreference(Context context, CharSequence title, int userHandle) {
super(context);
if (colorRes != 0) {
this.color = context.getColor(colorRes);
final Resources res = context.getResources();
final int width = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_width);
final int height = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_height);
setIcon(createRectShape(width, height, this.color));
} else {
this.color = Color.MAGENTA;
}
setTitle(title);
setSummary(R.string.memory_calculating_size);
this.userHandle = userHandle;
}
private static ShapeDrawable createRectShape(int width, int height, int color) {
ShapeDrawable shape = new ShapeDrawable(new RectShape());
shape.setIntrinsicHeight(height);
shape.setIntrinsicWidth(width);
shape.getPaint().setColor(color);
return shape;
}
public void setLoading() {
setSummary(R.string.memory_calculating_size);
}