@@ -58,6 +58,7 @@ public abstract class AbstractDialog implements NotificationContext {
5858 private int buttonPanelLayoutResourceId ;
5959 private DialogViewConfig config ;
6060 private boolean liveValidationDisabled ;
61+ private boolean closeOnPositiveButtonClick ;
6162
6263 // Button callbacks
6364 private boolean suppressNextDismiss ;
@@ -67,19 +68,13 @@ public abstract class AbstractDialog implements NotificationContext {
6768
6869 // Constructor
6970
70- public AbstractDialog (
71- final FragmentActivity activity ,
72- int rootLayoutId ,
73- int contentLayoutResourceId ,
74- int buttonPanelLayoutResourceId ,
75- int headingResourceId ,
76- int subHeadingResourceId ) {
77-
71+ public AbstractDialog (final FragmentActivity activity , int rootLayoutId , int contentLayoutResourceId , int buttonPanelLayoutResourceId , int headingResourceId , int subHeadingResourceId , boolean closeOnPositiveButtonClick ) {
7872 this .builder = new AlertDialog .Builder (activity );
7973 this .activity = activity ;
8074 this .rootLayoutId = rootLayoutId ;
8175 this .contentLayoutResourceId = contentLayoutResourceId ;
8276 this .buttonPanelLayoutResourceId = buttonPanelLayoutResourceId ;
77+ this .closeOnPositiveButtonClick = closeOnPositiveButtonClick ;
8378
8479 Resources resources = activity .getResources ();
8580 String heading = null ;
@@ -99,6 +94,16 @@ public AbstractDialog(
9994 this .config = new DialogViewConfig (heading , subHeading , positiveLabel , negativeLabel , deleteLabel , positiveIcon , negativeIcon );
10095 }
10196
97+ public AbstractDialog (
98+ final FragmentActivity activity ,
99+ int rootLayoutId ,
100+ int contentLayoutResourceId ,
101+ int buttonPanelLayoutResourceId ,
102+ int headingResourceId ,
103+ int subHeadingResourceId ) {
104+ this (activity , rootLayoutId , contentLayoutResourceId , buttonPanelLayoutResourceId , headingResourceId , subHeadingResourceId , true );
105+ }
106+
102107 // Instance methods
103108
104109 private DialogRootLayoutBinding bindRootLayout (final Context context ) {
@@ -225,7 +230,9 @@ protected void onPositiveClick() {
225230 positiveCallback .call ();
226231 }
227232
228- dismiss ();
233+ if (closeOnPositiveButtonClick ) {
234+ dismiss ();
235+ }
229236 }
230237
231238 private void onNegativeClick () {
0 commit comments