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 android.os.Bundle
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.onTextChangeListener
|
||||||
import com.simplemobiletools.commons.extensions.value
|
import com.simplemobiletools.commons.extensions.value
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import com.simplemobiletools.smsmessenger.R
|
||||||
import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter
|
import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter
|
||||||
|
@ -38,16 +39,21 @@ class ThreadActivity : SimpleActivity() {
|
||||||
items.add(it)
|
items.add(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadAdapter(this, items, thread_messages_list, thread_messages_fastscroller) {
|
val adapter = ThreadAdapter(this, items, thread_messages_list, thread_messages_fastscroller) {}
|
||||||
|
thread_messages_list.adapter = adapter
|
||||||
}.apply {
|
|
||||||
thread_messages_list.adapter = this
|
|
||||||
}
|
|
||||||
|
|
||||||
thread_type_message.setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
thread_type_message.setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
||||||
thread_send_message.applyColorFilter(config.textColor)
|
thread_send_message.applyColorFilter(config.textColor)
|
||||||
|
|
||||||
|
thread_type_message.onTextChangeListener {
|
||||||
|
thread_send_message.isClickable = it.isNotEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
thread_send_message.setOnClickListener {
|
thread_send_message.setOnClickListener {
|
||||||
val msg = thread_type_message.value
|
val msg = thread_type_message.value
|
||||||
|
if (msg.isEmpty()) {
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
android:layout_marginEnd="@dimen/small_margin"
|
android:layout_marginEnd="@dimen/small_margin"
|
||||||
android:alpha="0.9"
|
android:alpha="0.9"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="false"
|
||||||
android:padding="@dimen/medium_margin"
|
android:padding="@dimen/medium_margin"
|
||||||
android:src="@drawable/ic_send_vector" />
|
android:src="@drawable/ic_send_vector" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue