@@ -3,7 +3,23 @@ import { getSystemCssClasses, MODAL_ROOT_VIEW_CSS_CLASS } from '@nativescript/co
3
3
import { fromObject } from '@nativescript/core/data/observable' ;
4
4
import { createViewFromEntry } from '@nativescript/core/ui/builder' ;
5
5
import { View } from '@nativescript/core/ui/core/view' ;
6
- import { ActionOptions , ALERT , CANCEL , capitalizationType , CONFIRM , ConfirmOptions , DialogOptions , getButtonColors , getLabelColor , inputType , LOGIN , LoginResult , OK , PROMPT , PromptResult } from '@nativescript/core/ui/dialogs' ;
6
+ import {
7
+ ActionOptions ,
8
+ ALERT ,
9
+ CANCEL ,
10
+ capitalizationType ,
11
+ CONFIRM ,
12
+ ConfirmOptions ,
13
+ DialogOptions ,
14
+ getButtonColors ,
15
+ getLabelColor ,
16
+ inputType ,
17
+ LOGIN ,
18
+ LoginResult ,
19
+ OK ,
20
+ PROMPT ,
21
+ PromptResult
22
+ } from '@nativescript/core/ui/dialogs' ;
7
23
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout' ;
8
24
import { ad } from '@nativescript/core/utils/utils' ;
9
25
import { TextField } from 'nativescript-material-textfield' ;
@@ -48,7 +64,6 @@ function createAlertDialog(options?: DialogOptions & MDCAlertControlerOptions):
48
64
moduleName : options . view as string
49
65
} ) ;
50
66
51
-
52
67
view . cssClasses . add ( MODAL_ROOT_VIEW_CSS_CLASS ) ;
53
68
const modalRootViewCssClasses = getSystemCssClasses ( ) ;
54
69
modalRootViewCssClasses . forEach ( c => view . cssClasses . add ( c ) ) ;
@@ -80,35 +95,58 @@ function showDialog(builder: androidx.appcompat.app.AlertDialog.Builder, options
80
95
} ;
81
96
view . bindingContext = fromObject ( context ) ;
82
97
}
83
-
84
- const labelColor = getLabelColor ( ) ;
85
- if ( labelColor ) {
98
+ if ( options . titleColor ) {
86
99
const textViewId = dlg
87
100
. getContext ( )
88
101
. getResources ( )
89
102
. getIdentifier ( 'android:id/alertTitle' , null , null ) ;
90
103
if ( textViewId ) {
91
104
const tv = < android . widget . TextView > dlg . findViewById ( textViewId ) ;
92
105
if ( tv ) {
93
- tv . setTextColor ( labelColor . android ) ;
106
+ tv . setTextColor ( options . titleColor . android ) ;
94
107
}
95
108
}
96
-
97
- const messageTextViewId = dlg
98
- . getContext ( )
99
- . getResources ( )
100
- . getIdentifier ( 'android:id/message' , null , null ) ;
101
- if ( messageTextViewId ) {
102
- const messageTextView = < android . widget . TextView > dlg . findViewById ( messageTextViewId ) ;
103
- if ( messageTextView ) {
104
- messageTextView . setTextColor ( labelColor . android ) ;
109
+ if ( options . messageColor ) {
110
+ const messageTextViewId = dlg
111
+ . getContext ( )
112
+ . getResources ( )
113
+ . getIdentifier ( 'android:id/message' , null , null ) ;
114
+ if ( messageTextViewId ) {
115
+ const messageTextView = < android . widget . TextView > dlg . findViewById ( messageTextViewId ) ;
116
+ if ( messageTextView ) {
117
+ messageTextView . setTextColor ( options . messageColor . android ) ;
118
+ }
105
119
}
106
120
}
107
121
}
108
-
109
- let { color, backgroundColor } = getButtonColors ( ) ;
110
-
111
- if ( color ) {
122
+ // const labelColor = getLabelColor();
123
+ // if (labelColor) {
124
+ // const textViewId = dlg
125
+ // .getContext()
126
+ // .getResources()
127
+ // .getIdentifier('android:id/alertTitle', null, null);
128
+ // if (textViewId) {
129
+ // const tv = <android.widget.TextView>dlg.findViewById(textViewId);
130
+ // if (tv) {
131
+ // tv.setTextColor(labelColor.android);
132
+ // }
133
+ // }
134
+
135
+ // const messageTextViewId = dlg
136
+ // .getContext()
137
+ // .getResources()
138
+ // .getIdentifier('android:id/message', null, null);
139
+ // if (messageTextViewId) {
140
+ // const messageTextView = <android.widget.TextView>dlg.findViewById(messageTextViewId);
141
+ // if (messageTextView) {
142
+ // messageTextView.setTextColor(labelColor.android);
143
+ // }
144
+ // }
145
+ // }
146
+
147
+ // let { color, backgroundColor } = getButtonColors();
148
+
149
+ if ( options . buttonInkColor || options . buttonTitleColor ) {
112
150
let buttons : android . widget . Button [ ] = [ ] ;
113
151
for ( let i = 0 ; i < 3 ; i ++ ) {
114
152
let id = dlg
@@ -120,12 +158,7 @@ function showDialog(builder: androidx.appcompat.app.AlertDialog.Builder, options
120
158
121
159
buttons . forEach ( button => {
122
160
if ( button ) {
123
- if ( color ) {
124
- button . setTextColor ( color . android ) ;
125
- }
126
- if ( backgroundColor ) {
127
- button . setBackgroundColor ( backgroundColor . android ) ;
128
- }
161
+ button . setTextColor ( ( options . buttonInkColor || options . buttonTitleColor ) . android ) ;
129
162
}
130
163
} ) ;
131
164
}
0 commit comments