diff --git a/app/build.gradle b/app/build.gradle index 7f9727a4..e9ab4c84 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:4c83ec8740' + implementation 'com.github.esensar:Simple-Commons:7b890eae3e' implementation 'org.greenrobot:eventbus:3.3.1' implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61' implementation 'com.github.tibbi:android-smsmms:33fcaf94d9' diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt index 57390420..3088cbd8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt @@ -3,48 +3,41 @@ package com.simplemobiletools.smsmessenger.dialogs import android.annotation.SuppressLint import android.telephony.SubscriptionInfo import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.extensions.getAlertDialogBuilder -import com.simplemobiletools.commons.extensions.getTimeFormat -import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.commons.dialogs.BasePropertiesDialog +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.subscriptionManagerCompat import com.simplemobiletools.smsmessenger.models.Message -import kotlinx.android.synthetic.main.dialog_message_details.view.dialog_message_details_text_value import org.joda.time.DateTime -class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Message) { +class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Message) : BasePropertiesDialog(activity) { init { @SuppressLint("MissingPermission") val availableSIMs = activity.subscriptionManagerCompat().activeSubscriptionInfoList - @SuppressLint("SetTextI18n") - val view = activity.layoutInflater.inflate(R.layout.dialog_message_details, null).apply { - dialog_message_details_text_value.text = mutableListOf().apply { - add("${message.getReceiverOrSenderLabel()}: ${message.getReceiverOrSenderPhoneNumbers()}") - if (availableSIMs.count() > 1) { - add("SIM: ${message.getSIM(availableSIMs)}") - } - add("${message.getSentOrReceivedAtLabel()}: ${message.getSentOrReceivedAt()}") - }.joinToString(separator = System.lineSeparator()) + addProperty(message.getSenderOrReceiverLabel(), message.getSenderOrReceiverPhoneNumbers()) + if (availableSIMs.count() > 1) { + addProperty(R.string.message_details_sim, message.getSIM(availableSIMs)) } + addProperty(message.getSentOrReceivedAtLabel(), message.getSentOrReceivedAt()) activity.getAlertDialogBuilder() .setPositiveButton(R.string.ok) { _, _ -> } .apply { - activity.setupDialogStuff(view, this, R.string.message_details) + activity.setupDialogStuff(mDialogView, this, R.string.message_details) } } - private fun Message.getReceiverOrSenderLabel(): String { + private fun Message.getSenderOrReceiverLabel(): Int { return if (isReceivedMessage()) { - activity.getString(R.string.message_details_sender) + R.string.message_details_sender } else { - activity.getString(R.string.message_details_receiver) + R.string.message_details_receiver } } - private fun Message.getReceiverOrSenderPhoneNumbers(): String { + private fun Message.getSenderOrReceiverPhoneNumbers(): String { return if (isReceivedMessage()) { formatContactInfo(senderName, senderPhoneNumber) } else { @@ -66,11 +59,11 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag return availableSIMs.firstOrNull { it.subscriptionId == subscriptionId }?.displayName?.toString() ?: activity.getString(R.string.unknown) } - private fun Message.getSentOrReceivedAtLabel(): String { + private fun Message.getSentOrReceivedAtLabel(): Int { return if (isReceivedMessage()) { - activity.getString(R.string.message_details_received_at) + R.string.message_details_received_at } else { - activity.getString(R.string.message_details_sent_at) + R.string.message_details_sent_at } } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index ec532b4b..f41f07ed 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -54,6 +54,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 49adce08..f85b1c83 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml index df957202..f7ec54fa 100644 --- a/app/src/main/res/values-be/strings.xml +++ b/app/src/main/res/values-be/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 186658d8..e610a7ab 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index fa3453d3..f1e8ee60 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-cr/strings.xml b/app/src/main/res/values-cr/strings.xml index 49adce08..f85b1c83 100644 --- a/app/src/main/res/values-cr/strings.xml +++ b/app/src/main/res/values-cr/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 323b7256..62fc082b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index d07c7fb7..fd2d135d 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 110f4b4a..1ecd3c29 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index cd365215..8582ed3f 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index e834d5c6..b92943bc 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 572158d1..bb4e5bfe 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 605de343..166d13d2 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 62f60ee3..87658d78 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 2e77d761..f593e98c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 94f2ca6b..ab23262e 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 49adce08..f85b1c83 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 97cd17f2..3325f0eb 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -51,6 +51,7 @@ Pojedinosti poruke Šalje Prima + SIM Poslano Primljeno diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index e4d4fdae..a0fe3054 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index ee358d3e..1afa473c 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -49,6 +49,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index b23617b3..afb85413 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e048b1b2..975a9ead 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index ca97c1a0..9c6559fe 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 53eeddd6..c17bb33c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -49,6 +49,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 590b9298..0a5bbc1a 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 5055d526..48572e7c 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-mk/strings.xml b/app/src/main/res/values-mk/strings.xml index 49adce08..f85b1c83 100644 --- a/app/src/main/res/values-mk/strings.xml +++ b/app/src/main/res/values-mk/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 9ce35dba..c7282d53 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 76ebfb3a..9eedb354 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 2401a5bf..12dbcf2a 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-pa-rPK/strings.xml b/app/src/main/res/values-pa-rPK/strings.xml index d2aad96e..7417d66c 100644 --- a/app/src/main/res/values-pa-rPK/strings.xml +++ b/app/src/main/res/values-pa-rPK/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index ee076db6..4c585d49 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d22f1e0c..ed2c24fe 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index f266ac5b..f7378cbe 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 75cba463..43a6aad3 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b82de622..b0d9e140 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index a78c741f..78389705 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -51,6 +51,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index afb8a286..669fb21c 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index c9e568fd..839b4699 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -51,6 +51,7 @@ Детаљи о поруци Шалје Прима + SIM Послано Примлјено diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 89d8734d..b06f30dc 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index 77a55a49..4239325a 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 02767b36..2cee29ab 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -49,6 +49,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 1a39d5be..eac8bee7 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 168dbb24..9e1bac7a 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -52,6 +52,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index c9607507..ae3ac04d 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 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 5a57d49a..c730eb89 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -49,6 +49,7 @@ Message details Sender Receiver + SIM Sent at Received at diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9db46dc0..dae0f917 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -50,6 +50,7 @@ Message details Sender Receiver + SIM Sent at Received at