Storage accessors; persist nickname, flags.

Move to using new public accessors on DiskInfo and VolumeInfo.

Persist nickname changes, and remember when user has initialized a
public volume.  Also skip the migration part of storage wizard until
it's implemented.

Bug: 19993667
Change-Id: I642fb43afb95380fddd48a1dad438e87b06454da
This commit is contained in:
Jeff Sharkey
2015-04-14 21:42:46 -07:00
parent 2949a4ab4d
commit 4366b565e1
15 changed files with 83 additions and 63 deletions

View File

@@ -44,13 +44,13 @@ public class StorageVolumePreference extends Preference {
mStorageManager = context.getSystemService(StorageManager.class);
mVolume = volume;
setKey(volume.id);
setKey(volume.getId());
setTitle(mStorageManager.getBestVolumeDescription(volume));
switch (volume.state) {
switch (volume.getState()) {
case VolumeInfo.STATE_MOUNTED:
// TODO: move statfs() to background thread
final File path = new File(volume.path);
final File path = volume.getPath();
final String free = Formatter.formatFileSize(context, path.getFreeSpace());
final String total = Formatter.formatFileSize(context, path.getTotalSpace());
setSummary(context.getString(R.string.storage_volume_summary, free, total));
@@ -58,13 +58,14 @@ public class StorageVolumePreference extends Preference {
}
// TODO: better icons
if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.id)) {
if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
setIcon(context.getDrawable(R.drawable.ic_settings_storage));
} else {
setIcon(context.getDrawable(R.drawable.ic_sim_sd));
}
if (volume.type == VolumeInfo.TYPE_PUBLIC && volume.state == VolumeInfo.STATE_MOUNTED) {
if (volume.getType() == VolumeInfo.TYPE_PUBLIC
&& volume.getState() == VolumeInfo.STATE_MOUNTED) {
setWidgetLayoutResource(R.layout.preference_storage_action);
}
}