@@ -13,6 +13,9 @@ function createAlertDialog(options?: dialogs.DialogOptions): android.app.AlertDi
13
13
var alert = new android . app . AlertDialog . Builder ( appmodule . android . foregroundActivity ) ;
14
14
alert . setTitle ( options && types . isString ( options . title ) ? options . title : "" ) ;
15
15
alert . setMessage ( options && types . isString ( options . message ) ? options . message : "" ) ;
16
+ if ( options && options . cancelable === false ) {
17
+ alert . setCancelable ( false ) ;
18
+ }
16
19
return alert ;
17
20
}
18
21
@@ -72,6 +75,11 @@ function addButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options
72
75
}
73
76
} ) ) ;
74
77
}
78
+ alert . setOnDismissListener ( new android . content . DialogInterface . OnDismissListener ( {
79
+ onDismiss : function ( ) {
80
+ callback ( false ) ;
81
+ }
82
+ } ) ) ;
75
83
}
76
84
77
85
export function alert ( arg : any ) : Promise < void > {
@@ -87,6 +95,11 @@ export function alert(arg: any): Promise<void> {
87
95
resolve ( ) ;
88
96
}
89
97
} ) ) ;
98
+ alert . setOnDismissListener ( new android . content . DialogInterface . OnDismissListener ( {
99
+ onDismiss : function ( ) {
100
+ resolve ( ) ;
101
+ }
102
+ } ) ) ;
90
103
91
104
showDialog ( alert ) ;
92
105
@@ -262,6 +275,9 @@ export function action(arg: any): Promise<string> {
262
275
var alert = new android . app . AlertDialog . Builder ( activity ) ;
263
276
var message = options && types . isString ( options . message ) ? options . message : "" ;
264
277
var title = options && types . isString ( options . title ) ? options . title : "" ;
278
+ if ( options && options . cancelable === false ) {
279
+ alert . setCancelable ( false ) ;
280
+ }
265
281
266
282
if ( title ) {
267
283
alert . setTitle ( title ) ;
@@ -289,6 +305,17 @@ export function action(arg: any): Promise<string> {
289
305
}
290
306
} ) ) ;
291
307
}
308
+
309
+ alert . setOnDismissListener ( new android . content . DialogInterface . OnDismissListener ( {
310
+ onDismiss : function ( ) {
311
+ if ( types . isString ( options . cancelButtonText ) ) {
312
+ resolve ( options . cancelButtonText ) ;
313
+ } else {
314
+ resolve ( "" ) ;
315
+ }
316
+ }
317
+ } ) ) ;
318
+
292
319
showDialog ( alert ) ;
293
320
294
321
} catch ( ex ) {
0 commit comments