Skip to content

Commit

Permalink
plugin updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmartin committed Oct 2, 2017
1 parent 4b48060 commit a7d3b29
Show file tree
Hide file tree
Showing 20 changed files with 414 additions and 90 deletions.
28 changes: 27 additions & 1 deletion .gitignore
Expand Up @@ -212,5 +212,31 @@ demo/lib/*

src/*.js
/*.js
demo/app/*.js
demo/node_modules/
node_modules/
node_modules/

.vscode
.idea
.DS_Store
*.js
*.js.map
*.log
src/*.d.ts
!src/index.d.ts
!src/references.d.ts
!src/scripts/*.js
!seed-tests/*.js
seed-tests/seed-copy/**/*.*
seed-tests/seed-copy-new-git-repo/**/*.*
!demo/karma.conf.js
!demo/app/tests/*.js
demo/*.d.ts
!demo/references.d.ts
demo/lib
demo/platforms
node_modules
publish/src
publish/package
demo/report/report.html
demo/report/stats.json
70 changes: 70 additions & 0 deletions .travis.yml
@@ -0,0 +1,70 @@
branches:
only:
- master
matrix:
include:
- stage: "Lint"
language: node_js
os: linux
node_js: "6"
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint
- stage: "Build and Test"
env:
- BuildAndroid="25"
language: android
os: linux
jdk: oraclejdk8
before_install: nvm install stable
script:
- cd src && npm i && npm run tsc && cd ../demo
- travis_wait travis_retry tns build android
- os: osx
env:
- BuildiOS="10.3"
- Xcode="8.3"
osx_image: xcode8.3
language: node_js
node_js: "6"
jdk: oraclejdk8
script:
- cd src && npm i && npm run tsc && cd ../demo
- travis_wait travis_retry tns build ios
- os: linux
language: android
env:
- TestVersion="latest"
jdk: oraclejdk8
before_install:
- nvm install stable
before_script:
- cd seed-tests && npm i
- echo no | android create avd --force -n test -t android-21 -b armeabi-v7a
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
script: travis_wait travis_retry npm run test.android
dist: precise
- os: osx
env:
- TestVersion="latest"
language: node_js
node_js: "6"
jdk: oraclejdk8
osx_image: xcode8.3
before_script:
- cd seed-tests && npm i
script: travis_wait travis_retry npm run test.ios

android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- android-25
- extra-android-m2repository
- sys-img-armeabi-v7a-android-21

install:
- npm install -g nativescript
- tns usage-reporting disable
- tns error-reporting disable

21 changes: 21 additions & 0 deletions LICENSE.md
@@ -0,0 +1,21 @@
The MIT License (MIT) - do whatever you want with this - just don't be a bitch about it.

nativescript-floatingactionbutton
Copyright (c) 2017, Brad Martin

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions demo/app/app.ts
@@ -0,0 +1,2 @@
import * as app from "tns-core-modules/application";
app.start({ moduleName: "main-page" });
49 changes: 49 additions & 0 deletions demo/app/main-page.ts
@@ -0,0 +1,49 @@
import * as app from "tns-core-modules/application";
import * as observable from "tns-core-modules/data/observable";
import * as observableArrayModule from "tns-core-modules/data/observable-array";
import * as platformModule from "tns-core-modules/platform";
import * as frameModule from "tns-core-modules/ui/frame";
import * as color from "tns-core-modules/color";

const users = [
{ name: "Billy Bob" },
{ name: "Tweeder" },
{ name: "Mox" },
{ name: "Coach" },
{ name: "Lance" },
{ name: "Johnson" },
{ name: "William" },
{ name: "Franklin" },
{ name: "Billy Bob" },
{ name: "Tweeder" },
{ name: "Mox" },
{ name: "Coach" },
{ name: "Lance" },
{ name: "Johnson" },
{ name: "William" },
{ name: "Franklin" }
];
var viewModel = observable.fromObject({
users: new observableArrayModule.ObservableArray(users)
});

export function pageLoaded(args) {
const page = args.object;
if (platformModule.isAndroid) {
// Change statusbar color on Lollipop
if (platformModule.device.sdkVersion >= "21") {
const window = app.android.startActivity.getWindow();
window.setStatusBarColor(new color.Color("#303F9F").android);
}
}
page.bindingContext = viewModel;
}
// exports.pageLoaded = pageLoaded;

export function fabTap(args) {
(viewModel as any).users.unshift({ name: "Gary" });
}

export function goMultiFab(args) {
frameModule.topmost().navigate("multifab");
}
45 changes: 24 additions & 21 deletions demo/app/multifab.css
@@ -1,32 +1,35 @@
.fab-button {
height: 50;
width: 50;
margin: 15;
color: #FFF;
background-color: #ff4081;
height: 50;
width: 50;
margin: 15;
color: #fff;
background-color: #ff4081;
}

.top-left{
horizontal-align: left;
vertical-align: top;
.top-left {
background-color: red;
horizontal-align: left;
vertical-align: top;
}

.top-right{
horizontal-align: right;
vertical-align: top;
.top-right {
background-color: #336699;
horizontal-align: right;
vertical-align: top;
}

.bottom-left{
horizontal-align: left;
vertical-align: bottom;
.bottom-left {
background-color: #fff000;
horizontal-align: left;
vertical-align: bottom;
}

.bottom-right{
horizontal-align: right;
vertical-align: bottom;
.bottom-right {
horizontal-align: right;
vertical-align: bottom;
}

.center{
horizontal-align: center;
vertical-align: center;
}
.center {
horizontal-align: center;
vertical-align: center;
}
32 changes: 32 additions & 0 deletions demo/app/multifab.ts
@@ -0,0 +1,32 @@
import * as app from "tns-core-modules/application";
import * as observable from "tns-core-modules/data/observable";
import * as observableArrayModule from "tns-core-modules/data/observable-array";
import * as platformModule from "tns-core-modules/platform";
import * as color from "tns-core-modules/color";
import * as frame from "tns-core-modules/ui/frame";

export function pageLoaded(args) {
const page = args.object;
if (platformModule.isAndroid) {
// Change statusbar color on Lollipop
if (platformModule.device.sdkVersion >= "21") {
const window = app.android.startActivity.getWindow();
window.setStatusBarColor(new color.Color("#303F9F").android);
}
}
}
// exports.pageLoaded = pageLoaded;

export function fabTap(args) {
alert("tap");
frame.topmost().goBack();
}

export function animate(args) {
args.object.animate({
duration: 500,
target: args.object,
opacity: 0,
translate: { x: 100, y: 200 }
});
}
9 changes: 9 additions & 0 deletions demo/app/vendor-platform.android.ts
@@ -0,0 +1,9 @@
require("application");
if (!global["__snapshot"]) {
/*
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
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.
*/
require("ui/frame");
require("ui/frame/activity");
}
Empty file added demo/app/vendor-platform.ios.ts
Empty file.
3 changes: 3 additions & 0 deletions demo/app/vendor.ts
@@ -0,0 +1,3 @@
require("./vendor-platform");

require("bundle-entry-points");
62 changes: 62 additions & 0 deletions demo/karma.conf.js
@@ -0,0 +1,62 @@
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["jasmine"],

// list of files / patterns to load in the browser
files: ["app/**/*.js"],

// list of files to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["progress"],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [],

customLaunchers: {
android: {
base: "NS",
platform: "android"
},
ios: {
base: "NS",
platform: "ios"
},
ios_simulator: {
base: "NS",
platform: "ios",
arguments: ["--emulator"]
}
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};

0 comments on commit a7d3b29

Please sign in to comment.