-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CMM 628 add filesize to the media screen #22216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4e8d581
f9fc6c6
907f13c
4c3a7f0
eaec3e0
7fe4b9d
03b2deb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 @@ | |
| private SeekBar mImageSizeSeekBarView; | ||
| private Spinner mAlignmentSpinnerView; | ||
| private FloatingActionButton mFabView; | ||
| private TextView mFileSizeView; | ||
| private TextView mFileSizeLabelView; | ||
Check noticeCode scanning / Android Lint Nullable/NonNull annotation missing on field Note
Missing null annotation
|
||
|
|
||
| private AlertDialog mDeleteMediaConfirmationDialog; | ||
|
|
||
|
|
@@ -256,6 +259,8 @@ | |
| 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,24 @@ | |
| 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) | ||
| }; | ||
|
Comment on lines
+652
to
+658
|
||
| String formattedSize = FormatUtils.formatFileSize(mMedia.getFileSize(), units); | ||
| mFileSizeView.setText(formattedSize); | ||
| 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I tested how the library creates the DB column, it looks like even it being a long variable, WellSql uses an INTEGER. So, I've just followed the approach to avoid side problems.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the "library" in this context?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
| } | ||
| db.setTransactionSuccessful() | ||
|
|
||

Check notice
Code scanning / Android Lint
Nullable/NonNull annotation missing on field Note