@@ -2,12 +2,12 @@ import { Observable } from "tns-core-modules/data/observable";
22import { Button } from "tns-core-modules/ui/button" ;
33import { Color } from "tns-core-modules/color" ;
44import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout" ;
5- import * as dialogs from "tns-core-modules/ui/dialogs" ;
5+ import { alert } from "tns-core-modules/ui/dialogs" ;
66import * as frame from "tns-core-modules/ui/frame" ;
77import * as platform from "tns-core-modules/platform" ;
88
99export class TestPageMainViewModel extends Observable {
10- private _colors = [ "#ff0000" , "# 0000cc", "#33cc33" , "#33cc33 " ] ;
10+ private _colors = [ "#0000cc" , "#33cc33" , "#0000cc " ] ;
1111
1212 public static APP_NAME : string = "ui-tests-app" ;
1313 public basePath : string = "" ;
@@ -24,19 +24,18 @@ export class TestPageMainViewModel extends Observable {
2424
2525 protected selectExample ( selectedExample : any ) {
2626 console . log ( " EXAMPLE: " + selectedExample ) ;
27-
2827 if ( this . examples . has ( selectedExample ) ) {
2928 this . navigateToExample ( this . examples . get ( selectedExample ) ) ;
30- } else {
31- dialogs . alert ( "Cannot find example: " + selectedExample ) ;
29+ } else if ( selectedExample . indexOf ( "/" ) > 0 ) {
30+ this . navigateToExample ( selectedExample ) ;
3231 }
3332 }
3433
3534 protected navigateToExample ( exampleFullPath : string ) {
3635 try {
3736 frame . topmost ( ) . navigate ( TestPageMainViewModel . APP_NAME + "/" + exampleFullPath ) ;
3837 } catch ( error ) {
39- dialogs . alert ( "Cannot find example: " + exampleFullPath ) ;
38+ alert ( "Cannot find example: " + exampleFullPath ) ;
4039
4140 }
4241 }
@@ -55,17 +54,19 @@ export class TestPageMainViewModel extends Observable {
5554
5655 this . examples . forEach ( ( element , key ) => {
5756 var btn = new Button ( ) ;
58-
5957 if ( platform . isAndroid ) {
6058 btn . style . height = 25 ;
6159 btn . style . fontSize = 10 ;
62- btn . style . margin = "0" ;
63- btn . style . padding = "0" ;
60+ btn . style . padding = 0 ;
6461 } else {
65- btn . style . padding = "5" ;
62+ btn . style . padding = 5 ;
6663 }
64+ btn . style . marginRight = 5 ;
65+ btn . style . marginBottom = 5 ;
6766
68- btn . style . color = new Color ( this . _colors [ count ++ % 3 ] ) ;
67+ btn . style . color = new Color ( "white" ) ;
68+ btn . style . backgroundColor = new Color ( this . _colors [ count ++ % 3 ] ) ;
69+ btn . style . borderRadius = 5 ;
6970 btn . on ( Button . tapEvent , function ( eventData ) {
7071 let text = btn . text ;
7172 this . loadExample ( text ) ;
@@ -100,4 +101,4 @@ export class TestPageMainViewModel extends Observable {
100101 this . examples . clear ( ) ;
101102 this . examples = sortedExamples ;
102103 }
103- }
104+ }
0 commit comments