lewisjdeane / L-Dialogs

A small library replicating the new dialogs in android L.
567 stars 100 forks source link

Click events #6

Closed ghost closed 10 years ago

ghost commented 10 years ago

I'm new to this so how exactly to handle click events for CustomDialogs. I have 3 dialogs and if I implement CustomDialog.ClickListener and then onConfirmClick() & onCancelClick(), all confirm and cancel buttons from all dialogs use the same method & functionality..

ghost commented 10 years ago

Nevermind, I found a workaround. onConfirmClick() && onCancelClick() before doing stuff, check if the dialog isn't null and it's visible. Do this for all dialogs and it will work perfectly.


public void onConfirmClick(){
        if(customDialog !=null && customDialog.isShowing()){
                 //Do stuff...
        }
}
lewisjdeane commented 10 years ago

Just use the built in method .setClickListener(new CustomDialog.ClickListener(){....}); as mentioned in the read me.