mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
add error message on MMS compression failed
This commit is contained in:
@@ -671,6 +671,13 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
if (compressedUri != null) {
|
if (compressedUri != null) {
|
||||||
attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false)
|
attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false)
|
||||||
loadAttachmentPreview(attachmentView, compressedUri)
|
loadAttachmentPreview(attachmentView, compressedUri)
|
||||||
|
} else {
|
||||||
|
toast(R.string.compress_error)
|
||||||
|
thread_attachments_wrapper.removeView(attachmentView)
|
||||||
|
attachmentSelections.remove(originalUriString)
|
||||||
|
if (attachmentSelections.isEmpty()) {
|
||||||
|
thread_attachments_holder.beGone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
checkSendMessageAvailability()
|
checkSendMessageAvailability()
|
||||||
attachmentView.thread_attachment_progress.beGone()
|
attachmentView.thread_attachment_progress.beGone()
|
||||||
|
@@ -106,7 +106,11 @@ class ImageCompressor(private val context: Context) {
|
|||||||
private var iteration: Int = 0
|
private var iteration: Int = 0
|
||||||
|
|
||||||
fun isSatisfied(imageFile: File): Boolean {
|
fun isSatisfied(imageFile: File): Boolean {
|
||||||
return imageFile.length() <= maxFileSize || iteration >= maxIteration
|
// If size requirement is not met and iteration is maxed
|
||||||
|
if(iteration >= maxIteration && imageFile.length() >= maxFileSize) {
|
||||||
|
throw Exception("Unable to compress image to targeted size")
|
||||||
|
}
|
||||||
|
return imageFile.length() <= maxFileSize
|
||||||
}
|
}
|
||||||
|
|
||||||
fun satisfy(imageFile: File): File {
|
fun satisfy(imageFile: File): File {
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
<string name="pin_conversation">Pin to the top</string>
|
<string name="pin_conversation">Pin to the top</string>
|
||||||
<string name="unpin_conversation">Unpin</string>
|
<string name="unpin_conversation">Unpin</string>
|
||||||
<string name="forward_message">Forward</string>
|
<string name="forward_message">Forward</string>
|
||||||
|
<string name="compress_error">Unable to compress image to selected size</string>
|
||||||
<!-- New conversation -->
|
<!-- New conversation -->
|
||||||
<string name="new_conversation">New conversation</string>
|
<string name="new_conversation">New conversation</string>
|
||||||
<string name="add_contact_or_number">Add Contact or Number…</string>
|
<string name="add_contact_or_number">Add Contact or Number…</string>
|
||||||
|
Reference in New Issue
Block a user