Show the keyboard when selecting Other in Receive.
- Automatically show the keyboard and focus the AutoCompleteTextView when the user selects 'Other...' in the Asset spinner, in the Receive screen. - Created an extension function for EditText, which requests focus and shows the keyboard at the same time, so that the user can immediately start typing the desired text.
This commit is contained in:
parent
9cabc0565a
commit
3b5d04abd4
2 changed files with 12 additions and 0 deletions
|
@ -21,6 +21,7 @@ import cy.agorise.bitsybitshareswallet.adapters.AssetsAdapter
|
||||||
import cy.agorise.bitsybitshareswallet.adapters.AutoSuggestAssetAdapter
|
import cy.agorise.bitsybitshareswallet.adapters.AutoSuggestAssetAdapter
|
||||||
import cy.agorise.bitsybitshareswallet.utils.Constants
|
import cy.agorise.bitsybitshareswallet.utils.Constants
|
||||||
import cy.agorise.bitsybitshareswallet.utils.Helper
|
import cy.agorise.bitsybitshareswallet.utils.Helper
|
||||||
|
import cy.agorise.bitsybitshareswallet.utils.showKeyboard
|
||||||
import cy.agorise.bitsybitshareswallet.utils.toast
|
import cy.agorise.bitsybitshareswallet.utils.toast
|
||||||
import cy.agorise.bitsybitshareswallet.viewmodels.ReceiveTransactionViewModel
|
import cy.agorise.bitsybitshareswallet.viewmodels.ReceiveTransactionViewModel
|
||||||
import cy.agorise.graphenej.*
|
import cy.agorise.graphenej.*
|
||||||
|
@ -156,6 +157,7 @@ class ReceiveTransactionFragment : ConnectedFragment() {
|
||||||
mAssetsAdapter?.getItem(position)?.let { asset ->
|
mAssetsAdapter?.getItem(position)?.let { asset ->
|
||||||
if (asset.id == OTHER_ASSET) {
|
if (asset.id == OTHER_ASSET) {
|
||||||
tilAsset.visibility = View.VISIBLE
|
tilAsset.visibility = View.VISIBLE
|
||||||
|
actvAsset.showKeyboard()
|
||||||
mAsset = null
|
mAsset = null
|
||||||
} else {
|
} else {
|
||||||
tilAsset.visibility = View.GONE
|
tilAsset.visibility = View.GONE
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import android.widget.EditText
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
@ -52,4 +53,13 @@ fun String.containsVowels(): Boolean {
|
||||||
fun View.hideKeyboard(){
|
fun View.hideKeyboard(){
|
||||||
val inputMethodManager = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputMethodManager = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
inputMethodManager.hideSoftInputFromWindow(this.windowToken, 0)
|
inputMethodManager.hideSoftInputFromWindow(this.windowToken, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to request focus and show the Keyboard from an EditText (and its sub-classes).
|
||||||
|
*/
|
||||||
|
fun EditText.showKeyboard() {
|
||||||
|
requestFocus()
|
||||||
|
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
|
||||||
}
|
}
|
Loading…
Reference in a new issue