mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Reshow IME keyboard if it was showing prior to opening attachment keyboard.
This commit is contained in:
@@ -25,6 +25,7 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
|
||||
private var inputId: Int? = null
|
||||
private var input: Fragment? = null
|
||||
private var wasKeyboardVisibleBeforeToggle: Boolean = false
|
||||
|
||||
val isInputShowing: Boolean
|
||||
get() = input != null
|
||||
@@ -38,11 +39,12 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun hideAll(imeTarget: EditText) {
|
||||
wasKeyboardVisibleBeforeToggle = false
|
||||
ViewUtil.hideKeyboard(context, imeTarget)
|
||||
hideInput(resetKeyboardGuideline = true)
|
||||
}
|
||||
|
||||
fun toggleInput(fragmentCreator: FragmentCreator, imeTarget: EditText, showSoftKeyOnHide: Boolean = false) {
|
||||
fun toggleInput(fragmentCreator: FragmentCreator, imeTarget: EditText, showSoftKeyOnHide: Boolean = wasKeyboardVisibleBeforeToggle) {
|
||||
if (fragmentCreator.id == inputId) {
|
||||
if (showSoftKeyOnHide) {
|
||||
showSoftkey(imeTarget)
|
||||
@@ -50,6 +52,7 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
hideInput(resetKeyboardGuideline = true)
|
||||
}
|
||||
} else {
|
||||
wasKeyboardVisibleBeforeToggle = isKeyboardShowing
|
||||
hideInput(resetKeyboardGuideline = false)
|
||||
showInput(fragmentCreator, imeTarget)
|
||||
}
|
||||
@@ -57,6 +60,7 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
|
||||
fun hideInput() {
|
||||
hideInput(resetKeyboardGuideline = true)
|
||||
wasKeyboardVisibleBeforeToggle = false
|
||||
}
|
||||
|
||||
private fun showInput(fragmentCreator: FragmentCreator, imeTarget: EditText) {
|
||||
|
||||
Reference in New Issue
Block a user