Commit fafaf8b3 authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #500 from HarveyDoom/develop

[NEW] Display Keyboard when launching dialog
parents 38b8792c caac8e2f
......@@ -6,6 +6,7 @@ import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
import com.trello.rxlifecycle2.components.support.RxAppCompatDialogFragment;
......@@ -42,6 +43,12 @@ public abstract class AbstractAddRoomDialogFragment extends RxAppCompatDialogFra
methodCall = new MethodCallHelper(getContext(), hostname);
}
protected void requestFocus(View view) {
if (view.requestFocus()) {
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
@Override
public final void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
......
......@@ -2,6 +2,7 @@ package chat.rocket.android.fragment.sidebar.dialog;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.TextView;
......@@ -39,8 +40,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 +51,7 @@ public class AddChannelDialogFragment extends AbstractAddRoomDialogFragment {
);
buttonAddChannel.setOnClickListener(view -> createRoom());
requestFocus(channelNameText);
}
private boolean isChecked(int viewId) {
......
......@@ -80,6 +80,7 @@ public class AddDirectMessageDialogFragment extends AbstractAddRoomDialogFragmen
);
buttonAddDirectMessage.setOnClickListener(view -> createRoom());
requestFocus(autoCompleteTextView);
}
private void setupView(Optional<RocketChatAbsoluteUrl> rocketChatAbsoluteUrlOptional) {
......
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