mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-17 04:00:35 +01:00
properly update the font size without restarting the app
This commit is contained in:
parent
6d0dd67af3
commit
880dd7bf27
@ -35,6 +35,7 @@ class MainActivity : SimpleActivity() {
|
||||
private val MAKE_DEFAULT_APP_REQUEST = 1
|
||||
|
||||
private var storedTextColor = 0
|
||||
private var storedFontSize = 0
|
||||
private var bus: EventBus? = null
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@ -77,6 +78,10 @@ class MainActivity : SimpleActivity() {
|
||||
(conversations_list.adapter as? ConversationsAdapter)?.updateTextColor(config.textColor)
|
||||
}
|
||||
|
||||
if (storedFontSize != config.fontSize) {
|
||||
(conversations_list.adapter as? ConversationsAdapter)?.updateFontSize()
|
||||
}
|
||||
|
||||
updateTextColors(main_coordinator)
|
||||
no_conversations_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||
no_conversations_placeholder_2.underlineText()
|
||||
@ -120,6 +125,7 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private fun storeStateVariables() {
|
||||
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
|
||||
|
@ -174,6 +174,11 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
||||
}
|
||||
}
|
||||
|
||||
fun updateFontSize() {
|
||||
fontSize = activity.getTextSize()
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun updateConversations(newConversations: ArrayList<Conversation>) {
|
||||
val oldHashCode = conversations.hashCode()
|
||||
val newHashCode = newConversations.hashCode()
|
||||
|
Loading…
x
Reference in New Issue
Block a user