From 24ebcc56a9349c700feb74eb5d7ae407713b6e76 Mon Sep 17 00:00:00 2001 From: Maya Zhecheva Date: Mon, 22 Aug 2016 10:45:58 +0300 Subject: [PATCH 1/3] Foregrond of buttons inside dialogs are not updated on creating a css style targetting both Button and Page Button --- .../ui/dialogs/dialogs.android.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tns-core-modules/ui/dialogs/dialogs.android.ts b/tns-core-modules/ui/dialogs/dialogs.android.ts index 1d0a77805..ad095885a 100644 --- a/tns-core-modules/ui/dialogs/dialogs.android.ts +++ b/tns-core-modules/ui/dialogs/dialogs.android.ts @@ -39,6 +39,20 @@ function showDialog(builder: android.app.AlertDialog.Builder) { } } } + + var backgroundColor = dialogsCommon.getButtonColor(); + if (backgroundColor) { + let buttons : android.widget.Button[] = []; + for (var i = 0; i < 3; i++) { + var id = dlg.getContext().getResources().getIdentifier("android:id/button" + i, null, null); + buttons[i] = dlg.findViewById(id); + } + buttons.forEach(button => { + if (button) { + button.setTextColor(backgroundColor.android); + } + }); + } } function addButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options: dialogs.ConfirmOptions, @@ -75,7 +89,7 @@ function addButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options })); } alert.setOnDismissListener(new android.content.DialogInterface.OnDismissListener({ - onDismiss: function() { + onDismiss: function () { callback(false); } })); @@ -95,7 +109,7 @@ export function alert(arg: any): Promise { } })); alert.setOnDismissListener(new android.content.DialogInterface.OnDismissListener({ - onDismiss: function() { + onDismiss: function () { resolve(); } })); @@ -306,7 +320,7 @@ export function action(arg: any): Promise { } alert.setOnDismissListener(new android.content.DialogInterface.OnDismissListener({ - onDismiss: function() { + onDismiss: function () { if (types.isString(options.cancelButtonText)) { resolve(options.cancelButtonText); } else { From e487928ab807199b89172675f3871188604d0a28 Mon Sep 17 00:00:00 2001 From: Maya Zhecheva Date: Mon, 22 Aug 2016 15:20:36 +0300 Subject: [PATCH 2/3] Updated improper field name --- tns-core-modules/ui/dialogs/dialogs.android.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tns-core-modules/ui/dialogs/dialogs.android.ts b/tns-core-modules/ui/dialogs/dialogs.android.ts index ad095885a..4d5b33353 100644 --- a/tns-core-modules/ui/dialogs/dialogs.android.ts +++ b/tns-core-modules/ui/dialogs/dialogs.android.ts @@ -40,8 +40,8 @@ function showDialog(builder: android.app.AlertDialog.Builder) { } } - var backgroundColor = dialogsCommon.getButtonColor(); - if (backgroundColor) { + var buttonColor = dialogsCommon.getButtonColor(); + if (buttonColor) { let buttons : android.widget.Button[] = []; for (var i = 0; i < 3; i++) { var id = dlg.getContext().getResources().getIdentifier("android:id/button" + i, null, null); @@ -49,7 +49,7 @@ function showDialog(builder: android.app.AlertDialog.Builder) { } buttons.forEach(button => { if (button) { - button.setTextColor(backgroundColor.android); + button.setTextColor(buttonColor.android); } }); } From bc1d379c05eac46118edffbc0483269592a2f2ee Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Mon, 29 Aug 2016 11:56:38 +0300 Subject: [PATCH 3/3] Use let instead of var --- tns-core-modules/ui/dialogs/dialogs.android.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tns-core-modules/ui/dialogs/dialogs.android.ts b/tns-core-modules/ui/dialogs/dialogs.android.ts index 4d5b33353..83edc40be 100644 --- a/tns-core-modules/ui/dialogs/dialogs.android.ts +++ b/tns-core-modules/ui/dialogs/dialogs.android.ts @@ -40,11 +40,11 @@ function showDialog(builder: android.app.AlertDialog.Builder) { } } - var buttonColor = dialogsCommon.getButtonColor(); + let buttonColor = dialogsCommon.getButtonColor(); if (buttonColor) { let buttons : android.widget.Button[] = []; - for (var i = 0; i < 3; i++) { - var id = dlg.getContext().getResources().getIdentifier("android:id/button" + i, null, null); + for (let i = 0; i < 3; i++) { + let id = dlg.getContext().getResources().getIdentifier("android:id/button" + i, null, null); buttons[i] = dlg.findViewById(id); } buttons.forEach(button => {