Add SMS/MMS label under Send button

This commit is contained in:
Naveen 2022-06-18 22:26:23 +05:30
parent 6c6b74af5e
commit 13e7ee1537
3 changed files with 24 additions and 6 deletions

View File

@ -35,6 +35,7 @@ import com.bumptech.glide.request.target.Target
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.klinker.android.send_message.Transaction import com.klinker.android.send_message.Transaction
import com.klinker.android.send_message.Utils.getNumPages
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
@ -311,6 +312,7 @@ class ThreadActivity : SimpleActivity() {
runOnUiThread { runOnUiThread {
setupThreadTitle() setupThreadTitle()
setupSIMSelector() setupSIMSelector()
updateMessageType()
} }
} }
} }
@ -404,7 +406,10 @@ class ThreadActivity : SimpleActivity() {
private fun setupButtons() { private fun setupButtons() {
updateTextColors(thread_holder) updateTextColors(thread_holder)
val textColor = getProperTextColor() val textColor = getProperTextColor()
thread_send_message.applyColorFilter(textColor) thread_send_message.apply {
setTextColor(textColor)
compoundDrawables.forEach { it?.applyColorFilter(textColor) }
}
confirm_manage_contacts.applyColorFilter(textColor) confirm_manage_contacts.applyColorFilter(textColor)
thread_add_attachment.applyColorFilter(textColor) thread_add_attachment.applyColorFilter(textColor)
@ -821,6 +826,7 @@ class ThreadActivity : SimpleActivity() {
if (attachmentSelections.isEmpty()) { if (attachmentSelections.isEmpty()) {
thread_attachments_holder.beGone() thread_attachments_holder.beGone()
} }
checkSendMessageAvailability()
} }
private fun checkSendMessageAvailability() { private fun checkSendMessageAvailability() {
@ -831,6 +837,7 @@ class ThreadActivity : SimpleActivity() {
thread_send_message.isClickable = false thread_send_message.isClickable = false
thread_send_message.alpha = 0.4f thread_send_message.alpha = 0.4f
} }
updateMessageType()
} }
private fun sendMessage() { private fun sendMessage() {
@ -1059,4 +1066,13 @@ class ThreadActivity : SimpleActivity() {
setupAdapter() setupAdapter()
} }
private fun updateMessageType() {
val settings = getSendMessageSettings()
val text = thread_type_message.text.toString()
val isGroupMms = participants.size > 1 && config.sendGroupMessageMMS
val isLongMmsMessage = getNumPages(settings, text) > settings.sendLongAsMmsAfter && config.sendLongMessageMMS
val res = if (attachmentSelections.isNotEmpty() || isGroupMms || isLongMmsMessage) R.string.mms else R.string.sms
thread_send_message.setText(res)
}
} }

View File

@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp" android:width="24dp"
android:height="18dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path

View File

@ -203,7 +203,7 @@
android:visibility="gone" android:visibility="gone"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<ImageView <Button
android:id="@+id/thread_send_message" android:id="@+id/thread_send_message"
android:layout_width="@dimen/normal_icon_size" android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size" android:layout_height="@dimen/normal_icon_size"
@ -215,7 +215,9 @@
android:background="?selectableItemBackgroundBorderless" android:background="?selectableItemBackgroundBorderless"
android:clickable="false" android:clickable="false"
android:contentDescription="@string/ok" android:contentDescription="@string/ok"
android:padding="@dimen/medium_margin" android:drawableTop="@drawable/ic_send_vector"
android:src="@drawable/ic_send_vector" /> android:paddingVertical="@dimen/small_margin"
android:text="@string/sms"
android:textSize="@dimen/smaller_text_size" />
</RelativeLayout> </RelativeLayout>