adding some checks to avoid sending empty SMS
This commit is contained in:
parent
2e078af782
commit
7068199f7f
|
@ -2,6 +2,7 @@ package com.simplemobiletools.smsmessenger.activities
|
|||
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.onTextChangeListener
|
||||
import com.simplemobiletools.commons.extensions.value
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter
|
||||
|
@ -38,16 +39,21 @@ class ThreadActivity : SimpleActivity() {
|
|||
items.add(it)
|
||||
}
|
||||
|
||||
ThreadAdapter(this, items, thread_messages_list, thread_messages_fastscroller) {
|
||||
|
||||
}.apply {
|
||||
thread_messages_list.adapter = this
|
||||
}
|
||||
val adapter = ThreadAdapter(this, items, thread_messages_list, thread_messages_fastscroller) {}
|
||||
thread_messages_list.adapter = adapter
|
||||
|
||||
thread_type_message.setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
||||
thread_send_message.applyColorFilter(config.textColor)
|
||||
|
||||
thread_type_message.onTextChangeListener {
|
||||
thread_send_message.isClickable = it.isNotEmpty()
|
||||
}
|
||||
|
||||
thread_send_message.setOnClickListener {
|
||||
val msg = thread_type_message.value
|
||||
if (msg.isEmpty()) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
android:layout_marginEnd="@dimen/small_margin"
|
||||
android:alpha="0.9"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="false"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_send_vector" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue