mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Request focus when showing soft keyboard.
This commit is contained in:
@@ -74,6 +74,7 @@ public class AliasDialogFragment extends AppCompatDialogFragment {
|
||||
aliasEditText.setText(alias);
|
||||
if (alias != null) aliasEditText.setSelection(alias.length());
|
||||
|
||||
// TODO: Close keyboard on accept or cancel
|
||||
Button setButton = v.findViewById(R.id.setButton);
|
||||
setButton.setOnClickListener(v1 -> onSetButtonClicked());
|
||||
|
||||
@@ -96,11 +97,9 @@ public class AliasDialogFragment extends AppCompatDialogFragment {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (aliasEditText.requestFocus()) {
|
||||
requireNonNull(getDialog().getWindow())
|
||||
.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_VISIBLE);
|
||||
showSoftKeyboard(aliasEditText);
|
||||
}
|
||||
requireNonNull(getDialog().getWindow())
|
||||
.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_VISIBLE);
|
||||
showSoftKeyboard(aliasEditText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -327,7 +327,6 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
private void updateTextInput() {
|
||||
if (replyId != null) {
|
||||
textInput.setHint(R.string.forum_message_reply_hint);
|
||||
textInput.requestFocus();
|
||||
textInput.showSoftKeyboard();
|
||||
} else {
|
||||
textInput.setHint(R.string.forum_new_message_hint);
|
||||
|
||||
@@ -92,9 +92,11 @@ public class UiUtils {
|
||||
public static final float GREY_OUT = 0.5f;
|
||||
|
||||
public static void showSoftKeyboard(View view) {
|
||||
InputMethodManager imm = requireNonNull(
|
||||
getSystemService(view.getContext(), InputMethodManager.class));
|
||||
imm.showSoftInput(view, SHOW_IMPLICIT);
|
||||
if (view.requestFocus()) {
|
||||
InputMethodManager imm = requireNonNull(getSystemService(
|
||||
view.getContext(), InputMethodManager.class));
|
||||
imm.showSoftInput(view, SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideSoftKeyboard(View view) {
|
||||
|
||||
@@ -258,7 +258,7 @@ public class EmojiTextInputView extends LinearLayout implements
|
||||
}
|
||||
|
||||
void showSoftKeyboard() {
|
||||
imm.showSoftInput(editText, SHOW_IMPLICIT);
|
||||
if (editText.requestFocus()) imm.showSoftInput(editText, SHOW_IMPLICIT);
|
||||
}
|
||||
|
||||
void hideSoftKeyboard() {
|
||||
|
||||
Reference in New Issue
Block a user