|
@@ -1,10 +1,14 @@
|
|
package com.fxy.common;
|
|
package com.fxy.common;
|
|
import com.elvishew.xlog.XLog;
|
|
import com.elvishew.xlog.XLog;
|
|
import com.fxy.R;
|
|
import com.fxy.R;
|
|
|
|
+
|
|
|
|
+import android.app.AlertDialog;
|
|
import android.app.Dialog;
|
|
import android.app.Dialog;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
|
+import android.content.DialogInterface;
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
+import android.os.Handler;
|
|
import android.text.Editable;
|
|
import android.text.Editable;
|
|
import android.text.InputType;
|
|
import android.text.InputType;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
@@ -35,6 +39,10 @@ public class CommonDialog extends Dialog implements View.OnClickListener{
|
|
private String title;
|
|
private String title;
|
|
private String typeCode;
|
|
private String typeCode;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private Handler handler = new Handler();
|
|
|
|
+ private Runnable showKeyboardRunnable;
|
|
|
|
+
|
|
public CommonDialog(Context context) {
|
|
public CommonDialog(Context context) {
|
|
super(context);
|
|
super(context);
|
|
this.mContext = context;
|
|
this.mContext = context;
|
|
@@ -146,7 +154,7 @@ public class CommonDialog extends Dialog implements View.OnClickListener{
|
|
|
|
|
|
protected void setLayout(){
|
|
protected void setLayout(){
|
|
setContentView(R.layout.dialog_normal_layout);
|
|
setContentView(R.layout.dialog_normal_layout);
|
|
- setCanceledOnTouchOutside(false);
|
|
|
|
|
|
+// setCanceledOnTouchOutside(false);
|
|
initView();
|
|
initView();
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
@@ -253,9 +261,20 @@ public class CommonDialog extends Dialog implements View.OnClickListener{
|
|
}
|
|
}
|
|
|
|
|
|
public void show(){
|
|
public void show(){
|
|
|
|
+ // 在 Dialog 显示后延迟显示软键盘
|
|
|
|
+ handler.postDelayed(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ contentTxt.requestFocus();
|
|
|
|
+ contentTxt.setSelection(contentTxt.getText().length());
|
|
|
|
+ InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
+ imm.showSoftInput(contentTxt, InputMethodManager.SHOW_IMPLICIT);
|
|
|
|
+ }
|
|
|
|
+ }, 300);
|
|
super.show();
|
|
super.show();
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
public interface OnCloseListener{
|
|
public interface OnCloseListener{
|
|
void onClickCancel(Dialog dialog, boolean confirm);
|
|
void onClickCancel(Dialog dialog, boolean confirm);
|
|
void onClickSubmit(Dialog dialog, boolean confirm);
|
|
void onClickSubmit(Dialog dialog, boolean confirm);
|