diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java index f028df1f8d15..48cea70260b4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaSettingsActivity.java @@ -660,6 +660,10 @@ private void showMetaData() { mFileSizeView.setText(formattedSize); findViewById(R.id.layout_file_size).setVisibility(View.VISIBLE); findViewById(R.id.divider_file_size).setVisibility(View.VISIBLE); + } else if (mMedia.getFileSizeFormatted() != null) { + mFileSizeView.setText(mMedia.getFileSizeFormatted()); + findViewById(R.id.layout_file_size).setVisibility(View.VISIBLE); + findViewById(R.id.divider_file_size).setVisibility(View.VISIBLE); } else { findViewById(R.id.layout_file_size).setVisibility(View.GONE); findViewById(R.id.divider_file_size).setVisibility(View.GONE); diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/model/MediaModel.java b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/model/MediaModel.java index e7e2e33a62c3..16b2a56881b7 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/model/MediaModel.java +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/model/MediaModel.java @@ -59,6 +59,7 @@ public static MediaUploadState fromString(@Nullable String stringState) { @Nullable @Column private String mFileExtension; @Nullable @Column private String mMimeType; @Column private long mFileSize; + @Nullable @Column private String mFileSizeFormatted; // Descriptive strings @Nullable @Column private String mTitle; @@ -143,6 +144,7 @@ public MediaModel() { this.mFileExtension = null; this.mMimeType = null; this.mFileSize = 0; + this.mFileSizeFormatted = null; this.mTitle = null; this.mCaption = ""; this.mDescription = ""; @@ -489,6 +491,15 @@ public long getFileSize() { return mFileSize; } + public void setFileSizeFormatted(@Nullable String fileSizeFormatted) { + mFileSizeFormatted = fileSizeFormatted; + } + + @Nullable + public String getFileSizeFormatted() { + return mFileSizeFormatted; + } + public void setTitle(@Nullable String title) { mTitle = title; } diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaResponseUtils.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaResponseUtils.kt index 6ab8f1036af7..e4d342508a8a 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaResponseUtils.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaResponseUtils.kt @@ -59,6 +59,8 @@ class MediaResponseUtils from.thumbnails?.let { if (!TextUtils.isEmpty(it.medium)) it.medium else null }, null, from.thumbnails?.let { if (!TextUtils.isEmpty(it.large)) it.large else null }, - MediaWPComRestResponse.DELETED_STATUS == from.status - ) + MediaWPComRestResponse.DELETED_STATUS == from.status, + ).apply { + fileSizeFormatted = from.size + } } diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaWPComRestResponse.java b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaWPComRestResponse.java index dcbd0d2da5b0..b938e906c5ee 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaWPComRestResponse.java +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/media/MediaWPComRestResponse.java @@ -47,4 +47,5 @@ public static class Thumbnails { @Nullable public String videopress_guid; public boolean videopress_processing_done; @Nullable public String status; + @Nullable public String size; } diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt index 476f6882e38f..380f9a7e4bba 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt @@ -2083,6 +2083,7 @@ open class WellSqlConfig : DefaultWellConfig { 209 -> { db.execSQL("ALTER TABLE MediaModel ADD FILE_SIZE INTEGER") + db.execSQL("ALTER TABLE MediaModel ADD FILE_SIZE_FORMATTED TEXT") } } }