refresh the messages text color if it changes
This commit is contained in:
parent
960b16c99b
commit
10bda77c50
|
@ -16,10 +16,12 @@ import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.smsmessenger.BuildConfig
|
import com.simplemobiletools.smsmessenger.BuildConfig
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import com.simplemobiletools.smsmessenger.R
|
||||||
import com.simplemobiletools.smsmessenger.adapters.MessagesAdapter
|
import com.simplemobiletools.smsmessenger.adapters.MessagesAdapter
|
||||||
|
import com.simplemobiletools.smsmessenger.extensions.config
|
||||||
import com.simplemobiletools.smsmessenger.models.Message
|
import com.simplemobiletools.smsmessenger.models.Message
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
|
||||||
class MainActivity : SimpleActivity() {
|
class MainActivity : SimpleActivity() {
|
||||||
|
private var storedTextColor = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -42,6 +44,18 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
if (storedTextColor != config.textColor) {
|
||||||
|
(messages_list.adapter as? MessagesAdapter)?.updateTextColor(config.textColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
storeStateVariables()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu, menu)
|
menuInflater.inflate(R.menu.menu, menu)
|
||||||
return true
|
return true
|
||||||
|
@ -56,7 +70,12 @@ class MainActivity : SimpleActivity() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun storeStateVariables() {
|
||||||
|
storedTextColor = config.textColor
|
||||||
|
}
|
||||||
|
|
||||||
private fun initMessenger() {
|
private fun initMessenger() {
|
||||||
|
storeStateVariables()
|
||||||
val messages = getMessages()
|
val messages = getMessages()
|
||||||
MessagesAdapter(this, messages, messages_list, messages_fastscroller) {
|
MessagesAdapter(this, messages, messages_list, messages_fastscroller) {
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class MessagesAdapter(
|
||||||
message_body_short.alpha = 1f
|
message_body_short.alpha = 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayListOf<TextView>(message_address, message_body_short).forEach {
|
arrayListOf<TextView>(message_address, message_body_short, message_date).forEach {
|
||||||
it.setTextColor(textColor)
|
it.setTextColor(textColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue