forked from upstream-mirrors/quik
Go back to search mode if all contacts are removed
This commit is contained in:
@@ -27,7 +27,9 @@ import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import kotlinx.android.synthetic.main.group_avatar_view.view.*
|
||||
|
||||
class GroupAvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ConstraintLayout(context, attrs) {
|
||||
class GroupAvatarView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : ConstraintLayout(context, attrs) {
|
||||
|
||||
var contacts: List<Recipient> = ArrayList()
|
||||
set(value) {
|
||||
|
||||
@@ -324,7 +324,13 @@ class ComposeViewModel @Inject constructor(
|
||||
// Update the list of selected contacts when a new contact is selected or an existing one is deselected
|
||||
Observable.merge(
|
||||
view.chipDeletedIntent.doOnNext { contact ->
|
||||
contactsReducer.onNext { contacts -> contacts.filterNot { it == contact } }
|
||||
contactsReducer.onNext { contacts ->
|
||||
val result = contacts.filterNot { it == contact }
|
||||
if (result.isEmpty()) {
|
||||
newState { copy(searching = true) }
|
||||
}
|
||||
result
|
||||
}
|
||||
},
|
||||
view.chipSelectedIntent.doOnNext { composeItem ->
|
||||
newState { copy(searching = false) }
|
||||
|
||||
Reference in New Issue
Block a user