d
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.fenghoo.seven.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.fenghoo.seven.R;
|
||||
|
||||
/**
|
||||
* on: 2018/11/2
|
||||
* <p>
|
||||
* 描述:加载中禁止用户手机关闭的对话框
|
||||
*/
|
||||
|
||||
public class LoadingDialogy extends Dialog {
|
||||
|
||||
|
||||
private Context context;
|
||||
private static LoadingDialogy dialog;
|
||||
private ProgressBar ivProgress;
|
||||
private String showContent;
|
||||
|
||||
|
||||
public LoadingDialogy(Context context , String showContent) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
this.showContent = showContent;
|
||||
}
|
||||
|
||||
public LoadingDialogy(Context context, int themeResId, String showContent) {
|
||||
super(context, themeResId);
|
||||
this.context = context;
|
||||
this.showContent = showContent;
|
||||
|
||||
|
||||
}
|
||||
//显示dialog的方法
|
||||
public static LoadingDialogy showDialog(Context context , String content){
|
||||
dialog = new LoadingDialogy(context, R.style.loadingDialog ,content);//dialog样式
|
||||
dialog.setContentView(R.layout.dialog_loading);//dialog布局文件
|
||||
dialog.setCanceledOnTouchOutside(false);//点击外部不允许关闭dialog
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if(hasFocus && dialog != null){
|
||||
ivProgress = (ProgressBar) dialog.findViewById(R.id.ivProgress);
|
||||
TextView textView = (TextView) dialog.findViewById(R.id.tv_content);
|
||||
textView.setText(showContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user