javiersantos / MaterialStyledDialogs

A library that shows a beautiful and customizable Material-based dialog with header. API 14+ required.
Apache License 2.0
1.17k stars 155 forks source link

How to dismiss automatic ? #71

Open lucazin opened 6 years ago

lucazin commented 6 years ago

i want to simulate a loading with this dialog.. i call a function inside pre execute asynctask and in post execute the same dialog dismiss .. how can i do that ?

im trying but no sucess.. someone can help me ?

public class Helper_Functions_Dialogs { public static WeakReference ProgressDialogGeral;

//region Loading
public static void LoadingScreen(boolean show, String Titulo,String Mensagem, Activity activity) {

    if(ProgressDialogGeral == null)
        ProgressDialogGeral  = new WeakReference<MaterialStyledDialog>(new 
        MaterialStyledDialog.Builder(activity).build());

    if(show)
    {
           ProgressDialogGeral.get().getBuilder()
                   .setHeaderDrawable(R.drawable.header_dialog)
                   .setTitle(Titulo)
                   .setCancelable(false)
                   .withDialogAnimation(true)
                   .setPositiveText("Load...")
                   .setDescription(Mensagem);

        ProgressDialogGeral.get().show();
    }
    else
    {
        ProgressDialogGeral.get().dismiss();
        ProgressDialogGeral = null;
    }
}

}

The dialog not dismissing