16 |
--------------------------------------------------------------------------------
/platforms/android/assets/www/src/Cordova.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | export default {
20 | // Application Constructor
21 | initialize: function() {
22 | document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
23 | },
24 |
25 | // deviceready Event Handler
26 | //
27 | // Bind any cordova events here. Common events are:
28 | // 'pause', 'resume', etc.
29 | onDeviceReady: function() {
30 | this.receivedEvent('deviceready');
31 | },
32 |
33 | // Update DOM on a Received Event
34 | receivedEvent: function(id) {
35 | var parentElement = document.getElementById(id);
36 | var listeningElement = parentElement.querySelector('.listening');
37 | var receivedElement = parentElement.querySelector('.received');
38 |
39 | listeningElement.setAttribute('style', 'display:none;');
40 | receivedElement.setAttribute('style', 'display:block;');
41 |
42 | console.log('Received Event: ' + id);
43 | }
44 | }
--------------------------------------------------------------------------------
/platforms/android/assets/www/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import Cordova from './Cordova.js'
4 |
5 | // Load Vue instance
6 | new Vue({
7 | el: '#app',
8 | render: h => h(App),
9 | mounted() {
10 | Cordova.initialize()
11 | }
12 | })
--------------------------------------------------------------------------------
/platforms/android/cordova/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true
3 | , "bitwise": true
4 | , "undef": true
5 | , "trailing": true
6 | , "quotmark": true
7 | , "indent": 4
8 | , "unused": "vars"
9 | , "latedef": "nofunc"
10 | }
11 |
--------------------------------------------------------------------------------
/platforms/android/cordova/android_sdk_version:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var android_sdk_version = require('./lib/android_sdk_version');
23 |
24 | android_sdk_version.run().done(null, function(err) {
25 | console.log(err);
26 | process.exit(2);
27 | });
28 |
29 |
30 |
--------------------------------------------------------------------------------
/platforms/android/cordova/build:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var args = process.argv;
23 | var Api = require('./Api');
24 | var nopt = require('nopt');
25 | var path = require('path');
26 |
27 | // Support basic help commands
28 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
29 | require('./lib/build').help();
30 |
31 | // Do some basic argument parsing
32 | var buildOpts = nopt({
33 | 'verbose' : Boolean,
34 | 'silent' : Boolean,
35 | 'debug' : Boolean,
36 | 'release' : Boolean,
37 | 'nobuild': Boolean,
38 | 'buildConfig' : path
39 | }, { 'd' : '--verbose' });
40 |
41 | // Make buildOptions compatible with PlatformApi build method spec
42 | buildOpts.argv = buildOpts.argv.original;
43 |
44 | require('./loggingHelper').adjustLoggerLevel(buildOpts);
45 |
46 | new Api().build(buildOpts)
47 | .catch(function(err) {
48 | console.error(err.stack);
49 | process.exit(2);
50 | });
51 |
--------------------------------------------------------------------------------
/platforms/android/cordova/build.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0build"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/check_reqs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var check_reqs = require('./lib/check_reqs');
23 |
24 | check_reqs.run().done(
25 | function success() {
26 | console.log('Looks like your environment fully supports cordova-android development!');
27 | }, function fail(err) {
28 | console.log(err);
29 | process.exit(2);
30 | }
31 | );
32 |
--------------------------------------------------------------------------------
/platforms/android/cordova/check_reqs.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0check_reqs"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/platforms/android/cordova/clean:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var Api = require('./Api');
23 | var path = require('path');
24 | var nopt = require('nopt');
25 |
26 | // Support basic help commands
27 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
28 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
29 | console.log('Cleans the project directory.');
30 | process.exit(0);
31 | }
32 |
33 | // Do some basic argument parsing
34 | var opts = nopt({
35 | 'verbose' : Boolean,
36 | 'silent' : Boolean
37 | }, { 'd' : '--verbose' });
38 |
39 | // Make buildOptions compatible with PlatformApi clean method spec
40 | opts.argv = opts.argv.original;
41 |
42 | // Skip cleaning prepared files when not invoking via cordova CLI.
43 | opts.noPrepare = true;
44 |
45 | require('./loggingHelper').adjustLoggerLevel(opts);
46 |
47 | new Api().clean(opts)
48 | .catch(function(err) {
49 | console.error(err.stack);
50 | process.exit(2);
51 | });
52 |
--------------------------------------------------------------------------------
/platforms/android/cordova/clean.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0clean"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/defaults.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/AndroidStudio.js:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a simple routine that checks if project is an Android Studio Project
3 | *
4 | * @param {String} root Root folder of the project
5 | */
6 |
7 | /*jshint esnext: false */
8 |
9 | var path = require('path');
10 | var fs = require('fs');
11 | var CordovaError = require('cordova-common').CordovaError;
12 |
13 | module.exports.isAndroidStudioProject = function isAndroidStudioProject(root) {
14 | var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res', 'project.properties', 'platform_www'];
15 | var androidStudioFiles = ['app', 'gradle', 'app/src/main/res'];
16 |
17 | // assume it is an AS project and not an Eclipse project
18 | var isEclipse = false;
19 | var isAS = true;
20 |
21 | if(!fs.existsSync(root)) {
22 | throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
23 | }
24 |
25 | // if any of the following exists, then we are not an ASProj
26 | eclipseFiles.forEach(function(file) {
27 | if(fs.existsSync(path.join(root, file))) {
28 | isEclipse = true;
29 | }
30 | });
31 |
32 | // if it is NOT an eclipse project, check that all required files exist
33 | if(!isEclipse) {
34 | androidStudioFiles.forEach(function(file){
35 | if(!fs.existsSync(path.join(root, file))) {
36 | console.log('missing file :: ' + file);
37 | isAS = false;
38 | }
39 | });
40 | }
41 | return (!isEclipse && isAS);
42 | };
43 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/android_sdk_version.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var child_process = require('child_process'),
23 | Q = require('q');
24 |
25 | var get_highest_sdk = function(results){
26 | var reg = /\d+/;
27 | var apiLevels = [];
28 | for(var i=0;i 2) {
26 | var install_target;
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | device.install(install_target).done(null, function(err) {
30 | console.error('ERROR: ' + err);
31 | process.exit(2);
32 | });
33 | } else {
34 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
35 | process.exit(2);
36 | }
37 | } else {
38 | device.install().done(null, function(err) {
39 | console.error('ERROR: ' + err);
40 | process.exit(2);
41 | });
42 | }
43 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/install-device.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0install-device"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/install-emulator:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulator = require('./emulator'),
23 | args = process.argv;
24 |
25 | var install_target;
26 | if(args.length > 2) {
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | } else {
30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
31 | process.exit(2);
32 | }
33 | }
34 |
35 | emulator.install(install_target).done(null, function(err) {
36 | console.error('ERROR: ' + err);
37 | process.exit(2);
38 | });
39 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/install-emulator.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0install-emulator"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-devices:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var devices = require('./device');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | devices.list().done(function(device_list) {
27 | device_list && device_list.forEach(function(dev) {
28 | console.log(dev);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-devices.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-devices"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-emulator-images:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulators = require('./emulator');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | emulators.list_images().done(function(emulator_list) {
27 | emulator_list && emulator_list.forEach(function(emu) {
28 | console.log(emu.name);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-emulator-images.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-emulator-images"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-started-emulators:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulators = require('./emulator');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | emulators.list_started().done(function(emulator_list) {
27 | emulator_list && emulator_list.forEach(function(emu) {
28 | console.log(emu);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/list-started-emulators.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-started-emulators"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/log.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var path = require('path'),
23 | os = require('os'),
24 | Q = require('q'),
25 | child_process = require('child_process'),
26 | ROOT = path.join(__dirname, '..', '..');
27 |
28 | /*
29 | * Starts running logcat in the shell.
30 | * Returns a promise.
31 | */
32 | module.exports.run = function() {
33 | var d = Q.defer();
34 | var adb = child_process.spawn('adb', ['logcat'], {cwd: os.tmpdir()});
35 |
36 | adb.stdout.on('data', function(data) {
37 | var lines = data ? data.toString().split('\n') : [];
38 | var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; });
39 | console.log(out.join('\n'));
40 | });
41 |
42 | adb.stderr.on('data', console.error);
43 | adb.on('close', function(code) {
44 | if (code > 0) {
45 | d.reject('Failed to run logcat command.');
46 | } else d.resolve();
47 | });
48 |
49 | return d.promise;
50 | };
51 |
52 | module.exports.help = function() {
53 | console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'log')));
54 | console.log('Gives the logcat output on the command line.');
55 | process.exit(0);
56 | };
57 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/plugin-build.gradle:
--------------------------------------------------------------------------------
1 | /* Licensed to the Apache Software Foundation (ASF) under one
2 | or more contributor license agreements. See the NOTICE file
3 | distributed with this work for additional information
4 | regarding copyright ownership. The ASF licenses this file
5 | to you under the Apache License, Version 2.0 (the
6 | "License"); you may not use this file except in compliance
7 | with the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing,
12 | software distributed under the License is distributed on an
13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | KIND, either express or implied. See the License for the
15 | specific language governing permissions and limitations
16 | under the License.
17 | */
18 |
19 | // GENERATED FILE! DO NOT EDIT!
20 |
21 | buildscript {
22 | repositories {
23 | mavenCentral()
24 | jcenter()
25 | }
26 |
27 | // Switch the Android Gradle plugin version requirement depending on the
28 | // installed version of Gradle. This dependency is documented at
29 | // http://tools.android.com/tech-docs/new-build-system/version-compatibility
30 | // and https://issues.apache.org/jira/browse/CB-8143
31 | dependencies {
32 | classpath 'com.android.tools.build:gradle:1.0.0+'
33 | }
34 | }
35 |
36 | apply plugin: 'com.android.library'
37 |
38 | dependencies {
39 | compile fileTree(dir: 'libs', include: '*.jar')
40 | debugCompile project(path: ":CordovaLib", configuration: "debug")
41 | releaseCompile project(path: ":CordovaLib", configuration: "release")
42 | }
43 |
44 | android {
45 | compileSdkVersion cdvCompileSdkVersion
46 | buildToolsVersion cdvBuildToolsVersion
47 | publishNonDefault true
48 |
49 | compileOptions {
50 | sourceCompatibility JavaVersion.VERSION_1_6
51 | targetCompatibility JavaVersion.VERSION_1_6
52 | }
53 |
54 | sourceSets {
55 | main {
56 | manifest.srcFile 'AndroidManifest.xml'
57 | java.srcDirs = ['src']
58 | resources.srcDirs = ['src']
59 | aidl.srcDirs = ['src']
60 | renderscript.srcDirs = ['src']
61 | res.srcDirs = ['res']
62 | assets.srcDirs = ['assets']
63 | jniLibs.srcDirs = ['libs']
64 | }
65 | }
66 | }
67 |
68 | if (file('build-extras.gradle').exists()) {
69 | apply from: 'build-extras.gradle'
70 | }
71 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/retry.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | /* jshint node: true */
23 |
24 | 'use strict';
25 |
26 | var events = require('cordova-common').events;
27 |
28 | /*
29 | * Retry a promise-returning function a number of times, propagating its
30 | * results on success or throwing its error on a failed final attempt.
31 | *
32 | * @arg {Number} attemts_left - The number of times to retry the passed call.
33 | * @arg {Function} promiseFunction - A function that returns a promise.
34 | * @arg {...} - Arguments to pass to promiseFunction.
35 | *
36 | * @returns {Promise}
37 | */
38 | module.exports.retryPromise = function (attemts_left, promiseFunction) {
39 |
40 | // NOTE:
41 | // get all trailing arguments, by skipping the first two (attemts_left and
42 | // promiseFunction) because they shouldn't get passed to promiseFunction
43 | var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2);
44 |
45 | return promiseFunction.apply(undefined, promiseFunctionArguments).then(
46 |
47 | // on success pass results through
48 | function onFulfilled(value) {
49 | return value;
50 | },
51 |
52 | // on rejection either retry, or throw the error
53 | function onRejected(error) {
54 |
55 | attemts_left -= 1;
56 |
57 | if (attemts_left < 1) {
58 | throw error;
59 | }
60 |
61 | events.emit('verbose', 'A retried call failed. Retrying ' + attemts_left + ' more time(s).');
62 |
63 | // retry call self again with the same arguments, except attemts_left is now lower
64 | var fullArguments = [attemts_left, promiseFunction].concat(promiseFunctionArguments);
65 | return module.exports.retryPromise.apply(undefined, fullArguments);
66 | }
67 | );
68 | };
69 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/start-emulator:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulator = require('./emulator'),
23 | args = process.argv;
24 |
25 | var install_target;
26 | if(args.length > 2) {
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | } else {
30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
31 | process.exit(2);
32 | }
33 | }
34 |
35 | emulator.start(install_target).done(null, function(err) {
36 | console.error('ERROR: ' + err);
37 | process.exit(2);
38 | });
39 |
40 |
--------------------------------------------------------------------------------
/platforms/android/cordova/lib/start-emulator.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0start-emulator"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/log:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var log = require('./lib/log'),
23 | reqs = require('./lib/check_reqs'),
24 | args = process.argv;
25 |
26 | // Usage support for when args are given
27 | if(args.length > 2) {
28 | log.help();
29 | } else {
30 | reqs.run().done(function() {
31 | return log.run();
32 | }, function(err) {
33 | console.error('ERROR: ' + err);
34 | process.exit(2);
35 | });
36 | }
37 |
--------------------------------------------------------------------------------
/platforms/android/cordova/log.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0log"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/loggingHelper.js:
--------------------------------------------------------------------------------
1 | var CordovaLogger = require('cordova-common').CordovaLogger;
2 |
3 | module.exports = {
4 | adjustLoggerLevel: function (opts) {
5 | if (opts instanceof Array) {
6 | opts.silent = opts.indexOf('--silent') !== -1;
7 | opts.verbose = opts.indexOf('--verbose') !== -1;
8 | }
9 |
10 | if (opts.silent) {
11 | CordovaLogger.get().setLevel('error');
12 | }
13 |
14 | if (opts.verbose) {
15 | CordovaLogger.get().setLevel('verbose');
16 | }
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/platforms/android/cordova/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var Api = require('./Api');
23 | var nopt = require('nopt');
24 | var path = require('path');
25 |
26 | // Support basic help commands
27 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
28 | require('./lib/run').help();
29 |
30 | // Do some basic argument parsing
31 | var runOpts = nopt({
32 | 'verbose' : Boolean,
33 | 'silent' : Boolean,
34 | 'debug' : Boolean,
35 | 'release' : Boolean,
36 | 'nobuild': Boolean,
37 | 'buildConfig' : path,
38 | 'archs' : String,
39 | 'device' : Boolean,
40 | 'emulator': Boolean,
41 | 'target' : String
42 | }, { 'd' : '--verbose' });
43 |
44 | // Make runOptions compatible with PlatformApi run method spec
45 | runOpts.argv = runOpts.argv.remain;
46 |
47 | require('./loggingHelper').adjustLoggerLevel(runOpts);
48 |
49 | new Api().run(runOpts)
50 | .catch(function(err) {
51 | console.error(err, err.stack);
52 | process.exit(2);
53 | });
54 |
--------------------------------------------------------------------------------
/platforms/android/cordova/run.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0run"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/platforms/android/cordova/version:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | // Coho updates this line:
23 | var VERSION = "6.1.2";
24 |
25 | module.exports.version = VERSION;
26 |
27 | if (!module.parent) {
28 | console.log(VERSION);
29 | }
30 |
--------------------------------------------------------------------------------
/platforms/android/cordova/version.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0version"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/platforms/android/platform_www/cordova-js-src/android/nativeapiprovider.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | /**
21 | * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
22 | */
23 |
24 | var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi');
25 | var currentApi = nativeApi;
26 |
27 | module.exports = {
28 | get: function() { return currentApi; },
29 | setPreferPrompt: function(value) {
30 | currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi;
31 | },
32 | // Used only by tests.
33 | set: function(value) {
34 | currentApi = value;
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/platforms/android/platform_www/cordova-js-src/android/promptbasednativeapi.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | /**
21 | * Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
22 | * This is used pre-JellyBean, where addJavascriptInterface() is disabled.
23 | */
24 |
25 | module.exports = {
26 | exec: function(bridgeSecret, service, action, callbackId, argsJson) {
27 | return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId]));
28 | },
29 | setNativeToJsBridgeMode: function(bridgeSecret, value) {
30 | prompt(value, 'gap_bridge_mode:' + bridgeSecret);
31 | },
32 | retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) {
33 | return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret);
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/platforms/android/platform_www/cordova_plugins.js:
--------------------------------------------------------------------------------
1 | cordova.define('cordova/plugin_list', function(require, exports, module) {
2 | module.exports = [];
3 | module.exports.metadata =
4 | // TOP OF METADATA
5 | {
6 | "cordova-plugin-whitelist": "1.3.1"
7 | };
8 | // BOTTOM OF METADATA
9 | });
--------------------------------------------------------------------------------
/platforms/android/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 | # Project target.
13 | target=android-25
14 | android.library.reference.1=CordovaLib
15 |
--------------------------------------------------------------------------------
/platforms/android/res/drawable-land-hdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-land-hdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-land-ldpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-land-ldpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-land-mdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-land-mdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-land-xhdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-land-xhdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-port-hdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-port-hdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-port-ldpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-port-ldpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-port-mdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-port-mdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/drawable-port-xhdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/drawable-port-xhdpi/screen.png
--------------------------------------------------------------------------------
/platforms/android/res/mipmap-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/mipmap-hdpi/icon.png
--------------------------------------------------------------------------------
/platforms/android/res/mipmap-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/mipmap-ldpi/icon.png
--------------------------------------------------------------------------------
/platforms/android/res/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/platforms/android/res/mipmap-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/platforms/android/res/mipmap-xhdpi/icon.png
--------------------------------------------------------------------------------
/platforms/android/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cordovue
4 | @string/app_name
5 | @string/launcher_name
6 |
7 |
--------------------------------------------------------------------------------
/platforms/android/res/xml/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Cordovue
8 |
9 | A sample Apache Cordova application using VueJS.
10 |
11 |
12 | Gabriel Cueto - @Mushr00m_Dev
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/platforms/android/settings.gradle:
--------------------------------------------------------------------------------
1 | // GENERATED FILE - DO NOT EDIT
2 | include ":"
3 | include ":CordovaLib"
4 |
--------------------------------------------------------------------------------
/platforms/android/src/com/laesporadelhongo/cordovue/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package com.laesporadelhongo.cordovue;
21 |
22 | import android.os.Bundle;
23 | import org.apache.cordova.*;
24 |
25 | public class MainActivity extends CordovaActivity
26 | {
27 | @Override
28 | public void onCreate(Bundle savedInstanceState)
29 | {
30 | super.onCreate(savedInstanceState);
31 |
32 | // enable Cordova apps to be started in the background
33 | Bundle extras = getIntent().getExtras();
34 | if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
35 | moveTaskToBack(true);
36 | }
37 |
38 | // Set by in config.xml
39 | loadUrl(launchUrl);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/platforms/platforms.json:
--------------------------------------------------------------------------------
1 | {
2 | "android": "6.1.2"
3 | }
--------------------------------------------------------------------------------
/plugins/android.json:
--------------------------------------------------------------------------------
1 | {
2 | "prepare_queue": {
3 | "installed": [],
4 | "uninstalled": []
5 | },
6 | "config_munge": {
7 | "files": {}
8 | },
9 | "installed_plugins": {
10 | "cordova-plugin-whitelist": {
11 | "PACKAGE_NAME": "com.laesporadelhongo.testcordovavuewebpack"
12 | }
13 | },
14 | "dependent_plugins": {}
15 | }
--------------------------------------------------------------------------------
/plugins/cordova-plugin-whitelist/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
21 |
22 | # Contributing to Apache Cordova
23 |
24 | Anyone can contribute to Cordova. And we need your contributions.
25 |
26 | There are multiple ways to contribute: report bugs, improve the docs, and
27 | contribute code.
28 |
29 | For instructions on this, start with the
30 | [contribution overview](http://cordova.apache.org/contribute/).
31 |
32 | The details are explained there, but the important items are:
33 | - Sign and submit an Apache ICLA (Contributor License Agreement).
34 | - Have a Jira issue open that corresponds to your contribution.
35 | - Run the tests so your patch doesn't break existing functionality.
36 |
37 | We look forward to your contributions!
38 |
--------------------------------------------------------------------------------
/plugins/cordova-plugin-whitelist/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Cordova
2 | Copyright 2012 The Apache Software Foundation
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
6 |
--------------------------------------------------------------------------------
/plugins/cordova-plugin-whitelist/RELEASENOTES.md:
--------------------------------------------------------------------------------
1 |
21 | # Release Notes
22 |
23 | ### 1.3.1 (Dec 07, 2016)
24 | * [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been submitted…"
25 | * Edit package.json license to match SPDX id
26 | * [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version.
27 |
28 | ### 1.3.0 (Sep 08, 2016)
29 | * [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies
30 | * Updated installation section
31 | * Plugin uses `Android Log class` and not `Cordova LOG class`
32 | * Add pull request template.
33 | * [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine info to `package.json`
34 | * [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to README.md
35 |
36 | ### 1.2.2 (Apr 15, 2016)
37 | * add note about redirects
38 | * [CB-10624](https://issues.apache.org/jira/browse/CB-10624) remove error message from `whitelist.js`, which leaves it empty
39 |
40 | ### 1.2.1 (Jan 15, 2016)
41 | * [CB-10194](https://issues.apache.org/jira/browse/CB-10194) info tag prints for ios when not applicable
42 |
43 | ### 1.2.0 (Nov 18, 2015)
44 | * removed **iOS** engine check from `plugin.xml`
45 | * [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest
46 | * [CB-9972](https://issues.apache.org/jira/browse/CB-9972) - Remove **iOS** whitelist
47 | * Updated the text, it should read 4.0.x and greater, since this plugin will be required for `cordova-android 5.0`
48 | * Fixing contribute link.
49 | * Updated `plugin.xml ` tag to remove warning about not needing this plugin if you are using the **iOS 9 SDK**
50 | * [CB-9738](https://issues.apache.org/jira/browse/CB-9738) - Disable whitelist use when runtime environment is **iOS 9**
51 | * [CB-9740](https://issues.apache.org/jira/browse/CB-9740) - Add `` tag describing whitelist plugin not needed on `cordova-ios` and cordova-android 3.x`
52 | * [CB-9568](https://issues.apache.org/jira/browse/CB-9568) - Update whitelist plugin to allow all network access by default
53 | * [CB-9337](https://issues.apache.org/jira/browse/CB-9337) - enable use of `` tags for native code network requests
54 |
55 | ### 1.1.0 (Jun 17, 2015)
56 | * [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-whitelist documentation translation: cordova-plugin-whitelist
57 | * fix npm md issue
58 | * Usage of CDVURLRequestFilter protocol.
59 | * [CB-9089](https://issues.apache.org/jira/browse/CB-9089) - iOS whitelist plugin does not compile
60 | * [CB-9090](https://issues.apache.org/jira/browse/CB-9090) - Enable whitelist plugin for cordova-ios 4.0.0
61 | * Fixed error in Content-Security-Policy example
62 |
63 | ### 1.0.0 (Mar 25, 2015)
64 | * [CB-8739](https://issues.apache.org/jira/browse/CB-8739) added missing license headers
65 | * Add @Override to CustomConfigXmlParser methods
66 | * Change ID to cordova-plugin-whitelist rather than reverse-DNS-style
67 | * Tweak CSP examples in README
68 | * [CB-8660](https://issues.apache.org/jira/browse/CB-8660) remove extra commas from package.json
69 |
--------------------------------------------------------------------------------
/plugins/cordova-plugin-whitelist/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-plugin-whitelist",
3 | "version": "1.3.1",
4 | "description": "Cordova Whitelist Plugin",
5 | "cordova": {
6 | "platforms": [
7 | "android"
8 | ]
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "https://github.com/apache/cordova-plugin-whitelist"
13 | },
14 | "keywords": [
15 | "cordova",
16 | "whitelist",
17 | "ecosystem:cordova",
18 | "cordova-android"
19 | ],
20 | "engines": {
21 | "cordovaDependencies": {
22 | "0.0.0": {
23 | "cordova-android": ">=4.0.0"
24 | },
25 | "2.0.0": {
26 | "cordova": ">100"
27 | }
28 | }
29 | },
30 | "author": "Apache Software Foundation",
31 | "license": "Apache-2.0"
32 | }
33 |
--------------------------------------------------------------------------------
/plugins/cordova-plugin-whitelist/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
24 | Whitelist
25 | Cordova Network Whitelist Plugin
26 | Apache 2.0
27 | cordova,whitelist,policy
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/plugins/fetch.json:
--------------------------------------------------------------------------------
1 | {
2 | "cordova-plugin-whitelist": {
3 | "source": {
4 | "type": "registry",
5 | "id": "cordova-plugin-whitelist@1"
6 | },
7 | "is_top_level": true,
8 | "variables": {}
9 | }
10 | }
--------------------------------------------------------------------------------
/preview1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/preview1.png
--------------------------------------------------------------------------------
/preview2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/preview2.png
--------------------------------------------------------------------------------
/vue-loader.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | // extractCSS: process.env.NODE_ENV === 'production',
3 | preserveWhitespace: false,
4 | postcss: [
5 | require('autoprefixer')({
6 | browsers: ['last 3 versions']
7 | })
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/webpack.base.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const webpack = require('webpack')
3 | const vueConfig = require('./vue-loader.config')
4 | const autoprefixer = require('autoprefixer');
5 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
6 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
7 |
8 | const isProd = process.env.NODE_ENV === 'production'
9 |
10 | module.exports = {
11 | devtool: isProd
12 | ? false
13 | : '#cheap-module-source-map',
14 | output: {
15 | path: path.resolve(__dirname, './www/dist'),
16 | publicPath: '/www/dist',
17 | filename: 'build.js'
18 | },
19 | resolve: {
20 | alias: {
21 | 'public': path.resolve(__dirname, '../public'),
22 | },
23 | },
24 | module: {
25 | noParse: /es6-promise\.js$/, // avoid webpack shimming process
26 | rules: [
27 | {
28 | test: /\.js$/,
29 | exclude: /node_modules/,
30 | use: 'babel-loader',
31 | },
32 | {
33 | test: /\.vue$/,
34 | loader: 'vue-loader',
35 | options: vueConfig
36 | },
37 | {
38 | test: /\.(png|jpg|gif|svg)$/,
39 | loader: 'url-loader',
40 | options: {
41 | limit: 10000,
42 | name: '[name].[ext]?[hash]'
43 | }
44 | },
45 | {
46 | test: /\.css$/,
47 | use: isProd
48 | ? ExtractTextPlugin.extract({
49 | use: 'css-loader?minimize',
50 | fallback: 'vue-style-loader'
51 | })
52 | : ['vue-style-loader', 'css-loader']
53 | }
54 | ]
55 | },
56 | performance: {
57 | maxEntrypointSize: 300000,
58 | hints: isProd ? 'warning' : false
59 | },
60 | plugins: isProd
61 | ? [
62 | new webpack.optimize.UglifyJsPlugin({
63 | compress: { warnings: false }
64 | }),
65 | new ExtractTextPlugin({
66 | filename: 'common.[chunkhash].css'
67 | })
68 | ]
69 | : [
70 | new FriendlyErrorsPlugin()
71 | ]
72 | }
73 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const webpack = require('webpack')
3 | const vueConfig = require('./vue-loader.config')
4 | const autoprefixer = require('autoprefixer');
5 | // const ExtractTextPlugin = require('extract-text-webpack-plugin')
6 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
7 |
8 | const isProd = process.env.NODE_ENV === 'production'
9 |
10 | module.exports = {
11 | devtool: isProd
12 | ? false
13 | : '#cheap-module-source-map',
14 | entry: './www/src/main.js',
15 | output: {
16 | path: path.resolve(__dirname, './www/dist'),
17 | publicPath: isProd ? '/www/dist' : '/dist',
18 | filename: 'build.js'
19 | },
20 | resolve: {
21 | alias: {
22 | 'public': path.resolve(__dirname, '../public'),
23 | },
24 | },
25 | module: {
26 | noParse: /es6-promise\.js$/, // avoid webpack shimming process
27 | rules: [
28 | {
29 | test: /\.js$/,
30 | exclude: /node_modules/,
31 | use: 'babel-loader',
32 | },
33 | {
34 | test: /\.vue$/,
35 | loader: 'vue-loader',
36 | options: vueConfig
37 | },
38 | {
39 | enforce: 'pre',
40 | test: /\.(js|vue)$/,
41 | loader: 'eslint-loader',
42 | exclude: /(node_modules)/
43 | },
44 | {
45 | test: /\.(png|jpg|gif|svg)$/,
46 | loader: 'url-loader',
47 | options: {
48 | limit: 10000,
49 | name: '[name].[ext]?[hash]'
50 | }
51 | },
52 | {
53 | test: /\.css$/,
54 | use: /* isProd
55 | ? ExtractTextPlugin.extract({
56 | use: 'css-loader?minimize',
57 | fallback: 'vue-style-loader'
58 | })
59 | : */ ['vue-style-loader', 'css-loader']
60 | }
61 | ]
62 | },
63 | performance: {
64 | maxEntrypointSize: 300000,
65 | hints: isProd ? 'warning' : false
66 | },
67 | plugins: isProd
68 | ? [
69 | new webpack.optimize.UglifyJsPlugin({
70 | compress: { warnings: false }
71 | }),
72 | /* new ExtractTextPlugin({
73 | filename: 'common.[chunkhash].css'
74 | }), */
75 | /*new webpack.LoaderOptionsPlugin({
76 | minimize: true
77 | })*/
78 | ]
79 | : [
80 | new FriendlyErrorsPlugin()
81 | ]
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/www/dist/css/index.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | * {
20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
21 | }
22 |
23 | body {
24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
27 | background-color:#E4E4E4;
28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
31 | background-image:-webkit-gradient(
32 | linear,
33 | left top,
34 | left bottom,
35 | color-stop(0, #A7A7A7),
36 | color-stop(0.51, #E4E4E4)
37 | );
38 | background-attachment:fixed;
39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
40 | font-size:12px;
41 | height:100%;
42 | margin:0px;
43 | padding:0px;
44 | text-transform:uppercase;
45 | width:100%;
46 | }
47 |
48 | /* Portrait layout (default) */
49 | .app {
50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
51 | position:absolute; /* position in the center of the screen */
52 | left:50%;
53 | top:25%;
54 | height:100px; /* text area height */
55 | width:225px; /* text area width */
56 | text-align:center;
57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
59 | /* offset horizontal: half of text area width */
60 | }
61 |
62 | /* Landscape layout (with min-width) */
63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
64 | .app {
65 | background-position:left center;
66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
68 | /* offset horizontal: half of image width and text area width */
69 | }
70 | }
71 |
72 | h1 {
73 | font-size:24px;
74 | font-weight:normal;
75 | margin:0px;
76 | overflow:visible;
77 | padding:0px;
78 | text-align:center;
79 | }
80 |
81 | h1 {
82 | font-size:16px;
83 | font-weight:normal;
84 | margin:0px;
85 | overflow:visible;
86 | padding:0px;
87 | text-align:center;
88 | }
89 |
90 | .event {
91 | border-radius:4px;
92 | -webkit-border-radius:4px;
93 | color:#FFFFFF;
94 | font-size:12px;
95 | margin:0px 30px;
96 | padding:2px 0px;
97 | }
98 |
99 | .event.listening {
100 | background-color:#333333;
101 | display:block;
102 | }
103 |
104 | .event.received {
105 | background-color:#4B946A;
106 | display:none;
107 | }
108 |
109 | @keyframes fade {
110 | from { opacity: 1.0; }
111 | 50% { opacity: 0.4; }
112 | to { opacity: 1.0; }
113 | }
114 |
115 | @-webkit-keyframes fade {
116 | from { opacity: 1.0; }
117 | 50% { opacity: 0.4; }
118 | to { opacity: 1.0; }
119 | }
120 |
121 | .blink {
122 | animation:fade 3000ms infinite;
123 | -webkit-animation:fade 3000ms infinite;
124 | }
125 |
--------------------------------------------------------------------------------
/www/dist/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheMushrr00m/cordovue/9de620bc8c6bc7f90f8ad1ecc100e86551911a6f/www/dist/img/logo.png
--------------------------------------------------------------------------------
/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
31 |
32 |
33 |
34 |
35 |
36 | Cordova + VueJS + Webpack
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/www/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
14 |
15 |
23 |
--------------------------------------------------------------------------------
/www/src/Cordova.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | export default {
20 | // Application Constructor
21 | initialize () {
22 | document.addEventListener('deviceready', this.onDeviceReady.bind(this), false)
23 | },
24 |
25 | /* deviceready Event Handler
26 | //
27 | // Bind any cordova events here. Common events are:
28 | // 'pause', 'resume', etc.
29 | */
30 | onDeviceReady () {
31 | this.receivedEvent('deviceready')
32 | },
33 |
34 | // Update DOM on a Received Event
35 | receivedEvent (id) {
36 | const parentElement = document.getElementById(id)
37 | const listeningElement = parentElement.querySelector('.listening')
38 | const receivedElement = parentElement.querySelector('.received')
39 |
40 | listeningElement.setAttribute('style', 'display:none;')
41 | receivedElement.setAttribute('style', 'display:block;')
42 |
43 | console.log('Received Event: ' + id)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/www/src/main.js:
--------------------------------------------------------------------------------
1 | import 'babel-polyfill'
2 | import Vue from 'vue'
3 | import App from './App.vue'
4 | import Cordova from './Cordova.js'
5 |
6 | import store from './store'
7 | import router from './router'
8 | import { sync } from 'vuex-router-sync'
9 |
10 | sync(store, router)
11 |
12 | // Load Vue instance
13 | export default new Vue({
14 | router,
15 | store,
16 | el: '#app',
17 | render: h => h(App),
18 | mounted () {
19 | Cordova.initialize()
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/www/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 |
4 | // const Foo = resolve => require(['../views/hello.vue'], resolve);
5 | // import hello from '../views/hello.vue';
6 |
7 | import main from '../views/main.vue'
8 | import about from '../views/about.vue'
9 |
10 | Vue.use(Router)
11 |
12 | export default new Router({
13 | mode: 'hash',
14 | scrollBehavior: () => ({ y: 0 }),
15 | routes: [
16 | { name: 'home', path: '/', component: main },
17 | { name: 'about', path: '/about', component: about }
18 | ]
19 | })
20 |
--------------------------------------------------------------------------------
/www/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | const state = {
7 | msg: 'hello from Vuex'
8 | }
9 |
10 | const modules = { }
11 | const mutations = { }
12 | const getters = { }
13 | const actions = { }
14 |
15 | export default new Vuex.Store({
16 | state,
17 | modules,
18 | mutations,
19 | getters,
20 | actions
21 | })
22 |
--------------------------------------------------------------------------------
/www/src/views/about.vue:
--------------------------------------------------------------------------------
1 |
2 |