Skip to content

Commit

Permalink
对话框增加一个不显示的控制方法
Browse files Browse the repository at this point in the history
  • Loading branch information
XinYiWorld committed Jul 18, 2017
1 parent 451b619 commit 0f68eba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,36 @@ public class DialogMaster implements ProgressView {
private Context mContext;
private MaterialDialogFactory materialDialogFactory;
private String customProgressMsg; //定制进度提示信息,不同场景要求可能不一样。

private static boolean temporaryDisableDialog; //某些情景下,不需要显示对话框。
public DialogMaster(Context mContext) {
this.mContext = mContext;
materialDialogFactory = MaterialDialogFactory.getInstance(mContext);
customProgressMsg = ResourceUtil.getString(mContext, R.string.loading);
temporaryDisableDialog = false;
}

public static void temporaryDisableDialog(){
temporaryDisableDialog = true;
}

@Override
public void onShowProgressDialog() {
materialDialogFactory.createMsgProgressMaterialDialog(customProgressMsg);
if(!temporaryDisableDialog){
materialDialogFactory.createMsgProgressMaterialDialog(customProgressMsg);
}
}

@Override
public void onHideProgressDialog() {
temporaryDisableDialog = false;
materialDialogFactory.hideProgressMaterialDialog();
}

@Override
public void onShowMessageDiaolg(@NonNull String msg) {
materialDialogFactory.createMsgProgressMaterialDialog(msg);
if(!temporaryDisableDialog) {
materialDialogFactory.createMsgProgressMaterialDialog(msg);
}
}

@Override
Expand All @@ -52,6 +62,7 @@ public void customProgressMsg(String msg) {
@Override
public void reset() {
customProgressMsg = ResourceUtil.getString(R.string.loading);
temporaryDisableDialog = false;
}

}

0 comments on commit 0f68eba

Please sign in to comment.