allow toggling the Add Person UI at the thread activity

This commit is contained in:
tibbi 2020-04-06 22:22:25 +02:00
parent 900982999f
commit ec5c49ce1e
3 changed files with 16 additions and 12 deletions

View File

@ -21,7 +21,6 @@ import com.simplemobiletools.smsmessenger.extensions.*
import com.simplemobiletools.smsmessenger.helpers.*
import com.simplemobiletools.smsmessenger.models.*
import com.simplemobiletools.smsmessenger.receivers.SmsSentReceiver
import kotlinx.android.synthetic.main.activity_new_message.*
import kotlinx.android.synthetic.main.activity_thread.*
import kotlinx.android.synthetic.main.activity_thread.new_message_to
import kotlinx.android.synthetic.main.activity_thread.selected_contacts
@ -88,7 +87,7 @@ class ThreadActivity : SimpleActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.add_person -> addPerson()
R.id.manage_people -> managePeople()
else -> return super.onOptionsItemSelected(item)
}
return true
@ -145,11 +144,16 @@ class ThreadActivity : SimpleActivity() {
}
}
private fun addPerson() {
showSelectedContacts()
thread_add_contacts.beVisible()
new_message_to.requestFocus()
showKeyboard(new_message_to)
private fun managePeople() {
if (thread_add_contacts.isVisible()) {
hideKeyboard()
thread_add_contacts.beGone()
} else {
showSelectedContacts()
thread_add_contacts.beVisible()
new_message_to.requestFocus()
showKeyboard(new_message_to)
}
}
private fun showSelectedContacts() {

View File

@ -7,10 +7,10 @@
</item>
<item
android:bottom="@dimen/medium_margin"
android:bottom="@dimen/small_margin"
android:drawable="@drawable/ic_person_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin" />
android:left="@dimen/small_margin"
android:right="@dimen/small_margin"
android:top="@dimen/small_margin" />
</layer-list>

View File

@ -2,7 +2,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/add_person"
android:id="@+id/manage_people"
android:icon="@drawable/add_person_vector"
android:title="@string/add_person"
app:showAsAction="ifRoom" />