|
|
@ -10,6 +10,9 @@ import android.widget.TextView; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.kongzue.dialogx.dialogs.BottomDialog; |
|
|
|
|
|
|
|
import com.kongzue.dialogx.dialogs.MessageDialog; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.InputStreamReader; |
|
|
@ -33,7 +36,7 @@ public class DialogCreator { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static AlertDialog createCommonDialog(Context context, String title, String mesage, boolean isCancelable, |
|
|
|
public static AlertDialog createCommonDialog(Context context, String title, String mesage, boolean isCancelable, |
|
|
|
DialogInterface.OnClickListener positiveListener, DialogInterface.OnClickListener negativeListener) { |
|
|
|
DialogInterface.OnClickListener positiveListener, DialogInterface.OnClickListener negativeListener) { |
|
|
|
|
|
|
|
|
|
|
|
final AlertDialog.Builder normalDialog = MyAlertDialog.build(context); |
|
|
|
final AlertDialog.Builder normalDialog = MyAlertDialog.build(context); |
|
|
|
// normalDialog.setIcon(R.drawable.icon_dialog);
|
|
|
|
// normalDialog.setIcon(R.drawable.icon_dialog);
|
|
|
@ -51,9 +54,7 @@ public class DialogCreator { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return alertDialog; |
|
|
|
return alertDialog; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -140,42 +141,6 @@ public class DialogCreator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 创建一个进度对话框(圆形、旋转) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param context |
|
|
|
|
|
|
|
* @param title |
|
|
|
|
|
|
|
* @param message |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static ProgressDialog createProgressDialog |
|
|
|
|
|
|
|
(Context context, String title, String message/*, |
|
|
|
|
|
|
|
DialogInterface.OnClickListener positiveListener,DialogInterface.OnClickListener negativeListener*/) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final ProgressDialog progressDialog = new ProgressDialog(context, R.style.alertDialogTheme); |
|
|
|
|
|
|
|
// normalDialog.setIcon(R.drawable.icon_dialog);
|
|
|
|
|
|
|
|
if (!StringHelper.isEmpty(title)) { |
|
|
|
|
|
|
|
progressDialog.setTitle(title); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!StringHelper.isEmpty(message)) { |
|
|
|
|
|
|
|
progressDialog.setMessage(message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
progressDialog.setCancelable(false); |
|
|
|
|
|
|
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); |
|
|
|
|
|
|
|
/* progressDialog.setPositiveButton("确定",positiveListener); |
|
|
|
|
|
|
|
progressDialog.setNegativeButton("取消",negativeListener);*/ |
|
|
|
|
|
|
|
// 显示
|
|
|
|
|
|
|
|
App.runOnUiThread(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
progressDialog.show(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return progressDialog; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 三按键对话框 |
|
|
|
* 三按键对话框 |
|
|
|
* |
|
|
|
* |
|
|
@ -191,11 +156,11 @@ public class DialogCreator { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void createThreeButtonDialog(Context context, String title, String msg, boolean isCancelable, |
|
|
|
public static void createThreeButtonDialog(Context context, String title, String msg, boolean isCancelable, |
|
|
|
String btnText1, String btnText2, String btnText3, |
|
|
|
String btnText1, String btnText2, String btnText3, |
|
|
|
DialogInterface.OnClickListener neutralListener, |
|
|
|
DialogInterface.OnClickListener neutralListener, |
|
|
|
DialogInterface.OnClickListener negativeListener, |
|
|
|
DialogInterface.OnClickListener negativeListener, |
|
|
|
DialogInterface.OnClickListener positiveListener) { |
|
|
|
DialogInterface.OnClickListener positiveListener) { |
|
|
|
/* final EditText et = new EditText(context);*/ |
|
|
|
/* final EditText et = new EditText(context);*/ |
|
|
|
try { |
|
|
|
try { |
|
|
|
final AlertDialog.Builder dialog = MyAlertDialog.build(context); |
|
|
|
final AlertDialog.Builder dialog = MyAlertDialog.build(context); |
|
|
|
dialog.setTitle(title); |
|
|
|
dialog.setTitle(title); |
|
|
@ -224,37 +189,41 @@ public class DialogCreator { |
|
|
|
dialog.setCancelable(isCancelable); |
|
|
|
dialog.setCancelable(isCancelable); |
|
|
|
|
|
|
|
|
|
|
|
// Diglog的显示
|
|
|
|
// Diglog的显示
|
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void createTipDialog(Context mContext, String message){ |
|
|
|
public static void createTipDialog(Context mContext, String message) { |
|
|
|
DialogCreator.createCommonDialog(mContext, "提示", |
|
|
|
/*DialogCreator.createCommonDialog(mContext, "提示", |
|
|
|
message, true, "知道了", new DialogInterface.OnClickListener() { |
|
|
|
message, true, "知道了", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
dialog.dismiss(); |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
|
|
|
|
BottomDialog.show("提示", message).setCancelButton("知道了"); |
|
|
|
} |
|
|
|
} |
|
|
|
public static void createTipDialog(Context mContext, String title, String message){ |
|
|
|
|
|
|
|
DialogCreator.createCommonDialog(mContext, title, |
|
|
|
public static void createTipDialog(Context mContext, String title, String message) { |
|
|
|
|
|
|
|
/*DialogCreator.createCommonDialog(mContext, title, |
|
|
|
message, true, "知道了", new DialogInterface.OnClickListener() { |
|
|
|
message, true, "知道了", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
dialog.dismiss(); |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
|
|
|
|
BottomDialog.show(title, message).setCancelButton("知道了"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 从assets文件夹之中读取文件并显示提示框 |
|
|
|
* 从assets文件夹之中读取文件并显示提示框 |
|
|
|
|
|
|
|
* |
|
|
|
* @param mContext |
|
|
|
* @param mContext |
|
|
|
* @param title |
|
|
|
* @param title |
|
|
|
* @param assetName 需要后缀名 |
|
|
|
* @param assetName 需要后缀名 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void createAssetTipDialog(Context mContext, String title, String assetName){ |
|
|
|
public static void createAssetTipDialog(Context mContext, String title, String assetName) { |
|
|
|
BufferedReader br = null; |
|
|
|
BufferedReader br = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
br = new BufferedReader(new InputStreamReader(mContext.getAssets().open(assetName))); |
|
|
|
br = new BufferedReader(new InputStreamReader(mContext.getAssets().open(assetName))); |
|
|
@ -280,12 +249,13 @@ public class DialogCreator { |
|
|
|
void onClick(Dialog dialog, View view); |
|
|
|
void onClick(Dialog dialog, View view); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public interface OnSkipChapterListener{ |
|
|
|
public interface OnSkipChapterListener { |
|
|
|
void onClick(TextView chapterTitle, TextView chapterUrl, SeekBar sbReadChapterProgress); |
|
|
|
void onClick(TextView chapterTitle, TextView chapterUrl, SeekBar sbReadChapterProgress); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public interface OnMultiDialogListener{ |
|
|
|
public interface OnMultiDialogListener { |
|
|
|
void onItemClick(DialogInterface dialog,int which,boolean isChecked); |
|
|
|
void onItemClick(DialogInterface dialog, int which, boolean isChecked); |
|
|
|
|
|
|
|
|
|
|
|
void onSelectAll(boolean isSelectAll); |
|
|
|
void onSelectAll(boolean isSelectAll); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|