MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / showDialog

Function showDialog

packages/core/ui/dialogs/index.android.ts:26–71  ·  view source on GitHub ↗
(builder: android.app.AlertDialog.Builder)

Source from the content-addressed store, hash-verified

24}
25
26function showDialog(builder: android.app.AlertDialog.Builder) {
27 const dlg = builder.show();
28
29 const labelColor = getLabelColor();
30 if (labelColor) {
31 const textViewId = dlg.getContext().getResources().getIdentifier('android:id/alertTitle', null, null);
32 if (textViewId) {
33 const tv = <android.widget.TextView>dlg.findViewById(textViewId);
34 if (tv) {
35 tv.setTextColor(labelColor.android);
36 }
37 }
38
39 const messageTextViewId = dlg.getContext().getResources().getIdentifier('android:id/message', null, null);
40 if (messageTextViewId) {
41 const messageTextView = <android.widget.TextView>dlg.findViewById(messageTextViewId);
42 if (messageTextView) {
43 messageTextView.setTextColor(labelColor.android);
44 }
45 }
46 }
47
48 const { color, backgroundColor } = getButtonColors();
49
50 if (color) {
51 const buttons: android.widget.Button[] = [];
52 for (let i = 0; i < 4; i++) {
53 const id = dlg
54 .getContext()
55 .getResources()
56 .getIdentifier('android:id/button' + i, null, null);
57 buttons[i] = <android.widget.Button>dlg.findViewById(id);
58 }
59
60 buttons.forEach((button) => {
61 if (button) {
62 if (color) {
63 button.setTextColor(color.android);
64 }
65 if (backgroundColor) {
66 button.setBackgroundColor(backgroundColor.android);
67 }
68 }
69 });
70 }
71}
72
73function addButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options: ConfirmOptions, callback: Function): void {
74 if (!options) {

Callers 5

alertFunction · 0.85
confirmFunction · 0.85
promptFunction · 0.85
loginFunction · 0.85
actionFunction · 0.85

Calls 4

getLabelColorFunction · 0.90
getButtonColorsFunction · 0.90
getResourcesMethod · 0.80
forEachMethod · 0.80

Tested by

no test coverage detected