package com.celerysoft.dialogdemo;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.celerysoft.materialdesigndialog.MaterialDesignDialog;

public class DemoActivity extends Activity {
    private MaterialDesignDialog mDialog;
    private Context mContext;

    private Button mBtnInit;
    private Button mBtnShow;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_demo);

        mContext = this;

        defineView();
        defineListener();
    }

    private void defineView() {
        mBtnInit = (Button) findViewById(R.id.demo_btn_init);
        mBtnShow = (Button) findViewById(R.id.demo_btn_show);
    }

    private void defineListener() {
        mBtnInit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String message = "This app determines your phone's location and shares" +
                        " it with Google in order to serve personalized alerts to you." +
                        " This allows for a better overall app experience.";
                mDialog = new MaterialDesignDialog(mContext);
                mDialog.setTitle("Permissions")
                        .setMessage(message)
                        .setNegativeButton("DECLINE", null)
                        .setPositiveButton("ACCEPT", null);
            }
        });
        mBtnShow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mDialog != null) {
                    mDialog.show();
                }
            }
        });
    }
}

@@ -171,16 +171,45 @@
 .Button;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -1490,70 +1490,911 @@
 %22, n
-ull)%0A                        .setPositiveButton(%22ACCEPT%22, null
+ew View.OnClickListener() %7B%0A                            @Override%0A                            public void onClick(View v) %7B%0A                                mDialog.dismiss();%0A                                Toast.makeText(mContext, %22click DECLINE%22, Toast.LENGTH_SHORT).show();%0A                            %7D%0A                        %7D)%0A                        .setPositiveButton(%22ACCEPT%22, new View.OnClickListener() %7B%0A                            @Override%0A                            public void onClick(View v) %7B%0A                                mDialog.dismiss();%0A                                Toast.makeText(mContext, %22show dialog%22, Toast.LENGTH_SHORT).show();%0A                                Toast.makeText(mContext, %22click ACCEPT%22, Toast.LENGTH_SHORT).show();%0A                            %7D%0A                        %7D);%0A                Toast.makeText(mContext, %22init dialog%22, Toast.LENGTH_SHORT).show(
 );%0A 
@@ -2614,32 +2614,32 @@
 mDialog.show();%0A
-
                 
@@ -2632,32 +2632,116 @@
               %7D%0A
+                Toast.makeText(mContext, %22show dialog%22, Toast.LENGTH_SHORT).show();%0A
             %7D%0A  

update demo