package com.example.andy.myapplication;

import android.app.Dialog;
import android.content.Context;
import android.view.Window;


public class singleTonExample {
    private Dialog dialog;
    private static final singleTonExample ourInstance = new singleTonExample();

    public static singleTonExample getInstance() {
        return ourInstance;
    }

    private singleTonExample() {
    }

    public void show(Context context) {
        if (dialog != null && dialog.isShowing()) {
            return;
        }
        dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.layout_progress_dialog);
        dialog.setCancelable(true);
        dialog.show();
    }
    public void dismiss() {
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    }
}
