Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
Expand Down