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.helpers.*
import com.simplemobiletools.smsmessenger.models.* import com.simplemobiletools.smsmessenger.models.*
import com.simplemobiletools.smsmessenger.receivers.SmsSentReceiver 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.*
import kotlinx.android.synthetic.main.activity_thread.new_message_to import kotlinx.android.synthetic.main.activity_thread.new_message_to
import kotlinx.android.synthetic.main.activity_thread.selected_contacts import kotlinx.android.synthetic.main.activity_thread.selected_contacts
@@ -88,7 +87,7 @@ class ThreadActivity : SimpleActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.add_person -> addPerson() R.id.manage_people -> managePeople()
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
} }
return true return true
@@ -145,12 +144,17 @@ class ThreadActivity : SimpleActivity() {
} }
} }
private fun addPerson() { private fun managePeople() {
if (thread_add_contacts.isVisible()) {
hideKeyboard()
thread_add_contacts.beGone()
} else {
showSelectedContacts() showSelectedContacts()
thread_add_contacts.beVisible() thread_add_contacts.beVisible()
new_message_to.requestFocus() new_message_to.requestFocus()
showKeyboard(new_message_to) showKeyboard(new_message_to)
} }
}
private fun showSelectedContacts() { private fun showSelectedContacts() {
val views = ArrayList<View>() val views = ArrayList<View>()

View File

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

View File

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