mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
properly update the font size without restarting the app
This commit is contained in:
@@ -35,6 +35,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private val MAKE_DEFAULT_APP_REQUEST = 1
|
private val MAKE_DEFAULT_APP_REQUEST = 1
|
||||||
|
|
||||||
private var storedTextColor = 0
|
private var storedTextColor = 0
|
||||||
|
private var storedFontSize = 0
|
||||||
private var bus: EventBus? = null
|
private var bus: EventBus? = null
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
@@ -77,6 +78,10 @@ class MainActivity : SimpleActivity() {
|
|||||||
(conversations_list.adapter as? ConversationsAdapter)?.updateTextColor(config.textColor)
|
(conversations_list.adapter as? ConversationsAdapter)?.updateTextColor(config.textColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storedFontSize != config.fontSize) {
|
||||||
|
(conversations_list.adapter as? ConversationsAdapter)?.updateFontSize()
|
||||||
|
}
|
||||||
|
|
||||||
updateTextColors(main_coordinator)
|
updateTextColors(main_coordinator)
|
||||||
no_conversations_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
no_conversations_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||||
no_conversations_placeholder_2.underlineText()
|
no_conversations_placeholder_2.underlineText()
|
||||||
@@ -120,6 +125,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
storedTextColor = config.textColor
|
storedTextColor = config.textColor
|
||||||
|
storedFontSize = config.fontSize
|
||||||
}
|
}
|
||||||
|
|
||||||
// while SEND_SMS and READ_SMS permissions are mandatory, READ_CONTACTS is optional. If we don't have it, we just won't be able to show the contact name in some cases
|
// while SEND_SMS and READ_SMS permissions are mandatory, READ_CONTACTS is optional. If we don't have it, we just won't be able to show the contact name in some cases
|
||||||
|
@@ -174,6 +174,11 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateFontSize() {
|
||||||
|
fontSize = activity.getTextSize()
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
fun updateConversations(newConversations: ArrayList<Conversation>) {
|
fun updateConversations(newConversations: ArrayList<Conversation>) {
|
||||||
val oldHashCode = conversations.hashCode()
|
val oldHashCode = conversations.hashCode()
|
||||||
val newHashCode = newConversations.hashCode()
|
val newHashCode = newConversations.hashCode()
|
||||||
|
Reference in New Issue
Block a user