diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml new file mode 100644 index 0000000..e75312f --- /dev/null +++ b/.idea/assetWizardSettings.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130..731bba8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,8 @@ - + + + \ No newline at end of file diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java index 3eb605c..2a3c977 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java @@ -10,6 +10,9 @@ import android.widget.TextView; import androidx.appcompat.app.AlertDialog; +import com.kongzue.dialogx.dialogs.BottomDialog; +import com.kongzue.dialogx.dialogs.MessageDialog; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -33,7 +36,7 @@ public class DialogCreator { * @return */ 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); // normalDialog.setIcon(R.drawable.icon_dialog); @@ -51,9 +54,7 @@ public class DialogCreator { e.printStackTrace(); } }); - 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 */ public static void createThreeButtonDialog(Context context, String title, String msg, boolean isCancelable, - String btnText1, String btnText2, String btnText3, - DialogInterface.OnClickListener neutralListener, - DialogInterface.OnClickListener negativeListener, - DialogInterface.OnClickListener positiveListener) { - /* final EditText et = new EditText(context);*/ + String btnText1, String btnText2, String btnText3, + DialogInterface.OnClickListener neutralListener, + DialogInterface.OnClickListener negativeListener, + DialogInterface.OnClickListener positiveListener) { + /* final EditText et = new EditText(context);*/ try { final AlertDialog.Builder dialog = MyAlertDialog.build(context); dialog.setTitle(title); @@ -224,37 +189,41 @@ public class DialogCreator { dialog.setCancelable(isCancelable); // Diglog的显示 - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } - public static void createTipDialog(Context mContext, String message){ - DialogCreator.createCommonDialog(mContext, "提示", + public static void createTipDialog(Context mContext, String message) { + /*DialogCreator.createCommonDialog(mContext, "提示", message, true, "知道了", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { 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() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } - }); + });*/ + BottomDialog.show(title, message).setCancelButton("知道了"); } /** * 从assets文件夹之中读取文件并显示提示框 + * * @param mContext * @param title * @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; try { br = new BufferedReader(new InputStreamReader(mContext.getAssets().open(assetName))); @@ -280,12 +249,13 @@ public class DialogCreator { void onClick(Dialog dialog, View view); } - public interface OnSkipChapterListener{ + public interface OnSkipChapterListener { void onClick(TextView chapterTitle, TextView chapterUrl, SeekBar sbReadChapterProgress); } - public interface OnMultiDialogListener{ - void onItemClick(DialogInterface dialog,int which,boolean isChecked); + public interface OnMultiDialogListener { + void onItemClick(DialogInterface dialog, int which, boolean isChecked); + void onSelectAll(boolean isSelectAll); } } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java index 5060ea6..83d7f65 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java @@ -17,6 +17,9 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.textfield.TextInputLayout; +import com.kongzue.dialogx.dialogs.BottomDialog; +import com.kongzue.dialogx.dialogs.CustomDialog; +import com.kongzue.dialogx.interfaces.OnBindView; import xyz.fycz.myreader.R; import xyz.fycz.myreader.application.App; @@ -215,10 +218,18 @@ public class MyAlertDialog { showTipDialogWithLink(context,"提示", msgId); } public static void showTipDialogWithLink(Context context, String title, int msgId){ - TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.dialog_textview, null); + /*TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.dialog_textview, null); view.setText(msgId); view.setMovementMethod(LinkMovementMethod.getInstance()); - build(context).setTitle(title).setView(view).setPositiveButton("知道了", null).show(); + build(context).setTitle(title).setView(view).setPositiveButton("知道了", null).show();*/ + BottomDialog.show(title, new OnBindView(R.layout.dialog_textview){ + @Override + public void onBind(BottomDialog dialog, View v) { + TextView view = (TextView) v; + view.setText(msgId); + view.setMovementMethod(LinkMovementMethod.getInstance()); + } + }).setCancelButton("知道了"); } public interface OnVerify { diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java index 456713e..427b4f8 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java @@ -123,9 +123,9 @@ public class AdUtils { public static void initAd() { if (!hasInitAd) { hasInitAd = true; - DdSdkHelper.init("1234", "216", "51716a16fbdf50905704b6575b1b3b60", - "142364", "35ce0efe5f3cc960b116db227498e238", - "8167", "85bd159309c3da1b", + DdSdkHelper.init("", "", "", + "", "", + "", "", App.getApplication(), App.isDebug()); } }