Minor code formatting

This commit is contained in:
Naveen 2022-11-19 22:59:19 +05:30
parent 398c2237bc
commit a54a65c081
1 changed files with 16 additions and 5 deletions

View File

@ -397,7 +397,9 @@ class ThreadActivity : SimpleActivity() {
private fun scrollToBottom() { private fun scrollToBottom() {
val position = getOrCreateThreadAdapter().currentList.lastIndex val position = getOrCreateThreadAdapter().currentList.lastIndex
if (position >= 0) thread_messages_list.smoothScrollToPosition(position) if (position >= 0) {
thread_messages_list.smoothScrollToPosition(position)
}
} }
private fun handleItemClick(any: Any) { private fun handleItemClick(any: Any) {
@ -448,7 +450,9 @@ class ThreadActivity : SimpleActivity() {
if (messages.isEmpty() || allMessagesFetched || loadingOlderMessages) { if (messages.isEmpty() || allMessagesFetched || loadingOlderMessages) {
if (allMessagesFetched) { if (allMessagesFetched) {
getOrCreateThreadAdapter().apply { getOrCreateThreadAdapter().apply {
val newList = currentList.toMutableList().apply { removeAll { it is ThreadLoading } } val newList = currentList.toMutableList().apply {
removeAll { it is ThreadLoading }
}
updateMessages(newMessages = newList as ArrayList<ThreadItem>, scrollPosition = 0) updateMessages(newMessages = newList as ArrayList<ThreadItem>, scrollPosition = 0)
} }
} }
@ -486,7 +490,9 @@ class ThreadActivity : SimpleActivity() {
val textColor = getProperTextColor() val textColor = getProperTextColor()
thread_send_message.apply { thread_send_message.apply {
setTextColor(textColor) setTextColor(textColor)
compoundDrawables.forEach { it?.applyColorFilter(textColor) } compoundDrawables.forEach {
it?.applyColorFilter(textColor)
}
} }
confirm_manage_contacts.applyColorFilter(textColor) confirm_manage_contacts.applyColorFilter(textColor)
@ -513,7 +519,11 @@ class ThreadActivity : SimpleActivity() {
thread_send_message.isClickable = false thread_send_message.isClickable = false
thread_type_message.onTextChangeListener { thread_type_message.onTextChangeListener {
checkSendMessageAvailability() checkSendMessageAvailability()
val messageString = if (config.useSimpleCharacters) it.normalizeString() else it val messageString = if (config.useSimpleCharacters) {
it.normalizeString()
} else {
it
}
val messageLength = SmsMessage.calculateLength(messageString, false) val messageLength = SmsMessage.calculateLength(messageString, false)
thread_character_counter.text = "${messageLength[2]}/${messageLength[0]}" thread_character_counter.text = "${messageLength[2]}/${messageLength[0]}"
} }
@ -873,7 +883,8 @@ class ThreadActivity : SimpleActivity() {
} }
if (!allMessagesFetched && messages.size >= MESSAGES_LIMIT) { if (!allMessagesFetched && messages.size >= MESSAGES_LIMIT) {
items.add(0, ThreadLoading(generateRandomId())) val threadLoading = ThreadLoading(generateRandomId())
items.add(0, threadLoading)
} }
return items return items