New storage dialogs.

Show a helpful dialog when a volume is unmounted or unmountable, or
when disk is unsupported.  Add both missing private volumes and
unsupported disks in the storage list.  Dialog to confirm when
forgetting private volume.

Finish volume detail activities when the volume becomes unmounted.

Show used space instead of free space to match string.  When init'ing
a volume on non-adoptable disk, just format as public.

Bug: 21737573, 21666225, 21737666, 21471429
Change-Id: Id60d5a398e2b7923ebebdc5cfaef33248d8d77bb
This commit is contained in:
Jeff Sharkey
2015-06-14 21:07:27 -07:00
parent 9405a81f7a
commit edb7b0d9a9
8 changed files with 236 additions and 39 deletions

View File

@@ -50,9 +50,12 @@ public class StorageVolumePreference extends Preference {
if (volume.isMountedReadable()) {
// TODO: move statfs() to background thread
final File path = volume.getPath();
final String free = Formatter.formatFileSize(context, path.getFreeSpace());
final long usedBytes = path.getTotalSpace() - path.getFreeSpace();
final String used = Formatter.formatFileSize(context, usedBytes);
final String total = Formatter.formatFileSize(context, path.getTotalSpace());
setSummary(context.getString(R.string.storage_volume_summary, free, total));
setSummary(context.getString(R.string.storage_volume_summary, used, total));
} else {
setSummary(volume.getStateDescription());
}
// TODO: better icons