Skip to content

Commit

Permalink
Fixes shimohq#26
Browse files Browse the repository at this point in the history
  • Loading branch information
Noitidart committed Mar 10, 2018
1 parent a08841b commit dd428a8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions android/src/main/java/im/shimo/react/prompt/RNPromptFragment.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package im.shimo.react.prompt;

import android.support.v7.app.AlertDialog;
import android.os.Bundle;
import android.graphics.Color;
import android.content.Context;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.view.inputmethod.InputMethodManager;
import android.text.InputType;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.WindowManager;
import android.widget.EditText;
import android.view.inputmethod.EditorInfo;
import android.graphics.Color;
import android.widget.TextView;
import android.view.KeyEvent;

import javax.annotation.Nullable;

Expand Down Expand Up @@ -201,6 +201,17 @@ public Dialog createDialog(Context activityContext, Bundle arguments) {

mInputText = input;

alertDialog.setOnShowListener(new DialogInterface.OnShowListener()
{
@Override
public void onShow(final DialogInterface dialog)
{
input.requestFocus();
((InputMethodManager) alertDialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(input, 0);
}
});


input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
Expand All @@ -216,7 +227,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = this.createDialog(getActivity(), getArguments());
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return dialog;
}

Expand Down

0 comments on commit dd428a8

Please sign in to comment.