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