1+ import * as pages from "tns-core-modules/ui/page" ;
2+ import { EventData } from "tns-core-modules/data/observable" ;
3+ import * as button from "tns-core-modules/ui/button" ;
4+
5+ import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout" ;
6+
7+ let testIndex = 0 ;
8+ const tests = [
9+ { name : "black-blue only" , backgroundImage : "linear-gradient(to bottom, black, blue)" } ,
10+ { name : "to bottom green-blue" , backgroundImage : "linear-gradient(to bottom, green, blue)" } ,
11+ { name : "to left yellow-blue" , backgroundImage : "linear-gradient(to left, yellow, green)" } ,
12+ { name : "to right yellow-blue" , backgroundImage : "linear-gradient(to right, yellow, green)" } ,
13+ { name : "-45deg green-blue" , backgroundImage : "linear-gradient(-45deg, green, blue)" } ,
14+ { name : "45deg green-blue" , backgroundImage : "linear-gradient(45deg, green, blue)" } ,
15+
16+ { name : "black-blue-pink only" , backgroundImage : "linear-gradient(to bottom, black, blue, pink)" } ,
17+ { name : "to bottom green-blue-pink" , backgroundImage : "linear-gradient(to bottom, green, blue, pink)" } ,
18+ { name : "to left yellow-blue-pink" , backgroundImage : "linear-gradient(to left, yellow, green, pink)" } ,
19+ { name : "to right yellow-blue-pink" , backgroundImage : "linear-gradient(to right, yellow, green, pink)" } ,
20+ { name : "-45deg green-blue-pink" , backgroundImage : "linear-gradient(-45deg, green, blue, pink)" } ,
21+ { name : "45deg green-blue-pink" , backgroundImage : "linear-gradient(45deg, green, blue, pink)" } ,
22+ ]
23+
24+ export function onLoaded ( args ) {
25+ applyNextStyle ( args ) ;
26+ }
27+
28+ export function onButtonTap ( args ) {
29+ applyNextStyle ( args ) ;
30+ }
31+
32+ function applyNextStyle ( args ) {
33+ let page = < pages . Page > args . object . page ;
34+ let btn = < button . Button > args . object ;
35+ let gridElement = < GridLayout > page . getViewById ( "Container" ) ;
36+
37+ btn . text = tests [ testIndex ] . name ;
38+ gridElement . backgroundImage = tests [ testIndex ] . backgroundImage ;
39+
40+ testIndex = testIndex < tests . length - 1 ? ++ testIndex : 0 ;
41+ }
0 commit comments