mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Add media keyboard support in CFv2.
This commit is contained in:
@@ -34,10 +34,13 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
hideInput(resetKeyboardGuideline = false)
|
||||
}
|
||||
|
||||
fun toggleInput(fragmentCreator: FragmentCreator, imeTarget: EditText, toggled: (Boolean) -> Unit = { }) {
|
||||
fun toggleInput(fragmentCreator: FragmentCreator, imeTarget: EditText, showSoftKeyOnHide: Boolean = false) {
|
||||
if (fragmentCreator.id == inputId) {
|
||||
hideInput(resetKeyboardGuideline = true)
|
||||
toggled(false)
|
||||
if (showSoftKeyOnHide) {
|
||||
showSoftkey(imeTarget)
|
||||
} else {
|
||||
hideInput(resetKeyboardGuideline = true)
|
||||
}
|
||||
} else {
|
||||
hideInput(resetKeyboardGuideline = false)
|
||||
showInput(fragmentCreator, imeTarget)
|
||||
@@ -55,6 +58,7 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
fragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.input_container, input!!)
|
||||
.runOnCommit { (input as? InputFragment)?.show() }
|
||||
.commit()
|
||||
|
||||
overrideKeyboardGuidelineWithPreviousHeight()
|
||||
@@ -66,6 +70,7 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
private fun hideInput(resetKeyboardGuideline: Boolean) {
|
||||
val inputHidden = input != null
|
||||
input?.let {
|
||||
(input as? InputFragment)?.hide()
|
||||
fragmentManager
|
||||
.beginTransaction()
|
||||
.remove(it)
|
||||
@@ -94,4 +99,9 @@ class InputAwareConstraintLayout @JvmOverloads constructor(
|
||||
fun onInputShown()
|
||||
fun onInputHidden()
|
||||
}
|
||||
|
||||
interface InputFragment {
|
||||
fun show()
|
||||
fun hide()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ public class MediaKeyboard extends FrameLayout implements InputView {
|
||||
if (!isInitialised) initView();
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
if (keyboardListener != null) keyboardListener.onShown();
|
||||
keyboardPagerFragment.show();
|
||||
}
|
||||
|
||||
@@ -113,7 +112,6 @@ public class MediaKeyboard extends FrameLayout implements InputView {
|
||||
public void hide(boolean immediate) {
|
||||
setVisibility(GONE);
|
||||
onCloseEmojiSearchInternal(false);
|
||||
if (keyboardListener != null) keyboardListener.onHidden();
|
||||
Log.i(TAG, "hide()");
|
||||
keyboardPagerFragment.hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user