Merge changes from topic 'storage-o-strings'
* changes: Use total size and not free in Storage summary. Add new strings.
This commit is contained in:
@@ -2698,7 +2698,7 @@
|
|||||||
<string name="storage_detail_dialog_system">System includes files that Android can\u2019t display individually.</string>
|
<string name="storage_detail_dialog_system">System includes files that Android can\u2019t display individually.</string>
|
||||||
|
|
||||||
<!-- Body of dialog informing user about other users on a storage device [CHAR LIMIT=NONE]-->
|
<!-- Body of dialog informing user about other users on a storage device [CHAR LIMIT=NONE]-->
|
||||||
<string name="storage_detail_dialog_user"><xliff:g id="user" example="Guest user">^1</xliff:g> may have saved photos, music, movies, apps, or other data that is taking up <xliff:g id="size" example="1.2 GB">^2</xliff:g> of storage.
|
<string name="storage_detail_dialog_user"><xliff:g id="user" example="Guest user">^1</xliff:g> may have saved photos, music, apps, or other data, using <xliff:g id="size" example="1.2 GB">^2</xliff:g> of storage.
|
||||||
\n\nTo view details, switch to <xliff:g id="user" example="Guest user">^1</xliff:g>.</string>
|
\n\nTo view details, switch to <xliff:g id="user" example="Guest user">^1</xliff:g>.</string>
|
||||||
|
|
||||||
<!-- Title of wizard step prompting user to setup a storage device [CHAR LIMIT=32] -->
|
<!-- Title of wizard step prompting user to setup a storage device [CHAR LIMIT=32] -->
|
||||||
@@ -8284,12 +8284,13 @@
|
|||||||
<string name="storage_files">Files</string>
|
<string name="storage_files">Files</string>
|
||||||
|
|
||||||
<!-- Main settings screen item's title to go into the storage settings screen [CHAR LIMIT=25] -->
|
<!-- Main settings screen item's title to go into the storage settings screen [CHAR LIMIT=25] -->
|
||||||
<string name="storage_settings_2">Phone storage</string>
|
<string name="storage_settings_2" product="tablet">Tablet storage</string>
|
||||||
|
<string name="storage_settings_2" product="default">Phone storage</string>
|
||||||
|
|
||||||
<!-- Summary of a single storage volume used space. [CHAR LIMIT=24] -->
|
<!-- Summary of a single storage volume used space. [CHAR LIMIT=24] -->
|
||||||
<string name="storage_size_large_alternate"><xliff:g id="number" example="128">^1</xliff:g><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></string>
|
<string name="storage_size_large_alternate"><xliff:g id="number" example="128">^1</xliff:g><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></string>
|
||||||
<!-- Summary of a single storage volume free space. [CHAR LIMIT=48]-->
|
<!-- Summary of a single storage volume total space. [CHAR LIMIT=48]-->
|
||||||
<string name="storage_volume_free"><xliff:g id="total" example="32GB">%1$s</xliff:g> free</string>
|
<string name="storage_volume_total">Used of <xliff:g id="total" example="32GB">%1$s</xliff:g></string>
|
||||||
<!-- The percent of storage used by a storage volume. Exposed inside of a donut graph. [CHAR LIMIT=4]-->
|
<!-- The percent of storage used by a storage volume. Exposed inside of a donut graph. [CHAR LIMIT=4]-->
|
||||||
<string name="storage_percent_used"><xliff:g id="percent" example="50%">%1$s</xliff:g>%%</string>
|
<string name="storage_percent_used"><xliff:g id="percent" example="50%">%1$s</xliff:g>%%</string>
|
||||||
|
|
||||||
@@ -8333,4 +8334,7 @@
|
|||||||
<!-- Added as the value of a header field indicating this is an instant app (as opposed to installed normally) -->
|
<!-- Added as the value of a header field indicating this is an instant app (as opposed to installed normally) -->
|
||||||
<string name="install_type_instant">Instant app</string>
|
<string name="install_type_instant">Instant app</string>
|
||||||
|
|
||||||
|
<!-- Warning for when the automatic storage manager is turned off. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="automatic_storage_manager_deactivation_warning">Turn off the storage manager?</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -55,8 +55,8 @@ public class StorageSummaryDonutPreferenceController extends PreferenceControlle
|
|||||||
summary.setTitle(TextUtils.expandTemplate(
|
summary.setTitle(TextUtils.expandTemplate(
|
||||||
mContext.getText(R.string.storage_size_large_alternate), result.value,
|
mContext.getText(R.string.storage_size_large_alternate), result.value,
|
||||||
result.units));
|
result.units));
|
||||||
summary.setSummary(mContext.getString(R.string.storage_volume_free,
|
summary.setSummary(mContext.getString(R.string.storage_volume_total,
|
||||||
Formatter.formatFileSize(mContext, mTotalBytes - mUsedBytes)));
|
Formatter.formatShortFileSize(mContext, mTotalBytes)));
|
||||||
summary.setPercent(mUsedBytes, mTotalBytes);
|
summary.setPercent(mUsedBytes, mTotalBytes);
|
||||||
summary.setEnabled(true);
|
summary.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@@ -55,6 +55,9 @@ import java.io.File;
|
|||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class StorageSummaryDonutPreferenceControllerTest {
|
public class StorageSummaryDonutPreferenceControllerTest {
|
||||||
|
private static final long KILOBYTE = 1024; // Note: When O comes around, this value changes!
|
||||||
|
private static final long MEGABYTE = KILOBYTE * KILOBYTE;
|
||||||
|
private static final long GIGABYTE = KILOBYTE * MEGABYTE;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private StorageSummaryDonutPreferenceController mController;
|
private StorageSummaryDonutPreferenceController mController;
|
||||||
private StorageSummaryDonutPreference mPreference;
|
private StorageSummaryDonutPreference mPreference;
|
||||||
@@ -80,20 +83,20 @@ public class StorageSummaryDonutPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmpty() throws Exception {
|
public void testEmpty() throws Exception {
|
||||||
mController.updateBytes(0, 0);
|
mController.updateBytes(0, 32 * GIGABYTE);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
assertThat(mPreference.getTitle().toString()).isEqualTo("0.00B");
|
assertThat(mPreference.getTitle().toString()).isEqualTo("0.00B");
|
||||||
assertThat(mPreference.getSummary().toString()).isEqualTo("0.00B free");
|
assertThat(mPreference.getSummary().toString()).isEqualTo("Used of 32GB");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUsedStorage() throws Exception {
|
public void testTotalStorage() throws Exception {
|
||||||
mController.updateBytes(1024, 1024 * 10);
|
mController.updateBytes(KILOBYTE, KILOBYTE * 10);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
assertThat(mPreference.getTitle().toString()).isEqualTo("1.00KB");
|
assertThat(mPreference.getTitle().toString()).isEqualTo("1.00KB");
|
||||||
assertThat(mPreference.getSummary().toString()).isEqualTo("9.00KB free");
|
assertThat(mPreference.getSummary().toString()).isEqualTo("Used of 10KB");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -102,15 +105,15 @@ public class StorageSummaryDonutPreferenceControllerTest {
|
|||||||
File file = Mockito.mock(File.class);
|
File file = Mockito.mock(File.class);
|
||||||
StorageVolumeProvider svp = Mockito.mock(StorageVolumeProvider.class);
|
StorageVolumeProvider svp = Mockito.mock(StorageVolumeProvider.class);
|
||||||
when(volume.getPath()).thenReturn(file);
|
when(volume.getPath()).thenReturn(file);
|
||||||
when(file.getTotalSpace()).thenReturn(1024L * 10);
|
when(file.getTotalSpace()).thenReturn(KILOBYTE * 10);
|
||||||
when(file.getFreeSpace()).thenReturn(1024L);
|
when(file.getFreeSpace()).thenReturn(KILOBYTE);
|
||||||
when(svp.getPrimaryStorageSize()).thenReturn(1024L * 10);
|
when(svp.getPrimaryStorageSize()).thenReturn(KILOBYTE * 10);
|
||||||
|
|
||||||
mController.updateSizes(svp, volume);
|
mController.updateSizes(svp, volume);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
assertThat(mPreference.getTitle().toString()).isEqualTo("9.00KB");
|
assertThat(mPreference.getTitle().toString()).isEqualTo("9.00KB");
|
||||||
assertThat(mPreference.getSummary().toString()).isEqualTo("1.00KB free");
|
assertThat(mPreference.getSummary().toString()).isEqualTo("Used of 10KB");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user