Loading res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -10912,7 +10912,7 @@ Data usage charges may apply.</string> <string name="apps_summary"><xliff:g id="count" example="24">%1$d</xliff:g> apps installed</string> <!-- Summary of storage usage [CHAR LIMIT=NONE] --> <string name="storage_summary"><xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space_value" example="32">%2$s</xliff:g> <xliff:g id="free_space_units" example="GB">%3$s</xliff:g> free</string> <string name="storage_summary"><xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space" example="32GB">%2$s</xliff:g> free</string> <!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]--> <string name="display_dashboard_summary">Dark theme, font size, brightness</string> src/com/android/settings/deviceinfo/TopLevelStoragePreferenceController.java +2 −3 Original line number Diff line number Diff line Loading @@ -92,10 +92,9 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle private String getSummary(long usedBytes, long totalBytes) { NumberFormat percentageFormat = NumberFormat.getPercentInstance(); final String[] freeSpace = Formatter.formatFileSize(mContext, totalBytes - usedBytes).split(" "); return mContext.getString(R.string.storage_summary, totalBytes == 0L ? "0" : percentageFormat.format(((double) usedBytes) / totalBytes), freeSpace[0], freeSpace[1]); Formatter.formatFileSize(mContext, totalBytes - usedBytes)); } } src/com/android/settings/homepage/contextualcards/slices/LowStorageSlice.java +2 −4 Original line number Diff line number Diff line Loading @@ -64,9 +64,7 @@ public class LowStorageSlice implements CustomSliceable { // Generate Low storage Slice. final String percentageString = NumberFormat.getPercentInstance().format(usedPercentage); final String[] freeSizeString = Formatter.formatFileSize(mContext, info.freeBytes).split(" "); final String freeSizeString = Formatter.formatFileSize(mContext, info.freeBytes); final ListBuilder listBuilder = new ListBuilder(mContext, CustomSliceRegistry.LOW_STORAGE_SLICE_URI, ListBuilder.INFINITY).setAccentColor( Utils.getColorAccentDefaultColor(mContext)); Loading @@ -76,7 +74,7 @@ public class LowStorageSlice implements CustomSliceable { // For clients that ignore error checking, a generic storage slice will be given. final CharSequence titleStorage = mContext.getText(R.string.storage_settings); final String summaryStorage = mContext.getString(R.string.storage_summary, percentageString, freeSizeString[0], freeSizeString[1]); percentageString, freeSizeString); return listBuilder .addRow(buildRowBuilder(titleStorage, summaryStorage, icon)) Loading tests/unit/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class TopLevelStoragePreferenceControllerTest { when(mController.getStorageManagerVolumeProvider()) .thenReturn(mStorageManagerVolumeProvider); final String percentage = NumberFormat.getPercentInstance().format(1); final String[] freeSpace = Formatter.formatFileSize(mContext, 0).split(" "); final String freeSpace = Formatter.formatFileSize(mContext, 0); final Preference preference = new Preference(mContext); // Wait for asynchronous thread to finish, otherwise test will flake. Loading @@ -103,6 +103,6 @@ public class TopLevelStoragePreferenceControllerTest { // the background thread. TimeUnit.SECONDS.sleep(5); assertThat(preference.getSummary()).isEqualTo(ResourcesUtils.getResourcesString( mContext, "storage_summary", percentage, freeSpace[0], freeSpace[1])); mContext, "storage_summary", percentage, freeSpace)); } } Loading
res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -10912,7 +10912,7 @@ Data usage charges may apply.</string> <string name="apps_summary"><xliff:g id="count" example="24">%1$d</xliff:g> apps installed</string> <!-- Summary of storage usage [CHAR LIMIT=NONE] --> <string name="storage_summary"><xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space_value" example="32">%2$s</xliff:g> <xliff:g id="free_space_units" example="GB">%3$s</xliff:g> free</string> <string name="storage_summary"><xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space" example="32GB">%2$s</xliff:g> free</string> <!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]--> <string name="display_dashboard_summary">Dark theme, font size, brightness</string>
src/com/android/settings/deviceinfo/TopLevelStoragePreferenceController.java +2 −3 Original line number Diff line number Diff line Loading @@ -92,10 +92,9 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle private String getSummary(long usedBytes, long totalBytes) { NumberFormat percentageFormat = NumberFormat.getPercentInstance(); final String[] freeSpace = Formatter.formatFileSize(mContext, totalBytes - usedBytes).split(" "); return mContext.getString(R.string.storage_summary, totalBytes == 0L ? "0" : percentageFormat.format(((double) usedBytes) / totalBytes), freeSpace[0], freeSpace[1]); Formatter.formatFileSize(mContext, totalBytes - usedBytes)); } }
src/com/android/settings/homepage/contextualcards/slices/LowStorageSlice.java +2 −4 Original line number Diff line number Diff line Loading @@ -64,9 +64,7 @@ public class LowStorageSlice implements CustomSliceable { // Generate Low storage Slice. final String percentageString = NumberFormat.getPercentInstance().format(usedPercentage); final String[] freeSizeString = Formatter.formatFileSize(mContext, info.freeBytes).split(" "); final String freeSizeString = Formatter.formatFileSize(mContext, info.freeBytes); final ListBuilder listBuilder = new ListBuilder(mContext, CustomSliceRegistry.LOW_STORAGE_SLICE_URI, ListBuilder.INFINITY).setAccentColor( Utils.getColorAccentDefaultColor(mContext)); Loading @@ -76,7 +74,7 @@ public class LowStorageSlice implements CustomSliceable { // For clients that ignore error checking, a generic storage slice will be given. final CharSequence titleStorage = mContext.getText(R.string.storage_settings); final String summaryStorage = mContext.getString(R.string.storage_summary, percentageString, freeSizeString[0], freeSizeString[1]); percentageString, freeSizeString); return listBuilder .addRow(buildRowBuilder(titleStorage, summaryStorage, icon)) Loading
tests/unit/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class TopLevelStoragePreferenceControllerTest { when(mController.getStorageManagerVolumeProvider()) .thenReturn(mStorageManagerVolumeProvider); final String percentage = NumberFormat.getPercentInstance().format(1); final String[] freeSpace = Formatter.formatFileSize(mContext, 0).split(" "); final String freeSpace = Formatter.formatFileSize(mContext, 0); final Preference preference = new Preference(mContext); // Wait for asynchronous thread to finish, otherwise test will flake. Loading @@ -103,6 +103,6 @@ public class TopLevelStoragePreferenceControllerTest { // the background thread. TimeUnit.SECONDS.sleep(5); assertThat(preference.getSummary()).isEqualTo(ResourcesUtils.getResourcesString( mContext, "storage_summary", percentage, freeSpace[0], freeSpace[1])); mContext, "storage_summary", percentage, freeSpace)); } }