diff --git a/app/build.gradle b/app/build.gradle
index dbc52805..3266e0d6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,12 +10,12 @@ if (keystorePropertiesFile.exists()) {
}
android {
- compileSdkVersion 30
+ compileSdkVersion 31
defaultConfig {
applicationId "com.simplemobiletools.smsmessenger"
minSdkVersion 22
- targetSdkVersion 30
+ targetSdkVersion 31
versionCode 50
versionName "5.12.7"
setProperty("archivesBaseName", "sms-messenger")
@@ -62,7 +62,7 @@ android {
}
dependencies {
- implementation 'com.github.SimpleMobileTools:Simple-Commons:99ed70cdbf'
+ implementation 'com.github.SimpleMobileTools:Simple-Commons:e3376e4f56'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.klinkerapps:android-smsmms:5.2.6'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 58222944..e253980e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -40,16 +40,21 @@
-
+
@@ -65,6 +70,7 @@
@@ -101,6 +107,7 @@
@@ -112,16 +119,19 @@
@@ -148,6 +158,7 @@
@@ -156,6 +167,7 @@
@@ -167,6 +179,7 @@
@@ -218,6 +232,7 @@
@@ -231,6 +246,7 @@
@@ -244,6 +260,7 @@
@@ -257,6 +274,7 @@
@@ -270,6 +288,7 @@
@@ -283,6 +302,7 @@
@@ -296,6 +316,7 @@
@@ -309,6 +330,7 @@
@@ -322,6 +344,7 @@
@@ -335,6 +358,7 @@
@@ -348,6 +372,7 @@
@@ -361,6 +386,7 @@
@@ -374,6 +400,7 @@
@@ -387,6 +414,7 @@
@@ -399,6 +427,7 @@
@@ -412,6 +441,7 @@
@@ -425,6 +455,7 @@
@@ -438,6 +469,7 @@
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt
index 3bf1645e..e52ca483 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt
@@ -93,8 +93,8 @@ class MainActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
- if (storedTextColor != config.textColor) {
- (conversations_list.adapter as? ConversationsAdapter)?.updateTextColor(config.textColor)
+ if (storedTextColor != getProperTextColor()) {
+ (conversations_list.adapter as? ConversationsAdapter)?.updateTextColor(getProperTextColor())
}
if (storedFontSize != config.fontSize) {
@@ -104,10 +104,10 @@ class MainActivity : SimpleActivity() {
(conversations_list.adapter as? ConversationsAdapter)?.updateDrafts()
updateTextColors(main_coordinator)
- val adjustedPrimaryColor = getAdjustedPrimaryColor()
- no_conversations_placeholder_2.setTextColor(adjustedPrimaryColor)
+ val properPrimaryColor = getProperPrimaryColor()
+ no_conversations_placeholder_2.setTextColor(properPrimaryColor)
no_conversations_placeholder_2.underlineText()
- conversations_fastscroller.updateColors(adjustedPrimaryColor)
+ conversations_fastscroller.updateColors(properPrimaryColor)
checkShortcut()
}
@@ -156,7 +156,7 @@ class MainActivity : SimpleActivity() {
}
private fun storeStateVariables() {
- storedTextColor = config.textColor
+ storedTextColor = getProperTextColor()
storedFontSize = config.fontSize
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt
index 1790bf2d..ec1e3162 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt
@@ -9,12 +9,14 @@ import com.google.gson.Gson
import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
-import com.simplemobiletools.commons.helpers.*
+import com.simplemobiletools.commons.helpers.MyContactsContentProvider
+import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
+import com.simplemobiletools.commons.helpers.SimpleContactsHelper
+import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.adapters.ContactsAdapter
-import com.simplemobiletools.smsmessenger.extensions.config
import com.simplemobiletools.smsmessenger.extensions.getSuggestedContacts
import com.simplemobiletools.smsmessenger.extensions.getThreadId
import com.simplemobiletools.smsmessenger.helpers.*
@@ -22,7 +24,6 @@ import kotlinx.android.synthetic.main.activity_new_conversation.*
import kotlinx.android.synthetic.main.item_suggested_contact.view.*
import java.net.URLDecoder
import java.util.*
-import kotlin.collections.ArrayList
class NewConversationActivity : SimpleActivity() {
private var allContacts = ArrayList()
@@ -45,7 +46,7 @@ class NewConversationActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
- no_contacts_placeholder_2.setTextColor(getAdjustedPrimaryColor())
+ no_contacts_placeholder_2.setTextColor(getProperPrimaryColor())
no_contacts_placeholder_2.underlineText()
}
@@ -78,7 +79,7 @@ class NewConversationActivity : SimpleActivity() {
new_conversation_confirm.beVisibleIf(searchString.length > 2)
}
- new_conversation_confirm.applyColorFilter(config.textColor)
+ new_conversation_confirm.applyColorFilter(getProperTextColor())
new_conversation_confirm.setOnClickListener {
val number = new_conversation_address.value
launchThreadActivity(number, number)
@@ -92,12 +93,12 @@ class NewConversationActivity : SimpleActivity() {
}
}
- val adjustedPrimaryColor = getAdjustedPrimaryColor()
- contacts_letter_fastscroller.textColor = config.textColor.getColorStateList()
- contacts_letter_fastscroller.pressedTextColor = adjustedPrimaryColor
+ val properPrimaryColor = getProperPrimaryColor()
+ contacts_letter_fastscroller.textColor = getProperTextColor().getColorStateList()
+ contacts_letter_fastscroller.pressedTextColor = properPrimaryColor
contacts_letter_fastscroller_thumb.setupWithFastScroller(contacts_letter_fastscroller)
- contacts_letter_fastscroller_thumb?.textColor = adjustedPrimaryColor.getContrastColor()
- contacts_letter_fastscroller_thumb?.thumbColor = adjustedPrimaryColor.getColorStateList()
+ contacts_letter_fastscroller_thumb?.textColor = properPrimaryColor.getContrastColor()
+ contacts_letter_fastscroller_thumb?.thumbColor = properPrimaryColor.getColorStateList()
}
private fun isThirdPartyIntent(): Boolean {
@@ -188,7 +189,7 @@ class NewConversationActivity : SimpleActivity() {
val contact = it
layoutInflater.inflate(R.layout.item_suggested_contact, null).apply {
suggested_contact_name.text = contact.name
- suggested_contact_name.setTextColor(baseConfig.textColor)
+ suggested_contact_name.setTextColor(getProperTextColor())
if (!isDestroyed) {
SimpleContactsHelper(this@NewConversationActivity).loadContactImage(contact.photoUri, suggested_contact_image, contact.name)
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt
index db605bfc..dfc2dab7 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt
@@ -48,7 +48,7 @@ class SettingsActivity : SimpleActivity() {
}
arrayOf(settings_color_customization_label, settings_general_settings_label, settings_outgoing_messages_label, settings_notifications_label).forEach {
- it.setTextColor(getAdjustedPrimaryColor())
+ it.setTextColor(getProperPrimaryColor())
}
arrayOf(
@@ -57,7 +57,7 @@ class SettingsActivity : SimpleActivity() {
settings_outgoing_messages_holder,
settings_notifications_holder
).forEach {
- it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor())
+ it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt
index 7f118849..33076796 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt
@@ -46,7 +46,6 @@ import com.simplemobiletools.smsmessenger.helpers.*
import com.simplemobiletools.smsmessenger.models.*
import com.simplemobiletools.smsmessenger.receivers.SmsStatusDeliveredReceiver
import com.simplemobiletools.smsmessenger.receivers.SmsStatusSentReceiver
-import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_thread.*
import kotlinx.android.synthetic.main.item_attachment.view.*
import kotlinx.android.synthetic.main.item_selected_contact.view.*
@@ -351,13 +350,13 @@ class ThreadActivity : SimpleActivity() {
private fun setupButtons() {
updateTextColors(thread_holder)
- val textColor = config.textColor
+ val textColor = getProperTextColor()
thread_send_message.applyColorFilter(textColor)
confirm_manage_contacts.applyColorFilter(textColor)
thread_add_attachment.applyColorFilter(textColor)
- val adjustedPrimaryColor = getAdjustedPrimaryColor()
- thread_messages_fastscroller.updateColors(adjustedPrimaryColor)
+ val properPrimaryColor = getProperPrimaryColor()
+ thread_messages_fastscroller.updateColors(properPrimaryColor)
thread_character_counter.beVisibleIf(config.showCharacterCounter)
thread_character_counter.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
@@ -487,7 +486,7 @@ class ThreadActivity : SimpleActivity() {
currentSIMCardIndex = availableSIMs.indexOfFirstOrNull { it.subscriptionId == config.getUseSIMIdAtNumber(numbers.first()) } ?: 0
- thread_select_sim_icon.applyColorFilter(config.textColor)
+ thread_select_sim_icon.applyColorFilter(getProperTextColor())
thread_select_sim_icon.beVisible()
thread_select_sim_number.beVisible()
@@ -500,7 +499,7 @@ class ThreadActivity : SimpleActivity() {
}
}
- thread_select_sim_number.setTextColor(config.textColor.getContrastColor())
+ thread_select_sim_number.setTextColor(getProperTextColor().getContrastColor())
thread_select_sim_number.text = (availableSIMCards[currentSIMCardIndex].id).toString()
}
}
@@ -557,19 +556,19 @@ class ThreadActivity : SimpleActivity() {
}
private fun showSelectedContacts() {
- val adjustedColor = getAdjustedPrimaryColor()
+ val properPrimaryColor = getProperPrimaryColor()
val views = ArrayList()
participants.forEach {
val contact = it
layoutInflater.inflate(R.layout.item_selected_contact, null).apply {
val selectedContactBg = resources.getDrawable(R.drawable.item_selected_contact_background)
- (selectedContactBg as LayerDrawable).findDrawableByLayerId(R.id.selected_contact_bg).applyColorFilter(adjustedColor)
+ (selectedContactBg as LayerDrawable).findDrawableByLayerId(R.id.selected_contact_bg).applyColorFilter(properPrimaryColor)
selected_contact_holder.background = selectedContactBg
selected_contact_name.text = contact.name
- selected_contact_name.setTextColor(adjustedColor.getContrastColor())
- selected_contact_remove.applyColorFilter(adjustedColor.getContrastColor())
+ selected_contact_name.setTextColor(properPrimaryColor.getContrastColor())
+ selected_contact_remove.applyColorFilter(properPrimaryColor.getContrastColor())
selected_contact_remove.setOnClickListener {
if (contact.rawId != participants.first().rawId) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt
index 6acdae5f..ab18578f 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt
@@ -9,6 +9,7 @@ import android.widget.RelativeLayout
import android.widget.TextView
import com.simplemobiletools.commons.extensions.darkenColor
import com.simplemobiletools.commons.extensions.getContrastColor
+import com.simplemobiletools.commons.extensions.getProperBackgroundColor
import com.simplemobiletools.commons.extensions.normalizeString
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.models.SimpleContact
@@ -34,7 +35,7 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
isFocusable = false
}
- val backgroundColor = activity.config.backgroundColor
+ val backgroundColor = activity.getProperBackgroundColor()
findViewById(R.id.item_contact_holder).setBackgroundColor(backgroundColor.darkenColor())
findViewById(R.id.item_contact_name).setTextColor(backgroundColor.getContrastColor())
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt
index 10f51b85..9a9a47bb 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt
@@ -298,7 +298,7 @@ class ConversationsAdapter(
view.apply {
val smsDraft = drafts[conversation.threadId]
draft_indicator.beVisibleIf(smsDraft != null)
- draft_indicator.setTextColor(adjustedPrimaryColor)
+ draft_indicator.setTextColor(properPrimaryColor)
pin_indicator.beVisibleIf(activity.config.pinnedConversations.contains(conversation.threadId.toString()))
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/SearchResultsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/SearchResultsAdapter.kt
index 86cd5f37..5ad6cb95 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/SearchResultsAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/SearchResultsAdapter.kt
@@ -67,13 +67,13 @@ class SearchResultsAdapter(
private fun setupView(view: View, searchResult: SearchResult) {
view.apply {
search_result_title.apply {
- text = searchResult.title.highlightTextPart(textToHighlight, adjustedPrimaryColor)
+ text = searchResult.title.highlightTextPart(textToHighlight, properPrimaryColor)
setTextColor(textColor)
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize * 1.2f)
}
search_result_snippet.apply {
- text = searchResult.snippet.highlightTextPart(textToHighlight, adjustedPrimaryColor)
+ text = searchResult.snippet.highlightTextPart(textToHighlight, properPrimaryColor)
setTextColor(textColor)
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize * 0.9f)
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
index a9850e97..232d43c8 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt
@@ -262,14 +262,14 @@ class ThreadAdapter(
}
}
thread_message_body.setTextColor(textColor)
- thread_message_body.setLinkTextColor(context.getAdjustedPrimaryColor())
+ thread_message_body.setLinkTextColor(context.getProperPrimaryColor())
if (!activity.isFinishing && !activity.isDestroyed) {
SimpleContactsHelper(context).loadContactImage(message.senderPhotoUri, thread_message_sender_photo, message.senderName)
}
} else {
thread_message_sender_photo?.beGone()
- val background = context.getAdjustedPrimaryColor()
+ val background = context.getProperPrimaryColor()
thread_message_body.background.applyColorFilter(background)
val contrastColor = background.getContrastColor()
@@ -359,7 +359,7 @@ class ThreadAdapter(
}
thread_mesage_attachments_holder.addView(attachmentView)
} else {
- val background = context.getAdjustedPrimaryColor()
+ val background = context.getProperPrimaryColor()
val attachmentView = layoutInflater.inflate(R.layout.item_sent_unknown_attachment, null).apply {
thread_sent_attachment_label.apply {
this.background.applyColorFilter(background)
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt
index c318e587..75859c77 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt
@@ -786,7 +786,7 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
}
}
- color = getAdjustedPrimaryColor()
+ color = getProperPrimaryColor()
setSmallIcon(R.drawable.ic_messenger)
setContentIntent(pendingIntent)
priority = NotificationCompat.PRIORITY_MAX
diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt
index 9949f37f..a5e6d49e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsStatusSentReceiver.kt
@@ -16,8 +16,8 @@ import android.os.Looper
import android.provider.Telephony
import androidx.core.app.NotificationCompat
import com.klinker.android.send_message.SentReceiver
-import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getMyContactsCursor
+import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isOreoPlus
@@ -94,7 +94,7 @@ class SmsStatusSentReceiver : SentReceiver() {
val builder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL)
.setContentTitle(context.getString(R.string.message_not_sent_short))
.setContentText(summaryText)
- .setColor(context.getAdjustedPrimaryColor())
+ .setColor(context.getProperPrimaryColor())
.setSmallIcon(R.drawable.ic_messenger)
.setLargeIcon(largeIcon)
.setStyle(NotificationCompat.BigTextStyle().bigText(summaryText))
diff --git a/app/src/main/res/menu/cab_conversations.xml b/app/src/main/res/menu/cab_conversations.xml
index 886b74b6..25de85fa 100644
--- a/app/src/main/res/menu/cab_conversations.xml
+++ b/app/src/main/res/menu/cab_conversations.xml
@@ -1,6 +1,8 @@
diff --git a/app/src/main/res/menu/cab_thread.xml b/app/src/main/res/menu/cab_thread.xml
index 6dfeed73..c2b6f70e 100644
--- a/app/src/main/res/menu/cab_thread.xml
+++ b/app/src/main/res/menu/cab_thread.xml
@@ -1,6 +1,8 @@
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index 96972865..0c60c7df 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -1,6 +1,8 @@