对话框优化

pull/5/head
fengyuecanzhu 4 years ago
parent 5b11f21f85
commit 36c30626a9
  1. 32
      .idea/assetWizardSettings.xml
  2. 4
      .idea/compiler.xml
  3. 68
      app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java
  4. 15
      app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java
  5. 6
      app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic___" />
<entry key="sourceFile" value="F:\SVG图标\上传.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" /> <bytecodeTargetLevel target="1.8">
<module name="FYReader.DialogXIOSStyle" target="1.8" />
</bytecodeTargetLevel>
</component> </component>
</project> </project>

@ -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;
@ -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;
}
/** /**
* 三按键对话框 * 三按键对话框
* *
@ -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);
} }
} }

@ -17,6 +17,9 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputLayout; 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.R;
import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.application.App;
@ -215,10 +218,18 @@ public class MyAlertDialog {
showTipDialogWithLink(context,"提示", msgId); showTipDialogWithLink(context,"提示", msgId);
} }
public static void showTipDialogWithLink(Context context, String title, int 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.setText(msgId);
view.setMovementMethod(LinkMovementMethod.getInstance()); 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<BottomDialog>(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 { public interface OnVerify {

@ -123,9 +123,9 @@ public class AdUtils {
public static void initAd() { public static void initAd() {
if (!hasInitAd) { if (!hasInitAd) {
hasInitAd = true; hasInitAd = true;
DdSdkHelper.init("1234", "216", "51716a16fbdf50905704b6575b1b3b60", DdSdkHelper.init("", "", "",
"142364", "35ce0efe5f3cc960b116db227498e238", "", "",
"8167", "85bd159309c3da1b", "", "",
App.getApplication(), App.isDebug()); App.getApplication(), App.isDebug());
} }
} }

Loading…
Cancel
Save