mirror of
				https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
				synced 2025-06-05 21:49:22 +02:00 
			
		
		
		
	Merge pull request #363 from Naveen3Singh/add_msg_label
Add SMS/MMS label under send message button
This commit is contained in:
		| @@ -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.* | ||||||
| @@ -243,6 +244,7 @@ class ThreadActivity : SimpleActivity() { | |||||||
|  |  | ||||||
|                 setupThreadTitle() |                 setupThreadTitle() | ||||||
|                 setupSIMSelector() |                 setupSIMSelector() | ||||||
|  |                 updateMessageType() | ||||||
|                 callback() |                 callback() | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -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) | ||||||
|  |  | ||||||
| @@ -437,7 +442,6 @@ class ThreadActivity : SimpleActivity() { | |||||||
|                     numbers.add(it.normalizedNumber) |                     numbers.add(it.normalizedNumber) | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             val newThreadId = getThreadId(numbers) |             val newThreadId = getThreadId(numbers) | ||||||
|             if (threadId != newThreadId) { |             if (threadId != newThreadId) { | ||||||
|                 hideKeyboard() |                 hideKeyboard() | ||||||
| @@ -641,6 +645,7 @@ class ThreadActivity : SimpleActivity() { | |||||||
|  |  | ||||||
|         participants.add(contact) |         participants.add(contact) | ||||||
|         showSelectedContacts() |         showSelectedContacts() | ||||||
|  |         updateMessageType() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun markAsUnread() { |     private fun markAsUnread() { | ||||||
| @@ -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() { | ||||||
| @@ -950,6 +957,7 @@ class ThreadActivity : SimpleActivity() { | |||||||
|     private fun removeSelectedContact(id: Int) { |     private fun removeSelectedContact(id: Int) { | ||||||
|         participants = participants.filter { it.rawId != id }.toMutableList() as ArrayList<SimpleContact> |         participants = participants.filter { it.rawId != id }.toMutableList() as ArrayList<SimpleContact> | ||||||
|         showSelectedContacts() |         showSelectedContacts() | ||||||
|  |         updateMessageType() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun getPhoneNumbersFromIntent(): ArrayList<String> { |     private fun getPhoneNumbersFromIntent(): ArrayList<String> { | ||||||
| @@ -1059,4 +1067,17 @@ 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 stringId = if (attachmentSelections.isNotEmpty() || isGroupMms || isLongMmsMessage) { | ||||||
|  |             R.string.mms | ||||||
|  |         } else { | ||||||
|  |             R.string.sms | ||||||
|  |         } | ||||||
|  |         thread_send_message.setText(stringId) | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
| @@ -8,6 +8,8 @@ | |||||||
|     <string name="mms_file_size_limit_600kb">600KB</string> |     <string name="mms_file_size_limit_600kb">600KB</string> | ||||||
|     <string name="mms_file_size_limit_1mb">1MB</string> |     <string name="mms_file_size_limit_1mb">1MB</string> | ||||||
|     <string name="mms_file_size_limit_2mb">2MB</string> |     <string name="mms_file_size_limit_2mb">2MB</string> | ||||||
|  |     <string name="sms">SMS</string> | ||||||
|  |     <string name="mms">MMS</string> | ||||||
|  |  | ||||||
|     <string name="release_48"> |     <string name="release_48"> | ||||||
|         Disabled delivery reports by default\n |         Disabled delivery reports by default\n | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user