@@ -35,6 +35,7 @@ import com.bumptech.glide.request.target.Target
3535import com.google.gson.Gson
3636import com.google.gson.reflect.TypeToken
3737import com.klinker.android.send_message.Transaction
38+ import com.klinker.android.send_message.Utils.getNumPages
3839import com.simplemobiletools.commons.dialogs.ConfirmationDialog
3940import com.simplemobiletools.commons.extensions.*
4041import com.simplemobiletools.commons.helpers.*
@@ -243,6 +244,7 @@ class ThreadActivity : SimpleActivity() {
243244
244245 setupThreadTitle()
245246 setupSIMSelector()
247+ updateMessageType()
246248 callback()
247249 }
248250 }
@@ -404,7 +406,10 @@ class ThreadActivity : SimpleActivity() {
404406 private fun setupButtons () {
405407 updateTextColors(thread_holder)
406408 val textColor = getProperTextColor()
407- thread_send_message.applyColorFilter(textColor)
409+ thread_send_message.apply {
410+ setTextColor(textColor)
411+ compoundDrawables.forEach { it?.applyColorFilter(textColor) }
412+ }
408413 confirm_manage_contacts.applyColorFilter(textColor)
409414 thread_add_attachment.applyColorFilter(textColor)
410415
@@ -437,7 +442,6 @@ class ThreadActivity : SimpleActivity() {
437442 numbers.add(it.normalizedNumber)
438443 }
439444 }
440-
441445 val newThreadId = getThreadId(numbers)
442446 if (threadId != newThreadId) {
443447 hideKeyboard()
@@ -641,6 +645,7 @@ class ThreadActivity : SimpleActivity() {
641645
642646 participants.add(contact)
643647 showSelectedContacts()
648+ updateMessageType()
644649 }
645650
646651 private fun markAsUnread () {
@@ -821,6 +826,7 @@ class ThreadActivity : SimpleActivity() {
821826 if (attachmentSelections.isEmpty()) {
822827 thread_attachments_holder.beGone()
823828 }
829+ checkSendMessageAvailability()
824830 }
825831
826832 private fun checkSendMessageAvailability () {
@@ -831,6 +837,7 @@ class ThreadActivity : SimpleActivity() {
831837 thread_send_message.isClickable = false
832838 thread_send_message.alpha = 0.4f
833839 }
840+ updateMessageType()
834841 }
835842
836843 private fun sendMessage () {
@@ -950,6 +957,7 @@ class ThreadActivity : SimpleActivity() {
950957 private fun removeSelectedContact (id : Int ) {
951958 participants = participants.filter { it.rawId != id }.toMutableList() as ArrayList <SimpleContact >
952959 showSelectedContacts()
960+ updateMessageType()
953961 }
954962
955963 private fun getPhoneNumbersFromIntent (): ArrayList <String > {
@@ -1059,4 +1067,17 @@ class ThreadActivity : SimpleActivity() {
10591067
10601068 setupAdapter()
10611069 }
1070+
1071+ private fun updateMessageType () {
1072+ val settings = getSendMessageSettings()
1073+ val text = thread_type_message.text.toString()
1074+ val isGroupMms = participants.size > 1 && config.sendGroupMessageMMS
1075+ val isLongMmsMessage = getNumPages(settings, text) > settings.sendLongAsMmsAfter && config.sendLongMessageMMS
1076+ val stringId = if (attachmentSelections.isNotEmpty() || isGroupMms || isLongMmsMessage) {
1077+ R .string.mms
1078+ } else {
1079+ R .string.sms
1080+ }
1081+ thread_send_message.setText(stringId)
1082+ }
10621083}
0 commit comments