Merge pull request #363 from Naveen3Singh/add_msg_label

Add SMS/MMS label under send message button
This commit is contained in:
Tibor Kaputa 2022-06-19 16:20:46 +02:00 committed by GitHub
commit c78f918e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 7 deletions

View File

@ -35,6 +35,7 @@ import com.bumptech.glide.request.target.Target
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
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.extensions.*
import com.simplemobiletools.commons.helpers.*
@ -243,6 +244,7 @@ class ThreadActivity : SimpleActivity() {
setupThreadTitle()
setupSIMSelector()
updateMessageType()
callback()
}
}
@ -404,7 +406,10 @@ class ThreadActivity : SimpleActivity() {
private fun setupButtons() {
updateTextColors(thread_holder)
val textColor = getProperTextColor()
thread_send_message.applyColorFilter(textColor)
thread_send_message.apply {
setTextColor(textColor)
compoundDrawables.forEach { it?.applyColorFilter(textColor) }
}
confirm_manage_contacts.applyColorFilter(textColor)
thread_add_attachment.applyColorFilter(textColor)
@ -437,7 +442,6 @@ class ThreadActivity : SimpleActivity() {
numbers.add(it.normalizedNumber)
}
}
val newThreadId = getThreadId(numbers)
if (threadId != newThreadId) {
hideKeyboard()
@ -641,6 +645,7 @@ class ThreadActivity : SimpleActivity() {
participants.add(contact)
showSelectedContacts()
updateMessageType()
}
private fun markAsUnread() {
@ -821,6 +826,7 @@ class ThreadActivity : SimpleActivity() {
if (attachmentSelections.isEmpty()) {
thread_attachments_holder.beGone()
}
checkSendMessageAvailability()
}
private fun checkSendMessageAvailability() {
@ -831,6 +837,7 @@ class ThreadActivity : SimpleActivity() {
thread_send_message.isClickable = false
thread_send_message.alpha = 0.4f
}
updateMessageType()
}
private fun sendMessage() {
@ -950,6 +957,7 @@ class ThreadActivity : SimpleActivity() {
private fun removeSelectedContact(id: Int) {
participants = participants.filter { it.rawId != id }.toMutableList() as ArrayList<SimpleContact>
showSelectedContacts()
updateMessageType()
}
private fun getPhoneNumbersFromIntent(): ArrayList<String> {
@ -1059,4 +1067,17 @@ class ThreadActivity : SimpleActivity() {
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 stringId = if (attachmentSelections.isNotEmpty() || isGroupMms || isLongMmsMessage) {
R.string.mms
} else {
R.string.sms
}
thread_send_message.setText(stringId)
}
}

View File

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

View File

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

View File

@ -8,6 +8,8 @@
<string name="mms_file_size_limit_600kb">600KB</string>
<string name="mms_file_size_limit_1mb">1MB</string>
<string name="mms_file_size_limit_2mb">2MB</string>
<string name="sms">SMS</string>
<string name="mms">MMS</string>
<string name="release_48">
Disabled delivery reports by default\n