@@ -56,6 +56,7 @@ private void initView(Context context) {
5656 mInputView .setFocusable (true );
5757 mInputView .setFocusableInTouchMode (true );
5858 mInputView .setTransformationMethod (HideReturnsTransformationMethod .getInstance ());
59+ mInputView .setShowSoftInputOnFocus (true );
5960 String packageName = context .getPackageName ();
6061 if (Constant .PACKAGE_NAME_ALIPAY .equals (packageName )
6162 || Constant .PACKAGE_NAME_TAOBAO .equals (packageName )
@@ -87,6 +88,14 @@ private void initView(Context context) {
8788 this .addView (rootLLayout , rootLLayoutParams );
8889
8990 withPositiveButtonText (Lang .getString (R .id .ok ));
91+ withOnPositiveButtonClickListener ((dialog , which ) -> {
92+ mInputView .clearFocus ();
93+ InputMethodManager imm = (InputMethodManager ) getContext ().getSystemService (Context .INPUT_METHOD_SERVICE );
94+ imm .hideSoftInputFromWindow (mInputView .getWindowToken (), 0 );
95+ post (() -> {
96+ dialog .dismiss ();
97+ });
98+ });
9099 }
91100
92101 @ NonNull
@@ -107,10 +116,11 @@ public void setDefaultText(String text) {
107116 @ Override
108117 protected void onAttachedToWindow () {
109118 super .onAttachedToWindow ();
110- post (() -> {
119+ mInputView .requestFocus ();
120+ postDelayed (() -> {
111121 InputMethodManager imm = (InputMethodManager ) getContext ().getSystemService (Context .INPUT_METHOD_SERVICE );
112122 imm .showSoftInput (mInputView , InputMethodManager .SHOW_IMPLICIT );
113- });
123+ }, 200 );
114124 }
115125
116126 @ Override
0 commit comments