From 664346e8a9dd695bba02c619aaf6a4cc5187380d Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Sun, 5 Sep 2021 20:45:04 +0100 Subject: [PATCH 01/31] feat: compress images before sending --- app/src/main/AndroidManifest.xml | 10 ++ .../smsmessenger/activities/ThreadActivity.kt | 77 ++++++++++-- .../smsmessenger/extensions/Bitmap.kt | 9 ++ .../smsmessenger/extensions/String.kt | 16 +++ .../smsmessenger/helpers/Constants.kt | 2 + .../smsmessenger/helpers/ImageCompressor.kt | 115 ++++++++++++++++++ .../models/AttachmentSelection.kt | 8 ++ app/src/main/res/layout/item_attachment.xml | 15 ++- app/src/main/res/xml/provider_paths.xml | 4 + 9 files changed, 241 insertions(+), 15 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Bitmap.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/AttachmentSelection.kt create mode 100644 app/src/main/res/xml/provider_paths.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a40d3d85..ea66d25e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -195,6 +195,16 @@ + + + + () private var messages = ArrayList() private val availableSIMCards = ArrayList() - private var attachmentUris = LinkedHashSet() + private var attachmentSelections = mutableMapOf() + private val imageCompressor by lazy { ImageCompressor(this) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -569,7 +572,7 @@ class ThreadActivity : SimpleActivity() { conversationsDB.markRead(threadId) } - if (i == cnt - 1 && (message.type == Telephony.Sms.MESSAGE_TYPE_SENT )) { + if (i == cnt - 1 && (message.type == Telephony.Sms.MESSAGE_TYPE_SENT)) { items.add(ThreadSent(message.id, delivered = message.status == Telephony.Sms.STATUS_COMPLETE)) } } @@ -592,23 +595,67 @@ class ThreadActivity : SimpleActivity() { } private fun addAttachment(uri: Uri) { - if (attachmentUris.contains(uri)) { + val originalUriString = uri.toString() + if (attachmentSelections.containsKey(originalUriString)) { return } - attachmentUris.add(uri) + attachmentSelections[originalUriString] = AttachmentSelection(uri, false) + val attachmentView = addAttachmentView(originalUriString, uri) + val mimeType = contentResolver.getType(uri) + Log.e(TAG, "Selected image: mimetype=$mimeType uri=$uri") + if (mimeType == null) { + Log.e(TAG, "addAttachment: null mime type for uri: $uri") + return + } + + if (mimeType.isImageMimeType()) { + Log.d(TAG, "addAttachment: attachment is an image mimetype=$mimeType") + val byteArray = contentResolver.openInputStream(uri)?.readBytes() + if (byteArray == null) { + Log.e(TAG, "addAttachment: null stream for: $uri") + return + } + + val selection = attachmentSelections[originalUriString] + attachmentSelections[originalUriString] = selection!!.copy(isPending = true) + checkSendMessageAvailability() + attachmentView.thread_attachment_progress.beVisible() + imageCompressor.compressImage(byteArray, mimeType, IMAGE_COMPRESS_SIZE) { compressedUri -> + runOnUiThread { + if (compressedUri != null) { + Log.e(TAG, "Compressed successfully compressedUri=$compressedUri") + attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false) + loadAttachmentPreview(attachmentView, compressedUri) + } else { + Log.e(TAG, "addAttachment: Failed to compress image: uri=$uri") + } + checkSendMessageAvailability() + attachmentView.thread_attachment_progress.beGone() + } + } + } else { + Log.d(TAG, "addAttachment: not an image") + } + } + + private fun addAttachmentView(originalUri: String, uri: Uri): View { thread_attachments_holder.beVisible() val attachmentView = layoutInflater.inflate(R.layout.item_attachment, null).apply { thread_attachments_wrapper.addView(this) thread_remove_attachment.setOnClickListener { thread_attachments_wrapper.removeView(this) - attachmentUris.remove(uri) - if (attachmentUris.isEmpty()) { + attachmentSelections.remove(originalUri) + if (attachmentSelections.isEmpty()) { thread_attachments_holder.beGone() } } } + loadAttachmentPreview(attachmentView, uri) + return attachmentView + } + private fun loadAttachmentPreview(attachmentView: View, uri: Uri) { val roundedCornersRadius = resources.getDimension(R.dimen.medium_margin).toInt() val options = RequestOptions() .diskCacheStrategy(DiskCacheStrategy.NONE) @@ -636,7 +683,7 @@ class ThreadActivity : SimpleActivity() { } private fun checkSendMessageAvailability() { - if (thread_type_message.text.isNotEmpty() || attachmentUris.isNotEmpty()) { + if (thread_type_message.text.isNotEmpty() || (attachmentSelections.isNotEmpty() && !attachmentSelections.values.any { it.isPending })) { thread_send_message.isClickable = true thread_send_message.alpha = 0.9f } else { @@ -647,7 +694,7 @@ class ThreadActivity : SimpleActivity() { private fun sendMessage() { val msg = thread_type_message.value - if (msg.isEmpty() && attachmentUris.isEmpty()) { + if (msg.isEmpty() && attachmentSelections.isEmpty()) { return } @@ -673,15 +720,19 @@ class ThreadActivity : SimpleActivity() { val transaction = Transaction(this, settings) val message = com.klinker.android.send_message.Message(msg, numbers.toTypedArray()) - if (attachmentUris.isNotEmpty()) { - for (uri in attachmentUris) { + if (attachmentSelections.isNotEmpty()) { + for (selection in attachmentSelections.values) { + Log.d(TAG, "sendMessage:attachmentUri=$selection") try { - val byteArray = contentResolver.openInputStream(uri)?.readBytes() ?: continue - val mimeType = contentResolver.getType(uri) ?: continue + val byteArray = contentResolver.openInputStream(selection.uri)?.readBytes() ?: continue + val mimeType = contentResolver.getType(selection.uri) ?: continue message.addMedia(byteArray, mimeType) + Log.d(TAG, "sendMessage: byteArray: ${byteArray.size} -- mimeType=$mimeType") } catch (e: Exception) { + Log.e(TAG, "sendMessage: ", e) showErrorToast(e) } catch (e: Error) { + Log.e(TAG, "sendMessage error: ", e) toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred)) } } @@ -697,7 +748,7 @@ class ThreadActivity : SimpleActivity() { refreshedSinceSent = false transaction.sendNewMessage(message, threadId) thread_type_message.setText("") - attachmentUris.clear() + attachmentSelections.clear() thread_attachments_holder.beGone() thread_attachments_wrapper.removeAllViews() diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Bitmap.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Bitmap.kt new file mode 100644 index 00000000..c55bbe7b --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Bitmap.kt @@ -0,0 +1,9 @@ +package com.simplemobiletools.smsmessenger.extensions + +import android.graphics.Bitmap + +fun Bitmap.CompressFormat.extension() = when (this) { + Bitmap.CompressFormat.PNG -> "png" + Bitmap.CompressFormat.WEBP -> "webp" + else -> "jpg" +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt new file mode 100644 index 00000000..5ad98f55 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt @@ -0,0 +1,16 @@ +package com.simplemobiletools.smsmessenger.extensions + +fun String.getExtensionFromMimeType(): String { + return when (this) { + "image/png" -> ".png" + "image/apng" -> ".apng" + "image/webp" -> ".webp" + "image/svg+xml" -> ".svg" + "image/gif" -> ".gif" + else -> ".jpg" + } +} + +fun String.isImageMimeType(): Boolean { + return startsWith("image") +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index 36025476..820f8452 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -33,6 +33,8 @@ const val LOCK_SCREEN_SENDER_MESSAGE = 1 const val LOCK_SCREEN_SENDER = 2 const val LOCK_SCREEN_NOTHING = 3 +const val IMAGE_COMPRESS_SIZE = 1_048_576L + fun refreshMessages() { EventBus.getDefault().post(Events.RefreshMessages()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt new file mode 100644 index 00000000..f642b2a4 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt @@ -0,0 +1,115 @@ +package com.simplemobiletools.smsmessenger.helpers + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Matrix +import android.media.ExifInterface +import android.net.Uri +import android.util.Log +import com.simplemobiletools.commons.extensions.getCompressionFormat +import com.simplemobiletools.commons.extensions.getMyFileUri +import com.simplemobiletools.commons.helpers.ensureBackgroundThread +import com.simplemobiletools.smsmessenger.extensions.extension +import com.simplemobiletools.smsmessenger.extensions.getExtensionFromMimeType +import java.io.File +import java.io.FileOutputStream + +/** + * Compress image to a given size based on + * [Compressor](https://github.com/zetbaitsu/Compressor/) + * */ +class ImageCompressor(private val context: Context) { + companion object { + private const val TAG = "ImageCompressor" + } + + private val outputDirectory = File(context.cacheDir, "compressed").apply { + mkdirs() + } + + fun compressImage(byteArray: ByteArray, mimeType: String, compressSize: Long, callback: (compressedFileUri: Uri?) -> Unit) { + ensureBackgroundThread { + try { + Log.d(TAG, "Attempting to compress image of length: ${byteArray.size} of mimetype=$mimeType to size=$compressSize") + var destinationFile = File(outputDirectory, System.currentTimeMillis().toString().plus(mimeType.getExtensionFromMimeType())) + Log.d(TAG, "compressImage: Saving file to: $destinationFile") + destinationFile.writeBytes(byteArray) + Log.d(TAG, "Written file to: $destinationFile") + val constraint = SizeConstraint(compressSize) + Log.d(TAG, "Starting compression...") + while (constraint.isSatisfied(destinationFile).not()) { + destinationFile = constraint.satisfy(destinationFile) + Log.d(TAG, "Compressed, new size is ${destinationFile.length()}") + } + + Log.d(TAG, "Compression done, new size is ${destinationFile.length()}") + callback.invoke(context.getMyFileUri(destinationFile)) + } catch (e: Exception) { + Log.e(TAG, "compressImage: ", e) + callback.invoke(null) + } + } + } + + private fun overWrite(imageFile: File, bitmap: Bitmap, format: Bitmap.CompressFormat = imageFile.path.getCompressionFormat(), quality: Int = 100): File { + val result = if (format == imageFile.path.getCompressionFormat()) { + imageFile + } else { + File("${imageFile.absolutePath.substringBeforeLast(".")}.${format.extension()}") + } + imageFile.delete() + saveBitmap(bitmap, result, format, quality) + return result + } + + private fun saveBitmap(bitmap: Bitmap, destination: File, format: Bitmap.CompressFormat = destination.path.getCompressionFormat(), quality: Int = 100) { + destination.parentFile?.mkdirs() + var fileOutputStream: FileOutputStream? = null + try { + fileOutputStream = FileOutputStream(destination.absolutePath) + bitmap.compress(format, quality, fileOutputStream) + } finally { + fileOutputStream?.run { + flush() + close() + } + } + } + + private fun loadBitmap(imageFile: File) = BitmapFactory.decodeFile(imageFile.absolutePath).run { + determineImageRotation(imageFile, this) + } + + private fun determineImageRotation(imageFile: File, bitmap: Bitmap): Bitmap { + val exif = ExifInterface(imageFile.absolutePath) + val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0) + val matrix = Matrix() + when (orientation) { + 6 -> matrix.postRotate(90f) + 3 -> matrix.postRotate(180f) + 8 -> matrix.postRotate(270f) + } + return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) + } + + private inner class SizeConstraint( + private val maxFileSize: Long, + private val stepSize: Int = 10, + private val maxIteration: Int = 10, + private val minQuality: Int = 10 + ) { + private var iteration: Int = 0 + + fun isSatisfied(imageFile: File): Boolean { + return imageFile.length() <= maxFileSize || iteration >= maxIteration + } + + fun satisfy(imageFile: File): File { + iteration++ + val quality = (100 - iteration * stepSize).takeIf { it >= minQuality } ?: minQuality + return overWrite(imageFile, loadBitmap(imageFile), quality = quality) + } + } + +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/AttachmentSelection.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/AttachmentSelection.kt new file mode 100644 index 00000000..e56835d2 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/AttachmentSelection.kt @@ -0,0 +1,8 @@ +package com.simplemobiletools.smsmessenger.models + +import android.net.Uri + +data class AttachmentSelection( + val uri: Uri, + val isPending: Boolean, +) diff --git a/app/src/main/res/layout/item_attachment.xml b/app/src/main/res/layout/item_attachment.xml index ee25d173..8a620499 100644 --- a/app/src/main/res/layout/item_attachment.xml +++ b/app/src/main/res/layout/item_attachment.xml @@ -1,5 +1,6 @@ @@ -8,7 +9,16 @@ android:id="@+id/thread_attachment_preview" android:layout_width="@dimen/attachment_preview_size" android:layout_height="@dimen/attachment_preview_size" - android:visibility="gone" /> + android:visibility="gone" + tools:visibility="visible" /> + + + android:visibility="gone" + tools:visibility="visible" /> diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 00000000..d2c19fcd --- /dev/null +++ b/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,4 @@ + + + + From 0124c6e2f7ebde4266161a487df900a75377e1c3 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Sun, 5 Sep 2021 23:17:46 +0100 Subject: [PATCH 02/31] clean up --- .../smsmessenger/activities/ThreadActivity.kt | 27 ++----------- .../smsmessenger/helpers/ImageCompressor.kt | 38 +++++++++---------- app/src/main/res/layout/item_attachment.xml | 4 +- 3 files changed, 23 insertions(+), 46 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 69d49502..15942180 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -602,40 +602,23 @@ class ThreadActivity : SimpleActivity() { attachmentSelections[originalUriString] = AttachmentSelection(uri, false) val attachmentView = addAttachmentView(originalUriString, uri) - val mimeType = contentResolver.getType(uri) - Log.e(TAG, "Selected image: mimetype=$mimeType uri=$uri") - if (mimeType == null) { - Log.e(TAG, "addAttachment: null mime type for uri: $uri") - return - } + val mimeType = contentResolver.getType(uri) ?: return if (mimeType.isImageMimeType()) { - Log.d(TAG, "addAttachment: attachment is an image mimetype=$mimeType") - val byteArray = contentResolver.openInputStream(uri)?.readBytes() - if (byteArray == null) { - Log.e(TAG, "addAttachment: null stream for: $uri") - return - } - val selection = attachmentSelections[originalUriString] attachmentSelections[originalUriString] = selection!!.copy(isPending = true) checkSendMessageAvailability() attachmentView.thread_attachment_progress.beVisible() - imageCompressor.compressImage(byteArray, mimeType, IMAGE_COMPRESS_SIZE) { compressedUri -> + imageCompressor.compressImage(uri, IMAGE_COMPRESS_SIZE) { compressedUri -> runOnUiThread { if (compressedUri != null) { - Log.e(TAG, "Compressed successfully compressedUri=$compressedUri") attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false) loadAttachmentPreview(attachmentView, compressedUri) - } else { - Log.e(TAG, "addAttachment: Failed to compress image: uri=$uri") } checkSendMessageAvailability() attachmentView.thread_attachment_progress.beGone() } } - } else { - Log.d(TAG, "addAttachment: not an image") } } @@ -661,7 +644,7 @@ class ThreadActivity : SimpleActivity() { .diskCacheStrategy(DiskCacheStrategy.NONE) .transform(CenterCrop(), RoundedCorners(roundedCornersRadius)) - Glide.with(this) + Glide.with(attachmentView.thread_attachment_preview) .load(uri) .transition(DrawableTransitionOptions.withCrossFade()) .apply(options) @@ -722,17 +705,13 @@ class ThreadActivity : SimpleActivity() { if (attachmentSelections.isNotEmpty()) { for (selection in attachmentSelections.values) { - Log.d(TAG, "sendMessage:attachmentUri=$selection") try { val byteArray = contentResolver.openInputStream(selection.uri)?.readBytes() ?: continue val mimeType = contentResolver.getType(selection.uri) ?: continue message.addMedia(byteArray, mimeType) - Log.d(TAG, "sendMessage: byteArray: ${byteArray.size} -- mimeType=$mimeType") } catch (e: Exception) { - Log.e(TAG, "sendMessage: ", e) showErrorToast(e) } catch (e: Error) { - Log.e(TAG, "sendMessage error: ", e) toast(e.localizedMessage ?: getString(R.string.unknown_error_occurred)) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt index f642b2a4..50523678 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt @@ -6,12 +6,12 @@ import android.graphics.BitmapFactory import android.graphics.Matrix import android.media.ExifInterface import android.net.Uri -import android.util.Log import com.simplemobiletools.commons.extensions.getCompressionFormat import com.simplemobiletools.commons.extensions.getMyFileUri import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.smsmessenger.extensions.extension import com.simplemobiletools.smsmessenger.extensions.getExtensionFromMimeType +import com.simplemobiletools.smsmessenger.extensions.isImageMimeType import java.io.File import java.io.FileOutputStream @@ -20,33 +20,31 @@ import java.io.FileOutputStream * [Compressor](https://github.com/zetbaitsu/Compressor/) * */ class ImageCompressor(private val context: Context) { - companion object { - private const val TAG = "ImageCompressor" - } + private val contentResolver = context.contentResolver private val outputDirectory = File(context.cacheDir, "compressed").apply { - mkdirs() + if (!exists()) { + mkdirs() + } } - fun compressImage(byteArray: ByteArray, mimeType: String, compressSize: Long, callback: (compressedFileUri: Uri?) -> Unit) { + fun compressImage(uri: Uri, compressSize: Long, callback: (compressedFileUri: Uri?) -> Unit) { ensureBackgroundThread { try { - Log.d(TAG, "Attempting to compress image of length: ${byteArray.size} of mimetype=$mimeType to size=$compressSize") - var destinationFile = File(outputDirectory, System.currentTimeMillis().toString().plus(mimeType.getExtensionFromMimeType())) - Log.d(TAG, "compressImage: Saving file to: $destinationFile") - destinationFile.writeBytes(byteArray) - Log.d(TAG, "Written file to: $destinationFile") - val constraint = SizeConstraint(compressSize) - Log.d(TAG, "Starting compression...") - while (constraint.isSatisfied(destinationFile).not()) { - destinationFile = constraint.satisfy(destinationFile) - Log.d(TAG, "Compressed, new size is ${destinationFile.length()}") + val mimeType = contentResolver.getType(uri)!! + if (mimeType.isImageMimeType()) { + val byteArray = contentResolver.openInputStream(uri)?.readBytes()!! + var destinationFile = File(outputDirectory, System.currentTimeMillis().toString().plus(mimeType.getExtensionFromMimeType())) + destinationFile.writeBytes(byteArray) + val constraint = SizeConstraint(compressSize) + while (constraint.isSatisfied(destinationFile).not()) { + destinationFile = constraint.satisfy(destinationFile) + } + callback.invoke(context.getMyFileUri(destinationFile)) + } else { + callback.invoke(null) } - - Log.d(TAG, "Compression done, new size is ${destinationFile.length()}") - callback.invoke(context.getMyFileUri(destinationFile)) } catch (e: Exception) { - Log.e(TAG, "compressImage: ", e) callback.invoke(null) } } diff --git a/app/src/main/res/layout/item_attachment.xml b/app/src/main/res/layout/item_attachment.xml index 8a620499..be794651 100644 --- a/app/src/main/res/layout/item_attachment.xml +++ b/app/src/main/res/layout/item_attachment.xml @@ -2,8 +2,8 @@ + android:layout_width="@dimen/attachment_preview_size" + android:layout_height="@dimen/attachment_preview_size"> Date: Mon, 6 Sep 2021 10:12:51 +0200 Subject: [PATCH 03/31] Added removing diacritics (#29) --- .../activities/SettingsActivity.kt | 8 +++++++ .../smsmessenger/activities/ThreadActivity.kt | 4 +++- .../smsmessenger/extensions/Context.kt | 11 +++++++++ .../smsmessenger/helpers/Config.kt | 4 ++++ .../smsmessenger/helpers/Constants.kt | 1 + .../receivers/DirectReplyReceiver.kt | 5 +++- app/src/main/res/layout/activity_settings.xml | 23 +++++++++++++++++++ app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-id/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-ml/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 28 files changed, 75 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt index 96f7f99e..e4758a47 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt @@ -40,6 +40,7 @@ class SettingsActivity : SimpleActivity() { setupChangeDateTimeFormat() setupFontSize() setupShowCharacterCounter() + setupUseSimpleCharacters() setupEnableDeliveryReports() setupLockScreenVisibility() updateTextColors(settings_scrollview) @@ -131,6 +132,13 @@ class SettingsActivity : SimpleActivity() { config.showCharacterCounter = settings_show_character_counter.isChecked } } + private fun setupUseSimpleCharacters() { + settings_use_simple_characters.isChecked = config.useSimpleCharacters + settings_use_simple_characters_holder.setOnClickListener { + settings_use_simple_characters.toggle() + config.useSimpleCharacters = settings_use_simple_characters.isChecked + } + } private fun setupEnableDeliveryReports() { settings_enable_delivery_reports.isChecked = config.enableDeliveryReports diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index f235f327..d50548d9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -646,11 +646,13 @@ class ThreadActivity : SimpleActivity() { } private fun sendMessage() { - val msg = thread_type_message.value + var msg = thread_type_message.value if (msg.isEmpty() && attachmentUris.isEmpty()) { return } + msg = removeDiacriticsIfNeeded(msg) + val numbers = ArrayList() participants.forEach { it.phoneNumbers.forEach { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index cb55e7c8..dc51d437 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -38,6 +38,7 @@ import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver import java.util.* import kotlin.collections.ArrayList import me.leolin.shortcutbadger.ShortcutBadger +import java.text.Normalizer val Context.config: Config get() = Config.newInstance(applicationContext) @@ -764,3 +765,13 @@ fun Context.getLockScreenVisibilityText(type: Int) = getString( else -> R.string.nothing } ) + +fun Context.removeDiacriticsIfNeeded(text: String): String { + var msg = text + if (config.useSimpleCharacters) { + msg = Normalizer.normalize(msg, Normalizer.Form.NFD) + msg = msg.replace("\\p{InCombiningDiacriticalMarks}+".toRegex(), "") + } + + return msg +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt index e284b832..c6b6576d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt @@ -18,6 +18,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_CHARACTER_COUNTER, false) set(showCharacterCounter) = prefs.edit().putBoolean(SHOW_CHARACTER_COUNTER, showCharacterCounter).apply() + var useSimpleCharacters: Boolean + get() = prefs.getBoolean(USE_SIMPLE_CHARACTERS, false) + set(useSimpleCharacters) = prefs.edit().putBoolean(USE_SIMPLE_CHARACTERS, useSimpleCharacters).apply() + var enableDeliveryReports: Boolean get() = prefs.getBoolean(ENABLE_DELIVERY_REPORTS, true) set(enableDeliveryReports) = prefs.edit().putBoolean(ENABLE_DELIVERY_REPORTS, enableDeliveryReports).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index 36025476..6fbb310e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -13,6 +13,7 @@ const val SEARCHED_MESSAGE_ID = "searched_message_id" const val USE_SIM_ID_PREFIX = "use_sim_id_" const val NOTIFICATION_CHANNEL = "simple_sms_messenger" const val SHOW_CHARACTER_COUNTER = "show_character_counter" +const val USE_SIMPLE_CHARACTERS = "use_simple_characters" const val LOCK_SCREEN_VISIBILITY = "lock_screen_visibility" const val ENABLE_DELIVERY_REPORTS = "enable_delivery_reports" diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/DirectReplyReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/DirectReplyReceiver.kt index 8a4ee30c..79e333b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/DirectReplyReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/DirectReplyReceiver.kt @@ -11,6 +11,7 @@ import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.smsmessenger.extensions.conversationsDB import com.simplemobiletools.smsmessenger.extensions.markThreadMessagesRead +import com.simplemobiletools.smsmessenger.extensions.removeDiacriticsIfNeeded import com.simplemobiletools.smsmessenger.helpers.REPLY import com.simplemobiletools.smsmessenger.helpers.THREAD_ID import com.simplemobiletools.smsmessenger.helpers.THREAD_NUMBER @@ -19,7 +20,9 @@ class DirectReplyReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val address = intent.getStringExtra(THREAD_NUMBER) val threadId = intent.getLongExtra(THREAD_ID, 0L) - val msg = RemoteInput.getResultsFromIntent(intent).getCharSequence(REPLY)?.toString() ?: return + var msg = RemoteInput.getResultsFromIntent(intent).getCharSequence(REPLY)?.toString() ?: return + + msg = context.removeDiacriticsIfNeeded(msg) val settings = Settings() settings.useSystemSending = true diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 859fdf00..0d4ff987 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -195,6 +195,29 @@ + + + + + + Sender and message Sender only Enable delivery reports + Use simple characters Proč aplikace vyžaduje přístup k internetu? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index d9067fb0..dba3e2b1 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Hvorfor kræver appen adgang til internettet? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d7e5e614..f8a464c5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Warum benötigt diese App Internetzugriff? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 73901649..63d34b27 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -49,6 +49,7 @@ Αποστολέας και μήνυμα Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης + Use simple characters Γιατί η εφαρμογή απαιτεί πρόσβαση στο Internet; diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 0f2ec0f6..1f87d8d5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters ¿Por qué la aplicación requiere acceso a internet? diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 3f6b221f..16ff75bf 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Miksi sovellus vaatii Internet-yhteyden? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index acf8de23..c8c84a92 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Pourquoi cette application a besoin d\'un accès à internet ? diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 0db16d26..0d67e3bc 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Mengapa aplikasi membutuhkan akses ke internet? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b6201852..e415666f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -49,6 +49,7 @@ Mittente e messaggio Solo mittente Abilita conferma di consegna + Use simple characters Perché l\'applicazione richiede l\'accesso ad internet? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8c5071ec..fa321c9e 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters なぜアプリ使用にインターネットへのアクセスが必要なのですか? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index ea039ad8..542561ea 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Why does the app require access to the internet? diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 366149ef..f6d9e372 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters അപ്ലിക്കേഷന് ഇന്റർനെറ്റിലേക്ക് ആവശ്യമായി വരുന്നത് എന്തുകൊണ്ട്? diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 0f9e313a..eebdf894 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,6 +49,7 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen + Use simple characters Waarom heeft deze app toegang nodig tot het internet? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7bc60f8a..b4705dc0 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -51,6 +51,7 @@ Nadawca i treść Tylko nadawca Włącz raporty doręczeń + Używaj prostych znaków Dlaczego aplikacja wymaga dostępu do Internetu? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index f6cf255b..c4d133b0 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Porque é que a aplicação necessita de aceder à Internet? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f6944577..2ac76d52 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -51,6 +51,7 @@ Отправитель и сообщение Только отправитель Использовать отчёты о доставке + Use simple characters Почему приложение требует доступ к интернету? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f1092bb8..b3c06f1e 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,6 +51,7 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení + Use simple characters Prečo vyžaduje apka prístup na internet? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f7a3224e..5785eeda 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Uygulama neden internete erişim gerektiriyor? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index b0a239d0..a2156150 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Чому додаток потрубує доступу до інтернету? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b6542e07..9a49e535 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters 为什么该应用需要访问互联网? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a85b6837..68b1c3d0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,6 +49,7 @@ Sender and message Sender only Enable delivery reports + Use simple characters Why does the app require access to the internet? From b317507370dcfb04d0e1d073fb369d0b625c31b5 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Mon, 6 Sep 2021 11:13:28 +0100 Subject: [PATCH 04/31] convert image mimetype to lowercase, remove unused imports/tags --- .../simplemobiletools/smsmessenger/activities/ThreadActivity.kt | 2 -- .../com/simplemobiletools/smsmessenger/extensions/String.kt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 15942180..702a3f15 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -13,7 +13,6 @@ import android.os.Handler import android.provider.Telephony import android.telephony.SubscriptionManager import android.text.TextUtils -import android.util.Log import android.util.TypedValue import android.view.* import android.view.inputmethod.EditorInfo @@ -55,7 +54,6 @@ import org.greenrobot.eventbus.ThreadMode class ThreadActivity : SimpleActivity() { private val MIN_DATE_TIME_DIFF_SECS = 300 private val PICK_ATTACHMENT_INTENT = 1 - private val TAG = "ThreadActivity" private var threadId = 0L private var currentSIMCardIndex = 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt index 5ad98f55..6731a7e2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt @@ -12,5 +12,5 @@ fun String.getExtensionFromMimeType(): String { } fun String.isImageMimeType(): Boolean { - return startsWith("image") + return lowercase().startsWith("image") } From c3c2ce4ee34e7906bf60b5a924e1b7487933b8d4 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Mon, 6 Sep 2021 22:25:38 +0100 Subject: [PATCH 05/31] feat: add settings option to customise the MMS file size limit --- .../activities/SettingsActivity.kt | 30 ++++++++++++++--- .../smsmessenger/activities/ThreadActivity.kt | 4 +-- .../smsmessenger/extensions/Context.kt | 12 +++++++ .../smsmessenger/helpers/Config.kt | 4 +++ .../smsmessenger/helpers/Constants.kt | 9 ++++- app/src/main/res/layout/activity_settings.xml | 33 +++++++++++++++++++ app/src/main/res/values-cs/strings.xml | 8 +++++ app/src/main/res/values-da/strings.xml | 8 +++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 8 +++++ app/src/main/res/values-es/strings.xml | 8 +++++ app/src/main/res/values-fi/strings.xml | 8 +++++ app/src/main/res/values-fr/strings.xml | 8 +++++ app/src/main/res/values-id/strings.xml | 9 +++++ app/src/main/res/values-it/strings.xml | 8 +++++ app/src/main/res/values-ja/strings.xml | 8 +++++ app/src/main/res/values-lt/strings.xml | 8 +++++ app/src/main/res/values-ml/strings.xml | 8 +++++ app/src/main/res/values-nl/strings.xml | 8 +++++ app/src/main/res/values-pl/strings.xml | 8 +++++ app/src/main/res/values-pt/strings.xml | 8 +++++ app/src/main/res/values-ru/strings.xml | 8 +++++ app/src/main/res/values-sk/strings.xml | 8 +++++ app/src/main/res/values-tr/strings.xml | 8 +++++ app/src/main/res/values-uk/strings.xml | 8 +++++ app/src/main/res/values-zh-rCN/strings.xml | 8 +++++ app/src/main/res/values/strings.xml | 8 +++++ 27 files changed, 246 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt index 96f7f99e..ab012e2f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt @@ -14,12 +14,10 @@ import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.getLockScreenVisibilityText -import com.simplemobiletools.smsmessenger.helpers.LOCK_SCREEN_NOTHING -import com.simplemobiletools.smsmessenger.helpers.LOCK_SCREEN_SENDER -import com.simplemobiletools.smsmessenger.helpers.LOCK_SCREEN_SENDER_MESSAGE -import com.simplemobiletools.smsmessenger.helpers.refreshMessages -import kotlinx.android.synthetic.main.activity_settings.* +import com.simplemobiletools.smsmessenger.extensions.getMMSFileLimitText +import com.simplemobiletools.smsmessenger.helpers.* import java.util.* +import kotlinx.android.synthetic.main.activity_settings.* class SettingsActivity : SimpleActivity() { private var blockedNumbersAtPause = -1 @@ -42,6 +40,7 @@ class SettingsActivity : SimpleActivity() { setupShowCharacterCounter() setupEnableDeliveryReports() setupLockScreenVisibility() + setupMMSFileSizeLimit() updateTextColors(settings_scrollview) if (blockedNumbersAtPause != -1 && blockedNumbersAtPause != getBlockedNumbers().hashCode()) { @@ -155,4 +154,25 @@ class SettingsActivity : SimpleActivity() { } } } + + private fun setupMMSFileSizeLimit() { + settings_mms_file_size_limit.text = getMMSFileLimitText(config.mmsFileSizeLimit) + settings_mms_file_size_limit_holder.setOnClickListener { + val items = arrayListOf( + RadioItem(1, getString(R.string.mms_file_size_limit_100kb), FILE_SIZE_100_KB), + RadioItem(2, getString(R.string.mms_file_size_limit_200kb), FILE_SIZE_200_KB), + RadioItem(3, getString(R.string.mms_file_size_limit_300kb), FILE_SIZE_300_KB), + RadioItem(4, getString(R.string.mms_file_size_limit_600kb), FILE_SIZE_600_KB), + RadioItem(5, getString(R.string.mms_file_size_limit_1000kb), FILE_SIZE_1000_KB), + RadioItem(6, getString(R.string.mms_file_size_limit_2000kb), FILE_SIZE_2000_KB), + RadioItem(7, getString(R.string.mms_file_size_limit_none), FILE_SIZE_NONE), + ) + + val checkedItemId = items.find { it.value == config.mmsFileSizeLimit }?.id ?: 7 + RadioGroupDialog(this@SettingsActivity, items, checkedItemId) { + config.mmsFileSizeLimit = it as Long + settings_mms_file_size_limit.text = getMMSFileLimitText(config.mmsFileSizeLimit) + } + } + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 702a3f15..23a6ea9b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -602,12 +602,12 @@ class ThreadActivity : SimpleActivity() { val attachmentView = addAttachmentView(originalUriString, uri) val mimeType = contentResolver.getType(uri) ?: return - if (mimeType.isImageMimeType()) { + if (mimeType.isImageMimeType() && config.mmsFileSizeLimit != FILE_SIZE_NONE) { val selection = attachmentSelections[originalUriString] attachmentSelections[originalUriString] = selection!!.copy(isPending = true) checkSendMessageAvailability() attachmentView.thread_attachment_progress.beVisible() - imageCompressor.compressImage(uri, IMAGE_COMPRESS_SIZE) { compressedUri -> + imageCompressor.compressImage(uri, config.mmsFileSizeLimit) { compressedUri -> runOnUiThread { if (compressedUri != null) { attachmentSelections[originalUriString] = AttachmentSelection(compressedUri, false) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index cb55e7c8..f9e1fa1e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -764,3 +764,15 @@ fun Context.getLockScreenVisibilityText(type: Int) = getString( else -> R.string.nothing } ) + +fun Context.getMMSFileLimitText(size: Long) = getString( + when (size) { + FILE_SIZE_100_KB -> R.string.mms_file_size_limit_100kb + FILE_SIZE_200_KB -> R.string.mms_file_size_limit_200kb + FILE_SIZE_300_KB -> R.string.mms_file_size_limit_300kb + FILE_SIZE_600_KB -> R.string.mms_file_size_limit_600kb + FILE_SIZE_1000_KB -> R.string.mms_file_size_limit_1000kb + FILE_SIZE_2000_KB -> R.string.mms_file_size_limit_2000kb + else -> R.string.mms_file_size_limit_none + } +) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt index e284b832..c829383a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt @@ -25,4 +25,8 @@ class Config(context: Context) : BaseConfig(context) { var lockScreenVisibilitySetting: Int get() = prefs.getInt(LOCK_SCREEN_VISIBILITY, LOCK_SCREEN_SENDER_MESSAGE) set(lockScreenVisibilitySetting) = prefs.edit().putInt(LOCK_SCREEN_VISIBILITY, lockScreenVisibilitySetting).apply() + + var mmsFileSizeLimit: Long + get() = prefs.getLong(MMS_FILE_SIZE_LIMIT, FILE_SIZE_NONE) + set(mmsFileSizeLimit) = prefs.edit().putLong(MMS_FILE_SIZE_LIMIT, mmsFileSizeLimit).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index 820f8452..355eac22 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -15,6 +15,7 @@ const val NOTIFICATION_CHANNEL = "simple_sms_messenger" const val SHOW_CHARACTER_COUNTER = "show_character_counter" const val LOCK_SCREEN_VISIBILITY = "lock_screen_visibility" const val ENABLE_DELIVERY_REPORTS = "enable_delivery_reports" +const val MMS_FILE_SIZE_LIMIT = "mms_file_size_limit" private const val PATH = "com.simplemobiletools.smsmessenger.action." const val MARK_AS_READ = PATH + "mark_as_read" @@ -33,7 +34,13 @@ const val LOCK_SCREEN_SENDER_MESSAGE = 1 const val LOCK_SCREEN_SENDER = 2 const val LOCK_SCREEN_NOTHING = 3 -const val IMAGE_COMPRESS_SIZE = 1_048_576L +const val FILE_SIZE_NONE = -1L +const val FILE_SIZE_100_KB = 102_400L +const val FILE_SIZE_200_KB = 204_800L +const val FILE_SIZE_300_KB = 307_200L +const val FILE_SIZE_600_KB = 614_400L +const val FILE_SIZE_1000_KB = 1_048_576L +const val FILE_SIZE_2000_KB = 2_097_152L fun refreshMessages() { EventBus.getDefault().post(Events.RefreshMessages()) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 859fdf00..7e41cc22 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -250,5 +250,38 @@ tools:text="@string/sender_and_message" /> + + + + + + + + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 37651ec0..9da1f106 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Proč aplikace vyžaduje přístup k internetu? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index d9067fb0..f8dd2ace 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Hvorfor kræver appen adgang til internettet? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d7e5e614..3151dca1 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -50,6 +50,7 @@ Sender only Enable delivery reports + Warum benötigt diese App Internetzugriff? Leider ist dies nötig, um MMS-Anhänge zu versenden. Es wäre ein großer Nachteil gegenüber anderen Apps, wenn keine MMS versendet werden könnten, also haben wir uns für diesen Weg entschieden. diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 73901649..003bee2d 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -49,6 +49,14 @@ Αποστολέας και μήνυμα Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Γιατί η εφαρμογή απαιτεί πρόσβαση στο Internet; diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 0f2ec0f6..eb36c284 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit ¿Por qué la aplicación requiere acceso a internet? diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 3f6b221f..97c8e7be 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Miksi sovellus vaatii Internet-yhteyden? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index acf8de23..1dbba893 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Pourquoi cette application a besoin d\'un accès à internet ? diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 0db16d26..bb6352fc 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -49,6 +49,15 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit + Mengapa aplikasi membutuhkan akses ke internet? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b6201852..6b927871 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -49,6 +49,14 @@ Mittente e messaggio Solo mittente Abilita conferma di consegna + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Perché l\'applicazione richiede l\'accesso ad internet? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8c5071ec..8f7600d4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit なぜアプリ使用にインターネットへのアクセスが必要なのですか? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index ea039ad8..8c6fbb3a 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Why does the app require access to the internet? diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 366149ef..7b60f354 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit അപ്ലിക്കേഷന് ഇന്റർനെറ്റിലേക്ക് ആവശ്യമായി വരുന്നത് എന്തുകൊണ്ട്? diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 0f9e313a..854fd90e 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,6 +49,14 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Waarom heeft deze app toegang nodig tot het internet? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7bc60f8a..8ecee655 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -51,6 +51,14 @@ Nadawca i treść Tylko nadawca Włącz raporty doręczeń + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Dlaczego aplikacja wymaga dostępu do Internetu? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index f6cf255b..3df4f1cf 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Porque é que a aplicação necessita de aceder à Internet? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f6944577..94533e34 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -51,6 +51,14 @@ Отправитель и сообщение Только отправитель Использовать отчёты о доставке + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Почему приложение требует доступ к интернету? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f1092bb8..fc755023 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,6 +51,14 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Prečo vyžaduje apka prístup na internet? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f7a3224e..96b87af9 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Uygulama neden internete erişim gerektiriyor? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index b0a239d0..d092defa 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Чому додаток потрубує доступу до інтернету? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b6542e07..43bfb5af 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit 为什么该应用需要访问互联网? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a85b6837..4508764b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,6 +49,14 @@ Sender and message Sender only Enable delivery reports + MMS image size limit + 100KB + 200KB + 300KB + 600KB + 1000KB + 2000KB + No limit Why does the app require access to the internet? From b27d3ab7956d39ec7a7eb4a0861ad4a427811f05 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Tue, 7 Sep 2021 22:11:33 +0100 Subject: [PATCH 06/31] ref: update copy and make 1MB default MMS file limit --- .../smsmessenger/activities/SettingsActivity.kt | 4 ++-- .../simplemobiletools/smsmessenger/extensions/Context.kt | 4 ++-- .../com/simplemobiletools/smsmessenger/helpers/Config.kt | 2 +- .../simplemobiletools/smsmessenger/helpers/Constants.kt | 4 ++-- app/src/main/res/values-cs/strings.xml | 6 +++--- app/src/main/res/values-da/strings.xml | 6 +++--- app/src/main/res/values-de/strings.xml | 9 ++++++++- app/src/main/res/values-el/strings.xml | 6 +++--- app/src/main/res/values-es/strings.xml | 6 +++--- app/src/main/res/values-fi/strings.xml | 6 +++--- app/src/main/res/values-fr/strings.xml | 6 +++--- app/src/main/res/values-id/strings.xml | 6 +++--- app/src/main/res/values-it/strings.xml | 6 +++--- app/src/main/res/values-ja/strings.xml | 6 +++--- app/src/main/res/values-lt/strings.xml | 6 +++--- app/src/main/res/values-ml/strings.xml | 6 +++--- app/src/main/res/values-nl/strings.xml | 6 +++--- app/src/main/res/values-pl/strings.xml | 6 +++--- app/src/main/res/values-pt/strings.xml | 6 +++--- app/src/main/res/values-ru/strings.xml | 6 +++--- app/src/main/res/values-sk/strings.xml | 6 +++--- app/src/main/res/values-tr/strings.xml | 6 +++--- app/src/main/res/values-uk/strings.xml | 6 +++--- app/src/main/res/values-zh-rCN/strings.xml | 6 +++--- app/src/main/res/values/strings.xml | 6 +++--- 25 files changed, 75 insertions(+), 68 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt index ab012e2f..fd4ec01f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt @@ -163,8 +163,8 @@ class SettingsActivity : SimpleActivity() { RadioItem(2, getString(R.string.mms_file_size_limit_200kb), FILE_SIZE_200_KB), RadioItem(3, getString(R.string.mms_file_size_limit_300kb), FILE_SIZE_300_KB), RadioItem(4, getString(R.string.mms_file_size_limit_600kb), FILE_SIZE_600_KB), - RadioItem(5, getString(R.string.mms_file_size_limit_1000kb), FILE_SIZE_1000_KB), - RadioItem(6, getString(R.string.mms_file_size_limit_2000kb), FILE_SIZE_2000_KB), + RadioItem(5, getString(R.string.mms_file_size_limit_1mb), FILE_SIZE_1_MB), + RadioItem(6, getString(R.string.mms_file_size_limit_2mb), FILE_SIZE_2_MB), RadioItem(7, getString(R.string.mms_file_size_limit_none), FILE_SIZE_NONE), ) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index f9e1fa1e..4b71b182 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -771,8 +771,8 @@ fun Context.getMMSFileLimitText(size: Long) = getString( FILE_SIZE_200_KB -> R.string.mms_file_size_limit_200kb FILE_SIZE_300_KB -> R.string.mms_file_size_limit_300kb FILE_SIZE_600_KB -> R.string.mms_file_size_limit_600kb - FILE_SIZE_1000_KB -> R.string.mms_file_size_limit_1000kb - FILE_SIZE_2000_KB -> R.string.mms_file_size_limit_2000kb + FILE_SIZE_1_MB -> R.string.mms_file_size_limit_1mb + FILE_SIZE_2_MB -> R.string.mms_file_size_limit_2mb else -> R.string.mms_file_size_limit_none } ) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt index c829383a..525f8881 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Config.kt @@ -27,6 +27,6 @@ class Config(context: Context) : BaseConfig(context) { set(lockScreenVisibilitySetting) = prefs.edit().putInt(LOCK_SCREEN_VISIBILITY, lockScreenVisibilitySetting).apply() var mmsFileSizeLimit: Long - get() = prefs.getLong(MMS_FILE_SIZE_LIMIT, FILE_SIZE_NONE) + get() = prefs.getLong(MMS_FILE_SIZE_LIMIT, FILE_SIZE_1_MB) set(mmsFileSizeLimit) = prefs.edit().putLong(MMS_FILE_SIZE_LIMIT, mmsFileSizeLimit).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt index 355eac22..4c57a060 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Constants.kt @@ -39,8 +39,8 @@ const val FILE_SIZE_100_KB = 102_400L const val FILE_SIZE_200_KB = 204_800L const val FILE_SIZE_300_KB = 307_200L const val FILE_SIZE_600_KB = 614_400L -const val FILE_SIZE_1000_KB = 1_048_576L -const val FILE_SIZE_2000_KB = 2_097_152L +const val FILE_SIZE_1_MB = 1_048_576L +const val FILE_SIZE_2_MB = 2_097_152L fun refreshMessages() { EventBus.getDefault().post(Events.RefreshMessages()) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 9da1f106..bb0a4c76 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index f8dd2ace..ac2d26b1 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3151dca1..5481ca80 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -49,7 +49,14 @@ Sender and message Sender only Enable delivery reports - + Resize sent MMS images + 100KB + 200KB + 300KB + 600KB + 1MB + 2MB + No limit Warum benötigt diese App Internetzugriff? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 003bee2d..547c4d37 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -49,13 +49,13 @@ Αποστολέας και μήνυμα Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index eb36c284..2389eb98 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 97c8e7be..b8072c06 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1dbba893..e6ecfde4 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index bb6352fc..37d9d7c3 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6b927871..ecafa2b1 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -49,13 +49,13 @@ Mittente e messaggio Solo mittente Abilita conferma di consegna - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8f7600d4..75363e93 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 8c6fbb3a..aef38a4a 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 7b60f354..f66da540 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 854fd90e..2e49c0e6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,13 +49,13 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 8ecee655..97d8d62c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -51,13 +51,13 @@ Nadawca i treść Tylko nadawca Włącz raporty doręczeń - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 3df4f1cf..78054a60 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 94533e34..f5f6ae41 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -51,13 +51,13 @@ Отправитель и сообщение Только отправитель Использовать отчёты о доставке - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index fc755023..e47bfef1 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,13 +51,13 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 96b87af9..c5a1c270 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index d092defa..a1e4696c 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 43bfb5af..89cdbc30 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4508764b..8454a015 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,13 +49,13 @@ Sender and message Sender only Enable delivery reports - MMS image size limit + Resize sent MMS images 100KB 200KB 300KB 600KB - 1000KB - 2000KB + 1MB + 2MB No limit From 96e25bf8553484777ab6664718cc869bec347bac Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 8 Sep 2021 15:36:19 +0200 Subject: [PATCH 07/31] move mimetype lowercase into the function itself --- .../com/simplemobiletools/smsmessenger/extensions/String.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt index 6731a7e2..acdf0bb9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/String.kt @@ -1,7 +1,7 @@ package com.simplemobiletools.smsmessenger.extensions fun String.getExtensionFromMimeType(): String { - return when (this) { + return when (lowercase()) { "image/png" -> ".png" "image/apng" -> ".apng" "image/webp" -> ".webp" From 9b0fe07fabe8fb6dac2e08c37f7eb40042058cfa Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:06:33 +0200 Subject: [PATCH 08/31] Fixed missing plus sign when opened from another app (#107) --- .../activities/NewConversationActivity.kt | 2 +- .../smsmessenger/activities/ThreadActivity.kt | 42 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt index 4b226365..53ffbcee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt @@ -102,7 +102,7 @@ class NewConversationActivity : SimpleActivity() { private fun isThirdPartyIntent(): Boolean { if ((intent.action == Intent.ACTION_SENDTO || intent.action == Intent.ACTION_SEND || intent.action == Intent.ACTION_VIEW) && intent.dataString != null) { - val number = intent.dataString!!.removePrefix("sms:").removePrefix("smsto:").removePrefix("mms").removePrefix("mmsto:").trim() + val number = intent.dataString!!.removePrefix("sms:").removePrefix("smsto:").removePrefix("mms").removePrefix("mmsto:").replace("+", "%2b").trim() launchThreadActivity(URLDecoder.decode(number), "") finish() return true diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index f235f327..77c3283e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -29,6 +29,8 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken import com.klinker.android.send_message.Settings import com.klinker.android.send_message.Transaction import com.simplemobiletools.commons.dialogs.ConfirmationDialog @@ -376,7 +378,10 @@ class ThreadActivity : SimpleActivity() { private fun setupParticipants() { if (participants.isEmpty()) { participants = if (messages.isEmpty()) { - getThreadParticipants(threadId, null) + val intentNumbers = getPhoneNumbersFromIntent() + val participants = getThreadParticipants(threadId, null) + + fixParticipantNumbers(participants, intentNumbers) } else { messages.first().participants } @@ -767,6 +772,41 @@ class ThreadActivity : SimpleActivity() { showSelectedContacts() } + private fun getPhoneNumbersFromIntent(): ArrayList { + val numberFromIntent = intent.getStringExtra(THREAD_NUMBER) + val numbers = ArrayList() + + if (numberFromIntent != null) { + if (numberFromIntent.startsWith('[') && numberFromIntent.endsWith(']')) { + val type = object : TypeToken>() {}.type + numbers.addAll(Gson().fromJson(numberFromIntent, type)) + } else { + numbers.add(numberFromIntent) + } + } + return numbers + } + + private fun fixParticipantNumbers(participants: ArrayList, properNumbers: ArrayList): ArrayList { + for (number in properNumbers) { + for (participant in participants) { + participant.phoneNumbers = participant.phoneNumbers.map { + val numberWithoutPlus = number.replace("+", "") + if (numberWithoutPlus == it.trim()) { + if (participant.name == it) { + participant.name = number + } + number + } else { + it + } + } as ArrayList + } + } + + return participants + } + @SuppressLint("MissingPermission") @Subscribe(threadMode = ThreadMode.ASYNC) fun refreshMessages(event: Events.RefreshMessages) { From e4c47780e437539b4cc4e14ef7cd2d9ac2b30883 Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Wed, 8 Sep 2021 20:17:00 +0200 Subject: [PATCH 09/31] Changed option name --- app/src/main/res/values-cs/strings.xml | 2 +- app/src/main/res/values-da/strings.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-el/strings.xml | 2 +- app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values-fi/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-id/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-lt/strings.xml | 2 +- app/src/main/res/values-ml/strings.xml | 2 +- app/src/main/res/values-nl/strings.xml | 2 +- app/src/main/res/values-pl/strings.xml | 2 +- app/src/main/res/values-pt/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-sk/strings.xml | 2 +- app/src/main/res/values-tr/strings.xml | 2 +- app/src/main/res/values-uk/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4fcfa37b..516b8a38 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Proč aplikace vyžaduje přístup k internetu? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index dba3e2b1..56013ca1 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Hvorfor kræver appen adgang til internettet? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f8a464c5..85554a2f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Warum benötigt diese App Internetzugriff? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 63d34b27..0cffef67 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -49,7 +49,7 @@ Αποστολέας και μήνυμα Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης - Use simple characters + Remove accents and diacritics at sending messages Γιατί η εφαρμογή απαιτεί πρόσβαση στο Internet; diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 1f87d8d5..b047f66f 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages ¿Por qué la aplicación requiere acceso a internet? diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 16ff75bf..33a8f9a8 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Miksi sovellus vaatii Internet-yhteyden? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c8c84a92..46c6eebf 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Pourquoi cette application a besoin d\'un accès à internet ? diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 0d67e3bc..f9621d2a 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Mengapa aplikasi membutuhkan akses ke internet? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e415666f..0c9f0242 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -49,7 +49,7 @@ Mittente e messaggio Solo mittente Abilita conferma di consegna - Use simple characters + Remove accents and diacritics at sending messages Perché l\'applicazione richiede l\'accesso ad internet? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index fa321c9e..734c6ed8 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages なぜアプリ使用にインターネットへのアクセスが必要なのですか? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 542561ea..5a7c0edd 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Why does the app require access to the internet? diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index f6d9e372..f9101ca3 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages അപ്ലിക്കേഷന് ഇന്റർനെറ്റിലേക്ക് ആവശ്യമായി വരുന്നത് എന്തുകൊണ്ട്? diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index eebdf894..9b10597d 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,7 +49,7 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen - Use simple characters + Remove accents and diacritics at sending messages Waarom heeft deze app toegang nodig tot het internet? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index b4705dc0..40e93cde 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -51,7 +51,7 @@ Nadawca i treść Tylko nadawca Włącz raporty doręczeń - Używaj prostych znaków + Usuwaj akcenty i znaki diakrytyczne podczas wysyłania wiadomości Dlaczego aplikacja wymaga dostępu do Internetu? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index c4d133b0..5333c14e 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Porque é que a aplicação necessita de aceder à Internet? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2ac76d52..7a39dd11 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -51,7 +51,7 @@ Отправитель и сообщение Только отправитель Использовать отчёты о доставке - Use simple characters + Remove accents and diacritics at sending messages Почему приложение требует доступ к интернету? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index b3c06f1e..c13a1817 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,7 +51,7 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení - Use simple characters + Remove accents and diacritics at sending messages Prečo vyžaduje apka prístup na internet? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5785eeda..745fd84e 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Uygulama neden internete erişim gerektiriyor? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index a2156150..8cb65dee 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Чому додаток потрубує доступу до інтернету? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 9a49e535..b198b4fa 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages 为什么该应用需要访问互联网? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 68b1c3d0..f9f13526 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,7 +49,7 @@ Sender and message Sender only Enable delivery reports - Use simple characters + Remove accents and diacritics at sending messages Why does the app require access to the internet? From 74c5e4384cd2901b4109100fa7e4a681d9189f30 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Wed, 8 Sep 2021 21:53:54 +0100 Subject: [PATCH 10/31] Check file size before compression --- .../smsmessenger/extensions/Context.kt | 38 +++++++++++++++++++ .../smsmessenger/helpers/ImageCompressor.kt | 28 ++++++++------ 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index 08db3a06..143b48d7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -5,6 +5,7 @@ import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent +import android.content.ContentResolver import android.content.ContentValues import android.content.Context import android.content.Intent @@ -17,6 +18,7 @@ import android.net.Uri import android.os.Handler import android.os.Looper import android.provider.ContactsContract.PhoneLookup +import android.provider.OpenableColumns import android.provider.Telephony.* import android.text.TextUtils import androidx.core.app.NotificationCompat @@ -35,6 +37,7 @@ import com.simplemobiletools.smsmessenger.interfaces.MessagesDao import com.simplemobiletools.smsmessenger.models.* import com.simplemobiletools.smsmessenger.receivers.DirectReplyReceiver import com.simplemobiletools.smsmessenger.receivers.MarkAsReadReceiver +import java.io.FileNotFoundException import java.util.* import kotlin.collections.ArrayList import me.leolin.shortcutbadger.ShortcutBadger @@ -788,3 +791,38 @@ fun Context.updateLastConversationMessage(threadId: Long) { } catch (e: Exception) { } } + +fun Context.getFileSizeFromUri(uri:Uri): Long { + val assetFileDescriptor = try { + contentResolver.openAssetFileDescriptor(uri, "r") + } catch (e: FileNotFoundException) { + null + } + + // uses ParcelFileDescriptor#getStatSize underneath if failed + val length = assetFileDescriptor?.use { it.length } ?: FILE_SIZE_NONE + if (length != -1L) { + return length + } + + // if "content://" uri scheme, try contentResolver table + if (uri.scheme.equals(ContentResolver.SCHEME_CONTENT)) { + return contentResolver.query(uri, arrayOf(OpenableColumns.SIZE), null, null, null) + ?.use { cursor -> + // maybe shouldn't trust ContentResolver for size: + // https://stackoverflow.com/questions/48302972/content-resolver-returns-wrong-size + val sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE) + if (sizeIndex == -1) { + return@use FILE_SIZE_NONE + } + cursor.moveToFirst() + return try { + cursor.getLong(sizeIndex) + } catch (_: Throwable) { + FILE_SIZE_NONE + } + } ?: FILE_SIZE_NONE + } else { + return FILE_SIZE_NONE + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt index 50523678..aa58387e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/ImageCompressor.kt @@ -11,6 +11,7 @@ import com.simplemobiletools.commons.extensions.getMyFileUri import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.smsmessenger.extensions.extension import com.simplemobiletools.smsmessenger.extensions.getExtensionFromMimeType +import com.simplemobiletools.smsmessenger.extensions.getFileSizeFromUri import com.simplemobiletools.smsmessenger.extensions.isImageMimeType import java.io.File import java.io.FileOutputStream @@ -20,7 +21,6 @@ import java.io.FileOutputStream * [Compressor](https://github.com/zetbaitsu/Compressor/) * */ class ImageCompressor(private val context: Context) { - private val contentResolver = context.contentResolver private val outputDirectory = File(context.cacheDir, "compressed").apply { if (!exists()) { @@ -31,18 +31,24 @@ class ImageCompressor(private val context: Context) { fun compressImage(uri: Uri, compressSize: Long, callback: (compressedFileUri: Uri?) -> Unit) { ensureBackgroundThread { try { - val mimeType = contentResolver.getType(uri)!! - if (mimeType.isImageMimeType()) { - val byteArray = contentResolver.openInputStream(uri)?.readBytes()!! - var destinationFile = File(outputDirectory, System.currentTimeMillis().toString().plus(mimeType.getExtensionFromMimeType())) - destinationFile.writeBytes(byteArray) - val constraint = SizeConstraint(compressSize) - while (constraint.isSatisfied(destinationFile).not()) { - destinationFile = constraint.satisfy(destinationFile) + val fileSize = context.getFileSizeFromUri(uri) + if (fileSize > compressSize) { + val mimeType = contentResolver.getType(uri)!! + if (mimeType.isImageMimeType()) { + val byteArray = contentResolver.openInputStream(uri)?.readBytes()!! + var destinationFile = File(outputDirectory, System.currentTimeMillis().toString().plus(mimeType.getExtensionFromMimeType())) + destinationFile.writeBytes(byteArray) + val constraint = SizeConstraint(compressSize) + while (constraint.isSatisfied(destinationFile).not()) { + destinationFile = constraint.satisfy(destinationFile) + } + callback.invoke(context.getMyFileUri(destinationFile)) + } else { + callback.invoke(null) } - callback.invoke(context.getMyFileUri(destinationFile)) } else { - callback.invoke(null) + //no need to compress since the file is less than the compress size + callback.invoke(uri) } } catch (e: Exception) { callback.invoke(null) From 30e7b68c06251802a5bec1c8fd7c41894efac136 Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:41:23 +0200 Subject: [PATCH 11/31] Used normalizeString from Commons --- .../simplemobiletools/smsmessenger/extensions/Context.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index 93076e75..0f3c34f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -767,13 +767,7 @@ fun Context.getLockScreenVisibilityText(type: Int) = getString( ) fun Context.removeDiacriticsIfNeeded(text: String): String { - var msg = text - if (config.useSimpleCharacters) { - msg = Normalizer.normalize(msg, Normalizer.Form.NFD) - msg = msg.replace("\\p{InCombiningDiacriticalMarks}+".toRegex(), "") - } - - return msg + return if (config.useSimpleCharacters) text.normalizeString() else text } fun Context.getSmsDraft(threadId: Long): String? { From 13f5b9b582e03a4e7fc04a0516bc1fb00d894b47 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Thu, 9 Sep 2021 21:48:50 +0100 Subject: [PATCH 12/31] Fix reference error, move file limit sizes to donottranslate.xml --- .../smsmessenger/activities/ThreadActivity.kt | 2 +- app/src/main/res/values-cs/strings.xml | 9 +-------- app/src/main/res/values-da/strings.xml | 9 +-------- app/src/main/res/values-de/strings.xml | 6 ------ app/src/main/res/values-el/strings.xml | 6 ------ app/src/main/res/values-es/strings.xml | 6 ------ app/src/main/res/values-fi/strings.xml | 6 ------ app/src/main/res/values-fr/strings.xml | 6 ------ app/src/main/res/values-id/strings.xml | 6 ------ app/src/main/res/values-it/strings.xml | 6 ------ app/src/main/res/values-ja/strings.xml | 6 ------ app/src/main/res/values-lt/strings.xml | 6 ------ app/src/main/res/values-ml/strings.xml | 6 ------ app/src/main/res/values-nl/strings.xml | 6 ------ app/src/main/res/values-pl/strings.xml | 6 ------ app/src/main/res/values-pt/strings.xml | 6 ------ app/src/main/res/values-ru/strings.xml | 6 ------ app/src/main/res/values-sk/strings.xml | 6 ------ app/src/main/res/values-tr/strings.xml | 6 ------ app/src/main/res/values-uk/strings.xml | 6 ------ app/src/main/res/values-zh-rCN/strings.xml | 6 ------ app/src/main/res/values/donottranslate.xml | 7 +++++++ app/src/main/res/values/strings.xml | 9 +-------- 23 files changed, 11 insertions(+), 133 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 754ec17c..008ec142 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -120,7 +120,7 @@ class ThreadActivity : SimpleActivity() { override fun onPause() { super.onPause() - if (thread_type_message.value != "" && attachmentUris.isEmpty()) { + if (thread_type_message.value != "" && attachmentSelections.isEmpty()) { saveSmsDraft(thread_type_message.value, threadId) } else { deleteSmsDraft(threadId) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index bb0a4c76..ac27293c 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -49,14 +49,7 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB - No limit + Resize sent MMS images No limit Proč aplikace vyžaduje přístup k internetu? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index ac2d26b1..a45a7033 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,14 +49,7 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB - No limit + Resize sent MMS images No limit Hvorfor kræver appen adgang til internettet? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5481ca80..9c90bcfb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 547c4d37..997169a9 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -50,12 +50,6 @@ Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 2389eb98..67d182cb 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index b8072c06..2e782726 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e6ecfde4..450af159 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 37d9d7c3..1f276fa3 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index ecafa2b1..5baa593b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -50,12 +50,6 @@ Solo mittente Abilita conferma di consegna Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 75363e93..871b8e60 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index aef38a4a..8356b483 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index f66da540..dbec29f0 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 2e49c0e6..761add6d 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -50,12 +50,6 @@ Alleen afzender Bezorgingsrapporten inschakelen Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 97d8d62c..57ad858d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -52,12 +52,6 @@ Tylko nadawca Włącz raporty doręczeń Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 78054a60..793f5c39 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f5f6ae41..4695783b 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -52,12 +52,6 @@ Только отправитель Использовать отчёты о доставке Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index e47bfef1..60bcc6d8 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -52,12 +52,6 @@ Iba odosielateľ Povoliť správy o doručení Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index c5a1c270..04bc32ec 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index a1e4696c..3527c5c4 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 89cdbc30..08ed9cd9 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -50,12 +50,6 @@ Sender only Enable delivery reports Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB No limit diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 24f6140e..244c41e4 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,4 +2,11 @@ com.simplemobiletools.smsmessenger + 100KB + 200KB + 300KB + 600KB + 1MB + 2MB + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8454a015..e6273a47 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,14 +49,7 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images - 100KB - 200KB - 300KB - 600KB - 1MB - 2MB - No limit + Resize sent MMS images No limit Why does the app require access to the internet? From 1a1b1aa8c08f85116da9cacfb13c54538e8c254e Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Thu, 9 Sep 2021 22:15:14 +0100 Subject: [PATCH 13/31] Fix formatting in strings --- app/src/main/res/values-cs/strings.xml | 3 ++- app/src/main/res/values-da/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ac27293c..6838edbd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -49,7 +49,8 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images No limit + Resize sent MMS images + No limit Proč aplikace vyžaduje přístup k internetu? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index a45a7033..6a34b6d1 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -49,7 +49,8 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images No limit + Resize sent MMS images + No limit Hvorfor kræver appen adgang til internettet? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e6273a47..df4c075d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,7 +49,8 @@ Sender and message Sender only Enable delivery reports - Resize sent MMS images No limit + Resize sent MMS images + No limit Why does the app require access to the internet? From 7e3696e96546b62d938ef00b69ccf712a266ef81 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Thu, 9 Sep 2021 23:30:08 +0200 Subject: [PATCH 14/31] adding an extra space --- .../com/simplemobiletools/smsmessenger/extensions/Context.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index 7dee23fd..69671889 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -844,7 +844,7 @@ fun Context.updateLastConversationMessage(threadId: Long) { } } -fun Context.getFileSizeFromUri(uri:Uri): Long { +fun Context.getFileSizeFromUri(uri: Uri): Long { val assetFileDescriptor = try { contentResolver.openAssetFileDescriptor(uri, "r") } catch (e: FileNotFoundException) { From 5bd85fa93d2d4966fd6a0e0e643bcca6e47d917a Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Thu, 9 Sep 2021 23:30:46 +0200 Subject: [PATCH 15/31] adding a newline --- .../simplemobiletools/smsmessenger/activities/ThreadActivity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 008ec142..c23289db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -646,6 +646,7 @@ class ThreadActivity : SimpleActivity() { } } } + loadAttachmentPreview(attachmentView, uri) return attachmentView } From 223b7ed74653e908f550614b392b8e3f88323e57 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Fri, 10 Sep 2021 10:01:56 +0200 Subject: [PATCH 16/31] Update strings.xml --- app/src/main/res/values-sk/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 60bcc6d8..264ebdcd 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,8 +51,8 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení - Resize sent MMS images - No limit + Zmenšiť MMS obrázky pri odosielaní + Žiadny limit Prečo vyžaduje apka prístup na internet? From c9b679a7911a542c6e28bae0017ac30f521271e8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 10 Sep 2021 10:12:39 +0200 Subject: [PATCH 17/31] translating a slovak string --- app/src/main/res/values-sk/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 264ebdcd..42276710 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -12,7 +12,7 @@ Odpovedať Zobraziť počítadlo znakov pri písaní správ Načítanie správ… - Sender doesn\'t support replies + Odosielateľ nepodporuje odpovede Koncept Odosiela sa… Exportovať správy From 951c1a229af445732d209a686d9ed305a740fc81 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Fri, 10 Sep 2021 10:17:22 +0200 Subject: [PATCH 18/31] Update strings.xml --- app/src/main/res/values-sk/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 3cc6de92..5c922a60 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,7 +51,7 @@ Odosielateľ a správa Iba odosielateľ Povoliť správy o doručení - Remove accents and diacritics at sending messages + Odstrániť diakritiku pri odosielaní správ Zmenšiť MMS obrázky pri odosielaní Žiadny limit From 8489ec967eb86746d54bda8d9e9563d3c45964e2 Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Fri, 10 Sep 2021 10:48:01 +0200 Subject: [PATCH 19/31] Updated Polish translation --- app/src/main/res/values-pl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index b0e73120..bd91ca19 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -52,8 +52,8 @@ Tylko nadawca Włącz raporty doręczeń Usuwaj akcenty i znaki diakrytyczne podczas wysyłania wiadomości - Resize sent MMS images - No limit + Rozmiar wysyłanych obrazków w MMS-ach + Bez limitu Dlaczego aplikacja wymaga dostępu do Internetu? From eeb09727f89a6da91f27591c2894ab5d5d00c16e Mon Sep 17 00:00:00 2001 From: solokot Date: Fri, 10 Sep 2021 13:00:59 +0300 Subject: [PATCH 20/31] Updated Russian language --- app/src/main/res/values-ru/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e7835b1c..c4ae0a0b 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -51,9 +51,9 @@ Отправитель и сообщение Только отправитель Использовать отчёты о доставке - Remove accents and diacritics at sending messages - Resize sent MMS images - No limit + Удалять ударения и диакритические знаки при отправке сообщений + Изменять размер отправляемых в MMS изображений + Нет ограничения Почему приложение требует доступ к интернету? From 591570abca2822d1d4773c297da29a425f0c3871 Mon Sep 17 00:00:00 2001 From: spkprs Date: Fri, 10 Sep 2021 17:04:29 +0300 Subject: [PATCH 21/31] Update strings.xml --- app/src/main/res/values-el/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 68124259..ec01e170 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -49,9 +49,9 @@ Αποστολέας και μήνυμα Αποστολέας μόνο Ενεργοποίηση αναφορών παράδοσης - Remove accents and diacritics at sending messages - Resize sent MMS images - No limit + Αφαίρεση τονισμών και διακριτικών κατά την αποστολή μηνυμάτων + Αλλαγή μεγέθους απεσταλμένων εικόνων MMS + Χωρίς όριο Γιατί η εφαρμογή απαιτεί πρόσβαση στο Internet; From efb3bb4eb6bd84e30a28379b002d14d7d3539e9f Mon Sep 17 00:00:00 2001 From: Baptiste Lombard <17877656+blombard@users.noreply.github.com> Date: Sun, 12 Sep 2021 19:23:46 +0200 Subject: [PATCH 22/31] Update french translation --- app/src/main/res/values-fr/strings.xml | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 9a8e008c..96cfb42e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -2,21 +2,21 @@ Simple SMS Messenger SMS Messenger Écrivez un message… - Message not sent - Not sent. Touch to retry. - Your message to \'%s\' has not been sent + Message non envoyé + Pas envoyé. Appuyez pour réessayer. + Votre message à \'%s\' n'a pas été envoyé Ajouter une personne Pièce jointe Aucune conversation enregistrée n\'a été trouvée Commencer une conversation Répondre - Show a character counter at writing messages - Loading messages… - Sender doesn\'t support replies - Draft - Sending… - Export messages - Import messages + Afficher le nombre de caractères lors de l'écriture de messages + Chargement des messages… + L'expéditeur n'accepte pas les réponses + Brouillon + Envoi en cours… + Export de messages + Import de messages Nouvelle conversation @@ -45,13 +45,13 @@ - Lock screen notification visibility - Sender and message - Sender only - Enable delivery reports - Remove accents and diacritics at sending messages - Resize sent MMS images - No limit + Visibilité des notifications sur l'écran de verrouillage + Expéditeur et message + Expéditeur uniquement + Activer les rapports d'envoi + Supprimer les accents et caractères spéciaux lors de l'envoi de messages + Redimensionner les images MMS envoyées + Pas de limite Pourquoi cette application a besoin d\'un accès à internet ? From 1eed2ab4f527ffd541910771151f34dfa3d9a74f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 13 Sep 2021 16:52:13 +0200 Subject: [PATCH 23/31] Dutch --- app/src/main/res/values-nl/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 20889974..5de82b93 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,9 +49,9 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen - Remove accents and diacritics at sending messages - Resize sent MMS images - No limit + Accenten en diakritische tekens verwijderen bij het verzenden van berichten/string> + Afbeelding verkleinen voor MMS/string> + Geen limiet Waarom heeft deze app toegang nodig tot het internet? From d2d291069c955e2bbcef060922b5cb76c761932e Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Tue, 14 Sep 2021 19:03:04 +0200 Subject: [PATCH 24/31] Fixed marking as read/unread not refreshing list --- .../smsmessenger/activities/ThreadActivity.kt | 2 +- .../smsmessenger/adapters/ConversationsAdapter.kt | 5 +++++ .../smsmessenger/receivers/MarkAsReadReceiver.kt | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index 180402e5..28c5b7ef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -694,7 +694,7 @@ class ThreadActivity : SimpleActivity() { } private fun sendMessage() { - val msg = thread_type_message.value + var msg = thread_type_message.value if (msg.isEmpty() && attachmentSelections.isEmpty()) { return } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt index 2990622a..cbccb4b1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt @@ -217,6 +217,11 @@ class ConversationsAdapter( conversationsMarkedAsUnread.filter { conversation -> conversation.read }.forEach { activity.markThreadMessagesUnread(it.threadId) } + + activity.runOnUiThread { + refreshMessages() + finishActMode() + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/MarkAsReadReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/MarkAsReadReceiver.kt index 4525f30d..5488c3aa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/MarkAsReadReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/MarkAsReadReceiver.kt @@ -10,6 +10,7 @@ import com.simplemobiletools.smsmessenger.extensions.markThreadMessagesRead import com.simplemobiletools.smsmessenger.extensions.updateUnreadCountBadge import com.simplemobiletools.smsmessenger.helpers.MARK_AS_READ import com.simplemobiletools.smsmessenger.helpers.THREAD_ID +import com.simplemobiletools.smsmessenger.helpers.refreshMessages class MarkAsReadReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { @@ -21,6 +22,7 @@ class MarkAsReadReceiver : BroadcastReceiver() { context.markThreadMessagesRead(threadId) context.conversationsDB.markRead(threadId) context.updateUnreadCountBadge(context.conversationsDB.getUnreadConversations()) + refreshMessages() } } } From 362b18e2e5d84a1972f53fa7dbc668168845fc20 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 Sep 2021 13:34:48 +0200 Subject: [PATCH 25/31] fixing some dutch string closing tags --- app/src/main/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 5de82b93..759d3c56 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -49,8 +49,8 @@ Afzender en bericht Alleen afzender Bezorgingsrapporten inschakelen - Accenten en diakritische tekens verwijderen bij het verzenden van berichten/string> - Afbeelding verkleinen voor MMS/string> + Accenten en diakritische tekens verwijderen bij het verzenden van berichten + Afbeelding verkleinen voor MMS Geen limiet From 39d46d1d543a38278c02b0db93b6a9be087313d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 Sep 2021 13:38:34 +0200 Subject: [PATCH 26/31] updating kotlin and commons --- app/build.gradle | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0844aa10..b4c1e5f9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,7 +56,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:8979ca8187' + implementation 'com.github.SimpleMobileTools:Simple-Commons:f49f7b5f89' implementation 'org.greenrobot:eventbus:3.2.0' implementation 'com.klinkerapps:android-smsmms:5.2.6' implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a' diff --git a/build.gradle b/build.gradle index 22e54ea7..b2370fda 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.21' + ext.kotlin_version = '1.5.30' repositories { google() jcenter() From d5a09f4a9b7cd7b21591d42178892e7c3f70aeda Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 Sep 2021 16:44:49 +0200 Subject: [PATCH 27/31] moving the gl strings into the proper folder --- .../res/{values-gl => values-gl/strings.xml} | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) rename app/src/main/res/{values-gl => values-gl/strings.xml} (75%) diff --git a/app/src/main/res/values-gl b/app/src/main/res/values-gl/strings.xml similarity index 75% rename from app/src/main/res/values-gl rename to app/src/main/res/values-gl/strings.xml index ef3cabd1..d566febf 100644 --- a/app/src/main/res/values-gl +++ b/app/src/main/res/values-gl/strings.xml @@ -2,12 +2,21 @@ Simple SMS Messenger Mensaxe SMS Escribir unha mensaxe… - Mensaxe non enviada + Mensaxe non enviada + Not sent. Touch to retry. + Your message to \'%s\' has not been sent Engadir persoa Anexo Non se atoparon conversas Iniciar unha conversa Responder + Show a character counter at writing messages + Loading messages… + Sender doesn\'t support replies + Draft + Sending… + Export messages + Import messages Nova conversa @@ -35,6 +44,15 @@ %d mensaxes + + Lock screen notification visibility + Sender and message + Sender only + Enable delivery reports + Remove accents and diacritics at sending messages + Resize sent MMS images + No limit + Por que o aplicativo necesita acceder a Internet? Infelizmente é a única forma para poder enviar anexos MMS. A incapacidade de non conseguir enviar MMS sería unha enorme desvantaxe comparativamente a outros aplicativos e, por iso, tomamos esta decisión. Pero, como habitualmente, o aplicativo non ten anuncios, non rastrea os utilizadores nin recolle datos persoais. Este permiso só é necesario para enviar as MMS. From 6c550d484cf18895994337a4f2cb3a8e50df93d9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 Sep 2021 16:45:14 +0200 Subject: [PATCH 28/31] escaping some french apostrophes --- app/src/main/res/values-fr/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 96cfb42e..af6c07d8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4,15 +4,15 @@ Écrivez un message… Message non envoyé Pas envoyé. Appuyez pour réessayer. - Votre message à \'%s\' n'a pas été envoyé + Votre message à \'%s\' n\'a pas été envoyé Ajouter une personne Pièce jointe Aucune conversation enregistrée n\'a été trouvée Commencer une conversation Répondre - Afficher le nombre de caractères lors de l'écriture de messages + Afficher le nombre de caractères lors de l\'écriture de messages Chargement des messages… - L'expéditeur n'accepte pas les réponses + L\'expéditeur n\'accepte pas les réponses Brouillon Envoi en cours… Export de messages @@ -45,11 +45,11 @@ - Visibilité des notifications sur l'écran de verrouillage + Visibilité des notifications sur l\'écran de verrouillage Expéditeur et message Expéditeur uniquement - Activer les rapports d'envoi - Supprimer les accents et caractères spéciaux lors de l'envoi de messages + Activer les rapports d\'envoi + Supprimer les accents et caractères spéciaux lors de l\'envoi de messages Redimensionner les images MMS envoyées Pas de limite From b52cafef09921596bf05ac38a2beb17db16629b0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 Sep 2021 16:46:31 +0200 Subject: [PATCH 29/31] fixing a new line at the french string --- app/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index af6c07d8..1625d4fd 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -56,7 +56,7 @@ Pourquoi cette application a besoin d\'un accès à internet ? Malheureusement, cela est nécessaire pour envoyer des pièces jointes dans les MMS. Ne pas pouvoir envoyer de MMS serait un énorme désavantage comparé à d\'autres applications, nous avons donc décidé de faire ainsi. - Cependant, comme toujours, il n\'y a aucune publicité, traqueur ou analyseur de quelque sorte, internet n\'est utilisé que pour envoyer des MMS. + Cependant, comme toujours, il n\'y a aucune publicité, traqueur ou analyseur de quelque sorte, internet n\'est utilisé que pour envoyer des MMS. From 0f342233df41e0c17601793eaf5f7c7ac6229657 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 16 Sep 2021 22:58:46 +0200 Subject: [PATCH 30/31] update version to 5.10.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b4c1e5f9..ab02e588 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.simplemobiletools.smsmessenger" minSdkVersion 22 targetSdkVersion 30 - versionCode 35 - versionName "5.10.0" + versionCode 36 + versionName "5.10.1" setProperty("archivesBaseName", "sms-messenger") } From 52ebeeedc6842126495662ce93bb11a4d4ca7869 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 16 Sep 2021 22:58:53 +0200 Subject: [PATCH 31/31] updating changelog --- CHANGELOG.md | 8 ++++++++ fastlane/metadata/android/en-US/changelogs/36.txt | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/36.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ab976f..3193a1ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========== +Version 5.10.1 *(2021-09-16)* +---------------------------- + + * Automatically resize sent MMS image attachments by default, allow customizing the limit + * Added Draft support + * Allow marking conversations un/read from the main screen + * Some other stability, UX and translation improvements + Version 5.10.0 *(2021-08-27)* ---------------------------- diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt new file mode 100644 index 00000000..a60f0002 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/36.txt @@ -0,0 +1,4 @@ + * Automatically resize sent MMS image attachments by default, allow customizing the limit + * Added Draft support + * Allow marking conversations un/read from the main screen + * Some other stability, UX and translation improvements