Revert "Fix soft keyboard popping up when the text was selected when the other keyboard was open."

This reverts commit 6d41d1f6d2.
fork-5.53.8
Cody Henthorne 2022-03-18 14:09:52 -04:00
rodzic 75e15c81e1
commit 3e77975c17
2 zmienionych plików z 1 dodań i 29 usunięć

Wyświetl plik

@ -1,8 +1,6 @@
package org.thoughtcrime.securesms.components; package org.thoughtcrime.securesms.components;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.text.InputType;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.widget.EditText; import android.widget.EditText;
@ -14,7 +12,6 @@ import org.thoughtcrime.securesms.util.ServiceUtil;
public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKeyboardShownListener { public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKeyboardShownListener {
private InputView current; private InputView current;
private int previousInputType = InputType.TYPE_NULL;
public InputAwareLayout(Context context) { public InputAwareLayout(Context context) {
this(context, null); this(context, null);
@ -47,8 +44,6 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
input.show(getKeyboardHeight(), current != null); input.show(getKeyboardHeight(), current != null);
current = input; current = input;
} }
setShowSoftInputOnFocusCompat(imeTarget, false);
} }
public InputView getCurrentInput() { public InputView getCurrentInput() {
@ -58,8 +53,6 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
public void hideCurrentInput(EditText imeTarget) { public void hideCurrentInput(EditText imeTarget) {
if (isKeyboardOpen()) hideSoftkey(imeTarget, null); if (isKeyboardOpen()) hideSoftkey(imeTarget, null);
else hideAttachedInput(false); else hideAttachedInput(false);
setShowSoftInputOnFocusCompat(imeTarget, true);
} }
public void hideAttachedInput(boolean instant) { public void hideAttachedInput(boolean instant) {
@ -72,13 +65,6 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
} }
public void showSoftkey(final EditText inputTarget) { public void showSoftkey(final EditText inputTarget) {
showSoftkey(inputTarget, false);
}
public void showSoftkey(final EditText inputTarget, boolean force) {
if (!force && isInputOpen()) return;
setShowSoftInputOnFocusCompat(inputTarget, true);
postOnKeyboardOpen(new Runnable() { postOnKeyboardOpen(new Runnable() {
@Override public void run() { @Override public void run() {
hideAttachedInput(true); hideAttachedInput(true);
@ -99,20 +85,6 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
.hideSoftInputFromWindow(inputTarget.getWindowToken(), 0); .hideSoftInputFromWindow(inputTarget.getWindowToken(), 0);
} }
private void setShowSoftInputOnFocusCompat(EditText imeTarget, boolean show) {
if (Build.VERSION.SDK_INT >= 21) {
imeTarget.setShowSoftInputOnFocus(show);
} else if (show) {
if (previousInputType != InputType.TYPE_NULL) {
imeTarget.setInputType(previousInputType);
}
} else {
previousInputType = imeTarget.getInputType();
imeTarget.setRawInputType(InputType.TYPE_CLASS_TEXT);
imeTarget.setTextIsSelectable(true);
}
}
public interface InputView { public interface InputView {
void show(int height, boolean immediate); void show(int height, boolean immediate);
void hide(boolean immediate); void hide(boolean immediate);

Wyświetl plik

@ -3286,7 +3286,7 @@ public class ConversationParentFragment extends Fragment
emojiDrawerStub.get().setFragmentManager(getChildFragmentManager()); emojiDrawerStub.get().setFragmentManager(getChildFragmentManager());
if (container.getCurrentInput() == emojiDrawerStub.get()) { if (container.getCurrentInput() == emojiDrawerStub.get()) {
container.showSoftkey(composeText, true); container.showSoftkey(composeText);
} else { } else {
container.show(composeText, emojiDrawerStub.get()); container.show(composeText, emojiDrawerStub.get());
} }