@@ -17,6 +17,7 @@ import {
17
17
fromObject ,
18
18
inputType
19
19
} from '@nativescript/core' ;
20
+ import { ad } from '@nativescript/core/utils' ;
20
21
import { LoginOptions , MDCAlertControlerOptions , PromptOptions } from './dialogs' ;
21
22
import { isDialogOptions } from './dialogs-common' ;
22
23
@@ -62,8 +63,8 @@ function createAlertDialogBuilder(options?: DialogOptions & MDCAlertControlerOpt
62
63
options . view instanceof View
63
64
? options . view
64
65
: Builder . createViewFromEntry ( {
65
- moduleName : options . view as string
66
- } ) ;
66
+ moduleName : options . view as string
67
+ } ) ;
67
68
68
69
view . cssClasses . add ( CSSUtils . MODAL_ROOT_VIEW_CSS_CLASS ) ;
69
70
const modalRootViewCssClasses = CSSUtils . getSystemCssClasses ( ) ;
@@ -128,17 +129,15 @@ function showDialog(dlg: androidx.appcompat.app.AlertDialog, options: DialogOpti
128
129
129
130
// let { color, backgroundColor } = getButtonColors();
130
131
131
-
132
-
133
132
if ( options . buttonInkColor || options . buttonTitleColor ) {
134
133
dlg . create ( ) ;
135
134
const buttons : com . google . android . material . button . MaterialButton [ ] = [ ] ;
136
135
for ( let i = - 1 ; i > - 4 ; i -- ) {
137
136
buttons . push ( dlg . getButton ( i ) as com . google . android . material . button . MaterialButton ) ;
138
137
}
139
138
140
- const nInkColor = options . buttonInkColor && getColorStateList ( options . buttonInkColor . android ) ;
141
- const nTitleColor = options . buttonTitleColor && getColorStateList ( options . buttonTitleColor . android ) ;
139
+ const nInkColor = options . buttonInkColor && getColorStateList ( options . buttonInkColor . android ) ;
140
+ const nTitleColor = options . buttonTitleColor && getColorStateList ( options . buttonTitleColor . android ) ;
142
141
143
142
buttons . forEach ( ( button ) => {
144
143
if ( button ) {
@@ -171,6 +170,9 @@ function prepareAndCreateAlertDialog(
171
170
if ( onDoneCalled ) {
172
171
return ;
173
172
}
173
+ //ensure we hide any keyboard
174
+ const imm = ad . getApplicationContext ( ) . getSystemService ( android . content . Context . INPUT_METHOD_SERVICE ) ;
175
+ imm . toggleSoftInput ( android . view . inputmethod . InputMethodManager . HIDE_IMPLICIT_ONLY , 0 ) ;
174
176
onDoneCalled = true ;
175
177
if ( options . view instanceof View ) {
176
178
Utils . android . dismissSoftInput ( options . view . nativeView ) ;
@@ -343,8 +345,8 @@ export function confirm(arg: any): Promise<boolean> {
343
345
defaultOptions ,
344
346
! isDialogOptions ( arg )
345
347
? {
346
- message : arg + ''
347
- }
348
+ message : arg + ''
349
+ }
348
350
: arg
349
351
) ;
350
352
const alert = createAlertDialogBuilder ( options ) ;
0 commit comments