Show keyboard when selecting contact and contact selected

This commit is contained in:
moezbhatti
2019-11-17 02:10:55 -05:00
committed by Moez Bhatti
parent 8d43d60e56
commit 30126523ae
8 changed files with 35 additions and 8 deletions
@@ -24,8 +24,7 @@ import android.view.inputmethod.InputMethodManager
fun Activity.dismissKeyboard() {
window.currentFocus?.let { focus ->
val imm = getSystemService(
Context.INPUT_METHOD_SERVICE) as InputMethodManager
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(focus.windowToken, 0)
focus.clearFocus()
@@ -39,11 +39,16 @@ var ViewGroup.animateLayoutChanges: Boolean
layoutTransition = if (value) LayoutTransition() else null
}
fun EditText.showKeyboard() {
requestFocus()
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this, 0)
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
fun EditText.hideKeyboard() {
requestFocus()
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken, 0)
}
fun ImageView.setTint(color: Int) {