Hiding keyboard when showing instant payment info PopupWindow

This commit is contained in:
dankito 2020-09-13 02:19:53 +02:00
parent b33964a76b
commit 5b054dcb52
3 changed files with 19 additions and 2 deletions

View File

@ -196,7 +196,9 @@ open class TransferMoneyDialog : DialogFragment() {
}
protected open fun showInstantPaymentInfo(btnShowInstantPaymentInfo: ImageButton, rootView: View) {
context?.asActivity()?.layoutInflater?.inflate(R.layout.view_instant_payment_info, null)?.let { contentView ->
requireActivity().layoutInflater.inflate(R.layout.view_instant_payment_info, null)?.let { contentView ->
requireContext().hideKeyboard(lytInstantPayment)
val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
popupWindow.isFocusable = true

View File

@ -15,7 +15,6 @@ import net.dankito.banking.ui.android.di.BankingComponent
import net.dankito.banking.ui.android.views.FormEditText
import net.dankito.banking.ui.model.TypedCustomer
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.android.extensions.hideKeyboardDelayed
import javax.inject.Inject

View File

@ -0,0 +1,16 @@
package net.dankito.banking.ui.android.extensions
import android.content.Context
import android.os.IBinder
import android.view.View
import android.view.inputmethod.InputMethodManager
fun Context.hideKeyboard(anyViewInHierarchy: View, flags: Int = 0) {
hideKeyboard(anyViewInHierarchy.windowToken, flags)
}
fun Context.hideKeyboard(windowToken: IBinder, flags: Int = 0) {
val keyboard = this.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
keyboard.hideSoftInputFromWindow(windowToken, flags)
}