#1028 - Fix backspace not working when searching for contacts

This commit is contained in:
Moez Bhatti
2018-04-30 15:55:08 -04:00
parent 59e8433e2e
commit 4176cf7299
5 changed files with 37 additions and 32 deletions
@@ -20,14 +20,11 @@ package feature.compose
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.RelativeLayout
import com.google.android.flexbox.FlexboxLayoutManager
import com.jakewharton.rxbinding2.view.keys
import com.jakewharton.rxbinding2.widget.editorActions
import com.jakewharton.rxbinding2.widget.textChanges
import com.moez.QKSMS.R
@@ -37,7 +34,7 @@ import common.util.Colors
import common.util.extensions.dpToPx
import common.util.extensions.setBackgroundTint
import common.util.extensions.showKeyboard
import io.reactivex.functions.Predicate
import common.widget.QkEditText
import io.reactivex.subjects.PublishSubject
import kotlinx.android.synthetic.main.contact_chip.view.*
import model.Contact
@@ -51,21 +48,13 @@ class ChipsAdapter @Inject constructor(private val context: Context, private val
}
private val hint: String = context.getString(R.string.title_compose)
private val editText = View.inflate(context, R.layout.chip_input_list_item, null) as EditText
private val editText = View.inflate(context, R.layout.chip_input_list_item, null) as QkEditText
var view: RecyclerView? = null
val chipDeleted: PublishSubject<Contact> = PublishSubject.create<Contact>()
val textChanges = editText.textChanges()
val actions = editText.editorActions()
/**
* On certain devices, not returning false in this predicate for number entry will result in
* the user not being able to enter numbers into the text field. As a result, we have to only
* pass the events that we're looking for
*/
val keyEvents = editText.keys(Predicate { event ->
event.keyCode == KeyEvent.KEYCODE_BACK || event.keyCode == KeyEvent.KEYCODE_DEL
})
val backspaces = editText.backspaces
init {
val wrap = ViewGroup.LayoutParams.WRAP_CONTENT