MDialogStyle
【地址:https://gitee.com/wasdzy/MDialogStyle】欢迎采坑!
预览
使用
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.gitee.wasdzy:MDialogStyle:1.0.6'
}
使用方式
case R.id.btn_date_time:
//显示日期时间
new AlertDateATimeDialog(this,true,false).builder()
.setPostClickListener(new AlertDateATimeDialog.PostClickListener() {
@Override
public void onClick(String dateAndTime,String string) {
showMsg(string);
}
})
.setMaxDate(System.currentTimeMillis()-1000L)
.setDelimiter("/")
//.setTitle("这里是标题")
.show();
break;
case R.id.btn_input:
//显示带输入框的Dialog
new AlertInputTextDialog(this).builder()
.setTitle("请输入用户名")
.setCancelBtn("取消", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
})
.setPostBtn("确定", new AlertInputTextDialog.PostClickListener() {
@Override
public void onClick(String content) {
showMsg(content);
}
})
.show();
break;
case R.id.btn_sheet:
//选择相机、相册的Dialog
List<String> data = new ArrayList<>();
data.add("相机");
data.add("相册");
new AlertSheetDialog(this)
.builder()
//.setTitle("sheet")
.setItemClickListener(new AlertSheetDialog.OnSheetItemClickListener() {
@Override
public void onClick(int which) {
showMsg(which + "");
}
})
.setItemTextColor(Color.WHITE)
.addItem(data)
.show();
break;
case R.id.btn_loading:
//显示加载进度的Dialog
CircularProgressDialog circularProgressDialog = new CircularProgressDialog(this);
circularProgressDialog.show();
//circularProgressDialog.setHintText("加载中...");
break;
case R.id.btn_loading_cancel:
//显示加载进度的Dialog,可以通过按钮取消
CircularProgressDialog circularProgressDialog2 = new CircularProgressDialog(this, new CircularProgressDialog.CancelOnClickListener() {
@Override
public void cancel() {
Toast.makeText(MainActivity.this,"取消啦",Toast.LENGTH_SHORT).show();
}
});
circularProgressDialog2.show();
//circularProgressDialog.setHintText("加载中...");
break;
case R.id.btn_sure:
//提示类容
new AlertDialog(this)
.builder()
.setMsg("提示内容")
.setPostBtn("确定", new View.OnClickListener() {
@Override
public void onClick(View view) {
showMsg("点击");
}
}).show();
break;
case R.id.btn_cancel:
//提示内容 带取消按钮的
new AlertDialog(this)
.builder()
.setMsg("提示内容")
.setTitle("")
.setCancelBtn("取消", new View.OnClickListener() {
@Override
public void onClick(View view) {
showMsg("取消");
}
})
.setPostBtn("确定", new View.OnClickListener() {
@Override
public void onClick(View view) {
showMsg("点击");
}
}).show();
break;