Commit a3a9c9a2 authored by HarveyDoom's avatar HarveyDoom Committed by GitHub

#331 - Display Keyboard when launching dialog.

First ever pull request.
requestFocus() would not work on its own. Setting the Soft Input Mode gets keyboard to display.
parent 8d985b42
......@@ -39,8 +39,9 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
@Override
protected void onSetupDialog() {
View buttonAddChannel = getDialog().findViewById(R.id.btn_add_channel);
TextInputEditText channelNameText = (TextInputEditText) getDialog().findViewById(R.id.editor_channel_name);
RxTextView.textChanges((TextView) getDialog().findViewById(R.id.editor_channel_name))
RxTextView.textChanges((TextView) channelNameText)
.map(text -> !TextUtils.isEmpty(text))
.compose(bindToLifecycle())
.subscribe(
......@@ -49,6 +50,13 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
);
buttonAddChannel.setOnClickListener(view -> createRoom());
requestFocus(channelNameText);
}
private void requestFocus(View view) {
if (view.requestFocus()) {
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
private boolean isChecked(int viewId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment