Skip to content

Commit 7780cad

Browse files
committed
more cleanup
1 parent 68a9c02 commit 7780cad

14 files changed

+423
-365
lines changed

.travis.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ branches:
33
- master
44
matrix:
55
include:
6-
- stage: Lint
6+
- stage: 'Lint'
77
language: node_js
88
os: linux
9-
node_js: "8"
9+
node_js: '8'
1010
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint
11-
- stage: Build and Test
11+
- stage: 'Build and Test'
1212
env:
1313
- BuildAndroid="26"
1414
language: android
@@ -24,7 +24,7 @@ matrix:
2424
- Xcode="9.2"
2525
osx_image: xcode9.2
2626
language: node_js
27-
node_js: "8"
27+
node_js: '8'
2828
jdk: oraclejdk8
2929
script:
3030
- cd src && npm i && npm run tsc && cd ../demo
@@ -37,9 +37,7 @@ matrix:
3737
before_install:
3838
- nvm install 8
3939
before_script:
40-
- >-
41-
echo no | android create avd --force -n test -t android-21 -b
42-
armeabi-v7a
40+
- echo no | android create avd --force -n test -t android-21 -b armeabi-v7a
4341
- emulator -avd test -no-audio -no-window &
4442
- android-wait-for-emulator
4543
script: travis_wait travis_retry npm run test.android
@@ -48,10 +46,12 @@ matrix:
4846
env:
4947
- TestVersion="latest"
5048
language: node_js
51-
node_js: "8"
49+
node_js: '8'
5250
jdk: oraclejdk8
5351
osx_image: xcode9.2
52+
? before_script
5453
script: travis_wait travis_retry npm run test.ios
54+
5555
android:
5656
components:
5757
- tools
@@ -61,6 +61,7 @@ android:
6161
- android-26
6262
- extra-android-m2repository
6363
- sys-img-armeabi-v7a-android-21
64+
6465
install:
6566
- echo no | npm install -g nativescript
6667
- tns usage-reporting disable

demo/app/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import * as app from "tns-core-modules/application";
2-
import "./bundle-config";
3-
app.start({ moduleName: "main-page" });
1+
import * as app from 'tns-core-modules/application';
2+
import './bundle-config';
3+
app.start({ moduleName: 'main-page' });

demo/app/bundle-config.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
declare var global: NodeJS.Global;
22

33
if ((<any>global).TNS_WEBPACK) {
4-
require("tns-core-modules/bundle-entry-points");
4+
require('tns-core-modules/bundle-entry-points');
55

6-
global.registerModule("main-page", () => require("./main-page"));
7-
global.registerModule("multifab", () => require("./multifab"));
6+
global.registerModule('main-page', () => require('./main-page'));
7+
global.registerModule('multifab', () => require('./multifab'));
88

9-
// register application modules
10-
global.registerModule("nativescript-floatingactionbutton", () => require("nativescript-floatingactionbutton"));
11-
}
9+
// register application modules
10+
global.registerModule('nativescript-floatingactionbutton', () =>
11+
require('nativescript-floatingactionbutton')
12+
);
13+
}

demo/app/main-page.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
import * as app from "tns-core-modules/application";
2-
import * as observable from "tns-core-modules/data/observable";
3-
import * as observableArrayModule from "tns-core-modules/data/observable-array";
4-
import * as platformModule from "tns-core-modules/platform";
5-
import * as frameModule from "tns-core-modules/ui/frame";
6-
import * as color from "tns-core-modules/color";
1+
import * as app from 'tns-core-modules/application';
2+
import * as color from 'tns-core-modules/color';
3+
import * as observable from 'tns-core-modules/data/observable';
4+
import * as observableArrayModule from 'tns-core-modules/data/observable-array';
5+
import * as platformModule from 'tns-core-modules/platform';
6+
import * as frameModule from 'tns-core-modules/ui/frame';
77

88
const users = [
9-
{ name: "Billy Bob" },
10-
{ name: "Tweeder" },
11-
{ name: "Mox" },
12-
{ name: "Coach" },
13-
{ name: "Lance" },
14-
{ name: "Johnson" },
15-
{ name: "William" },
16-
{ name: "Franklin" },
17-
{ name: "Billy Bob" },
18-
{ name: "Tweeder" },
19-
{ name: "Mox" },
20-
{ name: "Coach" },
21-
{ name: "Lance" },
22-
{ name: "Johnson" },
23-
{ name: "William" },
24-
{ name: "Franklin" }
9+
{ name: 'Billy Bob' },
10+
{ name: 'Tweeder' },
11+
{ name: 'Mox' },
12+
{ name: 'Coach' },
13+
{ name: 'Lance' },
14+
{ name: 'Johnson' },
15+
{ name: 'William' },
16+
{ name: 'Franklin' },
17+
{ name: 'Billy Bob' },
18+
{ name: 'Tweeder' },
19+
{ name: 'Mox' },
20+
{ name: 'Coach' },
21+
{ name: 'Lance' },
22+
{ name: 'Johnson' },
23+
{ name: 'William' },
24+
{ name: 'Franklin' }
2525
];
2626
const viewModel = observable.fromObject({
27-
users: new observableArrayModule.ObservableArray(users)
27+
users: new observableArrayModule.ObservableArray(users)
2828
});
2929

3030
export function pageLoaded(args) {
31-
const page = args.object;
32-
if (platformModule.isAndroid) {
33-
// Change statusbar color on Lollipop
34-
if (platformModule.device.sdkVersion >= "21") {
35-
const window = app.android.startActivity.getWindow();
36-
window.setStatusBarColor(new color.Color("#303F9F").android);
37-
}
38-
}
39-
page.bindingContext = viewModel;
31+
const page = args.object;
32+
if (platformModule.isAndroid) {
33+
// Change statusbar color on Lollipop
34+
if (platformModule.device.sdkVersion >= '21') {
35+
const window = app.android.startActivity.getWindow();
36+
window.setStatusBarColor(new color.Color('#303F9F').android);
37+
}
38+
}
39+
page.bindingContext = viewModel;
4040
}
4141
// exports.pageLoaded = pageLoaded;
4242

4343
export function fabTap(args) {
44-
(viewModel as any).users.unshift({ name: "Gary" });
44+
(viewModel as any).users.unshift({ name: 'Gary' });
4545
}
4646

4747
export function goMultiFab(args) {
48-
frameModule.topmost().navigate("multifab");
48+
frameModule.topmost().navigate('multifab');
4949
}

demo/app/main-page.xml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
2-
xmlns:FAB="nativescript-floatingactionbutton">
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
2+
xmlns:FAB="nativescript-floatingactionbutton">
33
<Page.actionBar>
44
<ActionBar title="Native FAB" backgroundColor="#3F51B5" color="#fff" />
55
</Page.actionBar>
@@ -12,14 +12,7 @@
1212
<label text="{{ name }}" textWrap="true" fontSize="15" margin="20" />
1313
</list-view.itemTemplate>
1414
</list-view>
15-
<FAB:fab
16-
id="fabButton"
17-
row="1"
18-
icon="res://nstudio"
19-
tap="fabTap"
20-
rippleColor="#ffffff"
21-
class="fab-button-bottom"
22-
hideOnSwipeOfView="userList"
23-
swipeAnimation="slideUp" /> <!-- slideDown, slideUp, slideRight, slideLeft, scale -->
15+
<FAB:fab id="fabButton" row="1" icon="res://nstudio" tap="fabTap" rippleColor="#ffffff" class="fab-button-bottom" hideOnSwipeOfView="userList" swipeAnimation="slideUp" />
16+
<!-- slideDown, slideUp, slideRight, slideLeft, scale -->
2417
</grid-layout>
2518
</Page>

demo/app/multifab.css

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
.fab-button {
2-
height: 50;
3-
width: 50;
4-
margin: 15;
5-
color: #fff;
6-
background-color: #ff4081;
2+
height: 50;
3+
width: 50;
4+
margin: 15;
5+
color: #fff;
6+
background-color: #ff4081;
77
}
88

99
.top-left {
10-
background-color: red;
11-
horizontal-align: left;
12-
vertical-align: top;
10+
background-color: red;
11+
horizontal-align: left;
12+
vertical-align: top;
1313
}
1414

1515
.top-right {
16-
background-color: #336699;
17-
horizontal-align: right;
18-
vertical-align: top;
16+
background-color: #336699;
17+
horizontal-align: right;
18+
vertical-align: top;
1919
}
2020

2121
.bottom-left {
22-
background-color: #fff000;
23-
horizontal-align: left;
24-
vertical-align: bottom;
22+
background-color: #fff000;
23+
horizontal-align: left;
24+
vertical-align: bottom;
2525
}
2626

2727
.bottom-right {
28-
horizontal-align: right;
29-
vertical-align: bottom;
28+
horizontal-align: right;
29+
vertical-align: bottom;
3030
}
3131

3232
.center {
33-
horizontal-align: center;
34-
vertical-align: center;
33+
horizontal-align: center;
34+
vertical-align: center;
3535
}

demo/app/multifab.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
import * as app from "tns-core-modules/application";
2-
import * as observable from "tns-core-modules/data/observable";
3-
import * as observableArrayModule from "tns-core-modules/data/observable-array";
4-
import * as platformModule from "tns-core-modules/platform";
5-
import * as color from "tns-core-modules/color";
6-
import * as frame from "tns-core-modules/ui/frame";
1+
import * as app from 'tns-core-modules/application';
2+
import * as color from 'tns-core-modules/color';
3+
import * as platformModule from 'tns-core-modules/platform';
4+
import * as frame from 'tns-core-modules/ui/frame';
75

86
export function pageLoaded(args) {
9-
const page = args.object;
10-
if (platformModule.isAndroid) {
11-
// Change statusbar color on Lollipop
12-
if (platformModule.device.sdkVersion >= "21") {
13-
const window = app.android.startActivity.getWindow();
14-
window.setStatusBarColor(new color.Color("#303F9F").android);
15-
}
16-
}
7+
const page = args.object;
8+
if (platformModule.isAndroid) {
9+
// Change statusbar color on Lollipop
10+
if (platformModule.device.sdkVersion >= '21') {
11+
const window = app.android.startActivity.getWindow();
12+
window.setStatusBarColor(new color.Color('#303F9F').android);
13+
}
14+
}
1715
}
1816
// exports.pageLoaded = pageLoaded;
1917

2018
export function fabTap(args) {
21-
alert("tap");
22-
frame.topmost().goBack();
19+
alert('tap');
20+
frame.topmost().goBack();
2321
}
2422

2523
export function animate(args) {
26-
args.object.animate({
27-
duration: 500,
28-
target: args.object,
29-
opacity: 0,
30-
translate: { x: 100, y: 200 }
31-
});
24+
args.object.animate({
25+
duration: 500,
26+
target: args.object,
27+
opacity: 0,
28+
translate: { x: 100, y: 200 }
29+
});
3230
}

demo/app/multifab.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<Page
2-
xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
32
xmlns:FAB="nativescript-floatingactionbutton">
43
<Page.actionBar>
54
<ActionBar title="Native FAB" backgroundColor="#3F51B5" color="#fff" />

demo/app/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"android": {
3-
"v8Flags": "--expose_gc"
4-
},
5-
"main": "app.js",
6-
"name": "tns-template-hello-world",
7-
"version": "3.2.0"
8-
}
2+
"android": {
3+
"v8Flags": "--expose_gc"
4+
},
5+
"main": "app.js",
6+
"name": "tns-template-hello-world",
7+
"version": "3.2.0"
8+
}

demo/app/vendor-platform.android.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
require("application");
2-
if (!global["__snapshot"]) {
3-
/*
1+
require('application');
2+
if (!global['__snapshot']) {
3+
/*
44
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
55
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
66
*/
7-
require("ui/frame");
8-
require("ui/frame/activity");
7+
require('ui/frame');
8+
require('ui/frame/activity');
99
}

0 commit comments

Comments
 (0)