From 4e8d58119781e78d3bad42794f2e640753da572f Mon Sep 17 00:00:00 2001 From: adalpari Date: Wed, 17 Sep 2025 11:43:49 +0200 Subject: [PATCH 01/11] Creating the field in MediaModel --- .../org/wordpress/android/fluxc/model/MediaModel.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 53ae7e3092d0..e7e2e33a62c3 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 @@ -58,6 +58,7 @@ public static MediaUploadState fromString(@Nullable String stringState) { @Nullable @Column private String mFilePath; @Nullable @Column private String mFileExtension; @Nullable @Column private String mMimeType; + @Column private long mFileSize; // Descriptive strings @Nullable @Column private String mTitle; @@ -141,6 +142,7 @@ public MediaModel() { this.mFilePath = null; this.mFileExtension = null; this.mMimeType = null; + this.mFileSize = 0; this.mTitle = null; this.mCaption = ""; this.mDescription = ""; @@ -331,6 +333,7 @@ && getLocalSiteId() == otherMedia.getLocalSiteId() && getLocalPostId() == otherM && getMediaId() == otherMedia.getMediaId() && getPostId() == otherMedia.getPostId() && getAuthorId() == otherMedia.getAuthorId() && getWidth() == otherMedia.getWidth() && getHeight() == otherMedia.getHeight() && getLength() == otherMedia.getLength() + && getFileSize() == otherMedia.getFileSize() && getHorizontalAlignment() == otherMedia.getHorizontalAlignment() && getVerticalAlignment() == otherMedia.getVerticalAlignment() && getVideoPressProcessingDone() == otherMedia.getVideoPressProcessingDone() @@ -478,6 +481,14 @@ public String getMimeType() { return mMimeType; } + public void setFileSize(long fileSize) { + mFileSize = fileSize; + } + + public long getFileSize() { + return mFileSize; + } + public void setTitle(@Nullable String title) { mTitle = title; } From f9fc6c6cec8c2e68be098a962055cd6d32af7fe8 Mon Sep 17 00:00:00 2001 From: adalpari Date: Wed, 17 Sep 2025 11:44:34 +0200 Subject: [PATCH 02/11] Filling the field in rs requests --- .../network/rest/wpapi/media/MediaRSApiRestClient.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaRSApiRestClient.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaRSApiRestClient.kt index d09322287c6f..568679c0c3e5 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaRSApiRestClient.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaRSApiRestClient.kt @@ -417,7 +417,10 @@ class MediaRSApiRestClient @Inject constructor( // Parse the media details when (val parsedType = this@toMediaModel.mediaDetails.parseAsMimeType(this@toMediaModel.mimeType)) { - is MediaDetailsPayload.Audio -> length = parsedType.v1.length.toInt() + is MediaDetailsPayload.Audio -> { + length = parsedType.v1.length.toInt() + fileSize = parsedType.v1.fileSize.toLong() + } is MediaDetailsPayload.Image -> { fileName = parseFileNameFromPath(parsedType.v1.file) width = parsedType.v1.width.toInt() @@ -425,13 +428,15 @@ class MediaRSApiRestClient @Inject constructor( thumbnailUrl = parsedType.v1.sizes?.get("thumbnail")?.sourceUrl fileUrlMediumSize = parsedType.v1.sizes?.get("medium")?.sourceUrl fileUrlLargeSize = parsedType.v1.sizes?.get("large")?.sourceUrl + fileSize = parsedType.v1.fileSize.toLong() } is MediaDetailsPayload.Video -> { width = parsedType.v1.width.toInt() height = parsedType.v1.height.toInt() length = parsedType.v1.length.toInt() + fileSize = parsedType.v1.fileSize.toLong() } - is MediaDetailsPayload.Document, + is MediaDetailsPayload.Document -> fileSize = parsedType.v1.fileSize.toLong() null -> {} } From 907f13cb8157eaad5ae58d2cfc92e4f5141d130d Mon Sep 17 00:00:00 2001 From: adalpari Date: Wed, 17 Sep 2025 12:06:42 +0200 Subject: [PATCH 03/11] Adding the field to the db --- .../wordpress/android/fluxc/persistence/WellSqlConfig.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 b996138fb687..476f6882e38f 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 @@ -41,7 +41,7 @@ open class WellSqlConfig : DefaultWellConfig { annotation class AddOn override fun getDbVersion(): Int { - return 209 + return 210 } override fun getDbName(): String { @@ -2080,6 +2080,10 @@ open class WellSqlConfig : DefaultWellConfig { 208 -> { db.execSQL("DROP TABLE IF EXISTS EncryptedLogModel") } + + 209 -> { + db.execSQL("ALTER TABLE MediaModel ADD FILE_SIZE INTEGER") + } } } db.setTransactionSuccessful() From 4c3a7f07581d4513b64af9758db0d83b65037104 Mon Sep 17 00:00:00 2001 From: adalpari Date: Wed, 17 Sep 2025 12:40:04 +0200 Subject: [PATCH 04/11] Adding field to the UI --- .../ui/media/MediaSettingsActivity.java | 25 ++++++++++++++++ .../res/layout/media_settings_activity.xml | 29 +++++++++++++++++++ WordPress/src/main/res/values/strings.xml | 1 + 3 files changed, 55 insertions(+) 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 41281ae6a94b..5e3d8406ed2a 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 @@ -95,6 +95,7 @@ import org.wordpress.android.util.ToastUtils; import org.wordpress.android.util.WPMediaUtils; import org.wordpress.android.util.WPPermissionUtils; +import org.wordpress.android.util.FormatUtils; import org.wordpress.android.util.extensions.CompatExtensionsKt; import org.wordpress.android.util.extensions.ContextExtensionsKt; import org.wordpress.android.util.extensions.ViewExtensionsKt; @@ -144,6 +145,8 @@ public class MediaSettingsActivity extends BaseAppCompatActivity private SeekBar mImageSizeSeekBarView; private Spinner mAlignmentSpinnerView; private FloatingActionButton mFabView; + private TextView mFileSizeView; + private TextView mFileSizeLabelView; private AlertDialog mDeleteMediaConfirmationDialog; @@ -256,6 +259,8 @@ public void handleOnBackPressed() { mImageSizeSeekBarView = findViewById(R.id.image_size_seekbar); mAlignmentSpinnerView = findViewById(org.wordpress.android.editor.R.id.alignment_spinner); mFabView = findViewById(R.id.fab_button); + mFileSizeView = findViewById(R.id.text_file_size); + mFileSizeLabelView = findViewById(R.id.text_file_size_label); int mediaId; if (savedInstanceState != null) { @@ -642,6 +647,26 @@ private void showMetaData() { TextView txtFileType = findViewById(R.id.text_filetype); txtFileType.setText(StringUtils.notNullStr(mMedia.getFileExtension()).toUpperCase(Locale.ROOT)); + // Display file size if available + if (mMedia.getFileSize() > 0) { + final String[] units = new String[] { + getString(R.string.file_size_in_bytes), + getString(R.string.file_size_in_kilobytes), + getString(R.string.file_size_in_megabytes), + getString(R.string.file_size_in_gigabytes), + getString(R.string.file_size_in_terabytes) + }; + String formattedSize = FormatUtils.formatFileSize(mMedia.getFileSize(), units); + mFileSizeView.setText(formattedSize); + mFileSizeView.setVisibility(View.VISIBLE); + mFileSizeLabelView.setVisibility(View.VISIBLE); + 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); + } + showImageDimensions(mMedia.getWidth(), mMedia.getHeight()); String uploadDate = null; diff --git a/WordPress/src/main/res/layout/media_settings_activity.xml b/WordPress/src/main/res/layout/media_settings_activity.xml index 1c5662959a26..5d50fc6af181 100644 --- a/WordPress/src/main/res/layout/media_settings_activity.xml +++ b/WordPress/src/main/res/layout/media_settings_activity.xml @@ -413,6 +413,35 @@ android:layout_width="match_parent" android:layout_height="1dp" /> + + + + + + + + + + URL File Name File Type + File Size Image Dimensions Video Dimensions Duration From eaec3e0d5e5fa4b079d1beb22753845504e65348 Mon Sep 17 00:00:00 2001 From: adalpari Date: Wed, 17 Sep 2025 12:43:03 +0200 Subject: [PATCH 05/11] Minor refactor --- .../org/wordpress/android/ui/media/MediaSettingsActivity.java | 2 -- WordPress/src/main/res/layout/media_settings_activity.xml | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) 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 5e3d8406ed2a..f028df1f8d15 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 @@ -658,8 +658,6 @@ private void showMetaData() { }; String formattedSize = FormatUtils.formatFileSize(mMedia.getFileSize(), units); mFileSizeView.setText(formattedSize); - mFileSizeView.setVisibility(View.VISIBLE); - mFileSizeLabelView.setVisibility(View.VISIBLE); findViewById(R.id.layout_file_size).setVisibility(View.VISIBLE); findViewById(R.id.divider_file_size).setVisibility(View.VISIBLE); } else { diff --git a/WordPress/src/main/res/layout/media_settings_activity.xml b/WordPress/src/main/res/layout/media_settings_activity.xml index 5d50fc6af181..895b73008396 100644 --- a/WordPress/src/main/res/layout/media_settings_activity.xml +++ b/WordPress/src/main/res/layout/media_settings_activity.xml @@ -419,7 +419,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" - android:orientation="vertical"> + android:orientation="vertical" + android:visibility="gone"> Date: Thu, 18 Sep 2025 13:17:15 +0200 Subject: [PATCH 06/11] Adding new field for formatted tests --- .../wordpress/android/fluxc/model/MediaModel.java | 14 +++++++++++++- .../network/rest/wpcom/media/MediaResponseUtils.kt | 3 ++- .../rest/wpcom/media/MediaWPComRestResponse.java | 1 + .../android/fluxc/persistence/WellSqlConfig.kt | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) 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..fdeb3c400436 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 mFileSizeFromatted; // Descriptive strings @Nullable @Column private String mTitle; @@ -143,6 +144,7 @@ public MediaModel() { this.mFileExtension = null; this.mMimeType = null; this.mFileSize = 0; + this.mFileSizeFromatted = null; this.mTitle = null; this.mCaption = ""; this.mDescription = ""; @@ -292,7 +294,8 @@ public MediaModel( @Nullable String fileUrlMediumSize, @Nullable String fileUrlMediumLargeSize, @Nullable String fileUrlLargeSize, - boolean deleted) { + boolean deleted, + @Nullable String fileSizeFormatted) { this.mLocalSiteId = localSiteId; this.mMediaId = mediaId; this.mPostId = postId; @@ -318,6 +321,7 @@ public MediaModel( this.mFileUrlMediumLargeSize = fileUrlMediumLargeSize; this.mFileUrlLargeSize = fileUrlLargeSize; this.mDeleted = deleted; + this.mFileSizeFromatted = fileSizeFormatted; } @Override @@ -489,6 +493,14 @@ public long getFileSize() { return mFileSize; } + public void setFileSizeFromatted(String fileSizeFormatted) { + mFileSizeFromatted = fileSizeFormatted; + } + + public String getFileSizeFromatted() { + return mFileSizeFromatted; + } + 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..646c0002ce72 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,7 @@ 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, + 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..3b23a69035d7 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 @@ -41,7 +41,7 @@ open class WellSqlConfig : DefaultWellConfig { annotation class AddOn override fun getDbVersion(): Int { - return 210 + return 211 } override fun getDbName(): String { @@ -2084,6 +2084,10 @@ open class WellSqlConfig : DefaultWellConfig { 209 -> { db.execSQL("ALTER TABLE MediaModel ADD FILE_SIZE INTEGER") } + + 210 -> { + db.execSQL("ALTER TABLE MediaModel ADD FILE_SIZE_FORMATTED TEXT") + } } } db.setTransactionSuccessful() From 1268243b178555d67c35284542db6e2a56ff1bd5 Mon Sep 17 00:00:00 2001 From: adalpari Date: Thu, 18 Sep 2025 13:17:29 +0200 Subject: [PATCH 07/11] Showing the new field --- .../org/wordpress/android/ui/media/MediaSettingsActivity.java | 4 ++++ 1 file changed, 4 insertions(+) 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..8f8b784b628d 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.getFileSizeFromatted() != null) { + mFileSizeView.setText(mMedia.getFileSizeFromatted()); + 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); From 9c5b34d343da8d5fe36931201399fc4e9c4a6198 Mon Sep 17 00:00:00 2001 From: adalpari Date: Thu, 18 Sep 2025 13:29:24 +0200 Subject: [PATCH 08/11] Skipping the parameter for other instances --- .../fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt | 3 ++- .../android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt index 2ddc4a7b44a1..8d7fb31fd997 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt @@ -90,5 +90,6 @@ fun MediaWPRESTResponse.toMediaModel(localSiteId: Int) = MediaModel( null, null, null, - MediaWPComRestResponse.DELETED_STATUS == status + MediaWPComRestResponse.DELETED_STATUS == status, + null ) diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java index 921e09f09f1e..0758b45c68f0 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java @@ -575,7 +575,8 @@ private MediaModel getMediaFromXmlrpcResponse(@NonNull Map response) { metadataMap != null ? getFileUrlForSize(link, metadataMap, "medium") : null, metadataMap != null ? getFileUrlForSize(link, metadataMap, "medium_large") : null, metadataMap != null ? getFileUrlForSize(link, metadataMap, "large") : null, - false + false, + null ); } From 744f4ab1f7255df52f4d9594144b614fa3b919f4 Mon Sep 17 00:00:00 2001 From: adalpari Date: Thu, 18 Sep 2025 13:41:36 +0200 Subject: [PATCH 09/11] Chanigng the model creation approach --- .../java/org/wordpress/android/fluxc/model/MediaModel.java | 5 ++--- .../fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt | 1 - .../fluxc/network/rest/wpcom/media/MediaResponseUtils.kt | 4 +++- .../fluxc/network/xmlrpc/media/MediaXMLRPCClient.java | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) 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 fdeb3c400436..0a8a6e69ee02 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 @@ -294,8 +294,8 @@ public MediaModel( @Nullable String fileUrlMediumSize, @Nullable String fileUrlMediumLargeSize, @Nullable String fileUrlLargeSize, - boolean deleted, - @Nullable String fileSizeFormatted) { + boolean deleted + ) { this.mLocalSiteId = localSiteId; this.mMediaId = mediaId; this.mPostId = postId; @@ -321,7 +321,6 @@ public MediaModel( this.mFileUrlMediumLargeSize = fileUrlMediumLargeSize; this.mFileUrlLargeSize = fileUrlLargeSize; this.mDeleted = deleted; - this.mFileSizeFromatted = fileSizeFormatted; } @Override diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt index 8d7fb31fd997..34c6af360b86 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt @@ -91,5 +91,4 @@ fun MediaWPRESTResponse.toMediaModel(localSiteId: Int) = MediaModel( null, null, MediaWPComRestResponse.DELETED_STATUS == status, - null ) 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 646c0002ce72..ff18d3abd471 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 @@ -5,6 +5,7 @@ import org.apache.commons.text.StringEscapeUtils import org.wordpress.android.fluxc.model.MediaModel import org.wordpress.android.fluxc.model.MediaModel.MediaUploadState import org.wordpress.android.fluxc.network.rest.wpcom.media.MediaWPComRestResponse.MultipleMediaResponse +import org.wordpress.android.util.MapUtils import javax.inject.Inject class MediaResponseUtils @@ -60,6 +61,7 @@ class MediaResponseUtils null, from.thumbnails?.let { if (!TextUtils.isEmpty(it.large)) it.large else null }, MediaWPComRestResponse.DELETED_STATUS == from.status, + ).apply { from.size - ) + } } diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java index 0758b45c68f0..921e09f09f1e 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/media/MediaXMLRPCClient.java @@ -575,8 +575,7 @@ private MediaModel getMediaFromXmlrpcResponse(@NonNull Map response) { metadataMap != null ? getFileUrlForSize(link, metadataMap, "medium") : null, metadataMap != null ? getFileUrlForSize(link, metadataMap, "medium_large") : null, metadataMap != null ? getFileUrlForSize(link, metadataMap, "large") : null, - false, - null + false ); } From 4be2a47d587a5ca2c9652ead2fc93cc59d02c15e Mon Sep 17 00:00:00 2001 From: adalpari Date: Thu, 18 Sep 2025 14:54:49 +0200 Subject: [PATCH 10/11] Field fix --- .../java/org/wordpress/android/fluxc/model/MediaModel.java | 3 +-- .../fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt | 2 +- .../fluxc/network/rest/wpcom/media/MediaResponseUtils.kt | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) 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 0a8a6e69ee02..cfc18f6664d8 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 @@ -294,8 +294,7 @@ public MediaModel( @Nullable String fileUrlMediumSize, @Nullable String fileUrlMediumLargeSize, @Nullable String fileUrlLargeSize, - boolean deleted - ) { + boolean deleted) { this.mLocalSiteId = localSiteId; this.mMediaId = mediaId; this.mPostId = postId; diff --git a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt index 34c6af360b86..2ddc4a7b44a1 100644 --- a/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt +++ b/libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/media/MediaWPRestResponse.kt @@ -90,5 +90,5 @@ fun MediaWPRESTResponse.toMediaModel(localSiteId: Int) = MediaModel( null, null, null, - MediaWPComRestResponse.DELETED_STATUS == status, + MediaWPComRestResponse.DELETED_STATUS == status ) 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 ff18d3abd471..a80cf91652a6 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 @@ -5,7 +5,6 @@ import org.apache.commons.text.StringEscapeUtils import org.wordpress.android.fluxc.model.MediaModel import org.wordpress.android.fluxc.model.MediaModel.MediaUploadState import org.wordpress.android.fluxc.network.rest.wpcom.media.MediaWPComRestResponse.MultipleMediaResponse -import org.wordpress.android.util.MapUtils import javax.inject.Inject class MediaResponseUtils @@ -62,6 +61,6 @@ class MediaResponseUtils from.thumbnails?.let { if (!TextUtils.isEmpty(it.large)) it.large else null }, MediaWPComRestResponse.DELETED_STATUS == from.status, ).apply { - from.size + fileSizeFromatted = from.size } } From a2e40a7593d28dd11c9b22b4685850cab8678f3c Mon Sep 17 00:00:00 2001 From: adalpari Date: Thu, 18 Sep 2025 14:59:29 +0200 Subject: [PATCH 11/11] typo --- .../android/ui/media/MediaSettingsActivity.java | 4 ++-- .../wordpress/android/fluxc/model/MediaModel.java | 13 +++++++------ .../network/rest/wpcom/media/MediaResponseUtils.kt | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) 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 8f8b784b628d..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,8 +660,8 @@ 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.getFileSizeFromatted() != null) { - mFileSizeView.setText(mMedia.getFileSizeFromatted()); + } 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 { 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 cfc18f6664d8..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,7 +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 mFileSizeFromatted; + @Nullable @Column private String mFileSizeFormatted; // Descriptive strings @Nullable @Column private String mTitle; @@ -144,7 +144,7 @@ public MediaModel() { this.mFileExtension = null; this.mMimeType = null; this.mFileSize = 0; - this.mFileSizeFromatted = null; + this.mFileSizeFormatted = null; this.mTitle = null; this.mCaption = ""; this.mDescription = ""; @@ -491,12 +491,13 @@ public long getFileSize() { return mFileSize; } - public void setFileSizeFromatted(String fileSizeFormatted) { - mFileSizeFromatted = fileSizeFormatted; + public void setFileSizeFormatted(@Nullable String fileSizeFormatted) { + mFileSizeFormatted = fileSizeFormatted; } - public String getFileSizeFromatted() { - return mFileSizeFromatted; + @Nullable + public String getFileSizeFormatted() { + return mFileSizeFormatted; } public void setTitle(@Nullable String 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 a80cf91652a6..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 @@ -61,6 +61,6 @@ class MediaResponseUtils from.thumbnails?.let { if (!TextUtils.isEmpty(it.large)) it.large else null }, MediaWPComRestResponse.DELETED_STATUS == from.status, ).apply { - fileSizeFromatted = from.size + fileSizeFormatted = from.size } }