initiating the smartphone app
arnaucode arnaucode@gmail.com
Sun, 29 Oct 2017 20:16:07 +0100
80 files changed,
626 insertions(+),
1 deletions(-)
jump to
M
README.md
→
README.md
@@ -1,1 +1,12 @@
-# objectImageIdentifierAI+# objectImageIdentifierAI + +- imagesToDataset + - From two directories ('object' and 'noobject'), gets all the images inside the directories and generates the dataset +- nnTrain + - From the dataset file generated in the previous step, train the Neural Network +- serverPredictor + - Runs a server API, that with the Neural Network classifies the incoming images +- smartphoneApp + - Take photo and upload to the server, to get the response (object or no object) + +
A
smartphoneApp/.editorconfig
@@ -0,0 +1,14 @@
+# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false
A
smartphoneApp/.gitignore
@@ -0,0 +1,7 @@
+# Specifies intentionally untracked files to ignore when using Git +# http://git-scm.com/docs/gitignore + +node_modules/ +platforms/ +plugins/ +www/lib
A
smartphoneApp/README.md
@@ -0,0 +1,26 @@
+Ionic App Base +============== + +A starting project for Ionic that optionally supports using custom SCSS. + +## Using this project + +We recommend using the [Ionic CLI](https://github.com/ionic-team/ionic-cli) to create new Ionic projects that are based on this project but use a ready-made starter template. + +For example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed: + +```bash +$ npm install -g ionic cordova +``` + +Then run: + +```bash +$ ionic start myProject tabs --type=ionic1 +``` + +More info on this can be found on the Ionic [Getting Started](https://ionicframework.com/getting-started) page and the [Ionic CLI](https://github.com/ionic-team/ionic-cli) repo. + +## Issues + +Issues have been disabled on this repo. If you do find an issue or have a question, consider posting it on the [Ionic Forum](https://forum.ionicframework.com/). If there is truly an error, follow our guidelines for [submitting an issue](https://ionicframework.com/submit-issue/) to the main Ionic repository.
A
smartphoneApp/bower.json
@@ -0,0 +1,7 @@
+{ + "name": "HelloIonic", + "private": "true", + "devDependencies": { + "ionic": "ionic-team/ionic-bower#1.3.4" + } +}
A
smartphoneApp/config.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='utf-8'?> +<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> + <name>MyApp</name> + <description>An awesome Ionic/Cordova app.</description> + <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author> + <content src="index.html" /> + <access origin="*" /> + <allow-navigation href="http://ionic.local/*" /> + <allow-intent href="http://*/*" /> + <allow-intent href="https://*/*" /> + <allow-intent href="tel:*" /> + <allow-intent href="sms:*" /> + <allow-intent href="mailto:*" /> + <allow-intent href="geo:*" /> + <preference name="webviewbounce" value="false" /> + <preference name="UIWebViewBounce" value="false" /> + <preference name="DisallowOverscroll" value="true" /> + <preference name="android-minSdkVersion" value="16" /> + <preference name="BackupWebStorage" value="none" /> + <preference name="SplashMaintainAspectRatio" value="true" /> + <preference name="FadeSplashScreenDuration" value="300" /> + + <!-- + Change these to configure how the splashscreen displays and fades in/out. + More info here: https://github.com/apache/cordova-plugin-splashscreen + --> + <preference name="SplashShowOnlyFirstTime" value="false" /> + <preference name="SplashScreen" value="screen" /> + <preference name="SplashScreenDelay" value="3000" /> + + <platform name="android"> + <allow-intent href="market:*" /> + <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" /> + <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" /> + <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" /> + <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" /> + <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" /> + <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" /> + <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" /> + <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" /> + <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" /> + <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" /> + <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" /> + <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" /> + <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" /> + <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" /> + <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" /> + <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" /> + <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" /> + <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" /> + </platform> + <platform name="ios"> + <allow-intent href="itms:*" /> + <allow-intent href="itms-apps:*" /> + <icon height="57" src="resources/ios/icon/icon.png" width="57" /> + <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" /> + <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> + <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" /> + <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" /> + <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> + <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" /> + <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> + <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" /> + <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" /> + <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> + <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" /> + <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> + <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" /> + <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" /> + <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> + <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" /> + <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" /> + <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" /> + <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> + <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> + <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> + <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> + <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" /> + <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" /> + <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> + <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" /> + <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" /> + <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> + <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> + <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> + <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" /> + </platform> + <plugin name="ionic-plugin-keyboard" spec="~2.2.1" /> + <plugin name="cordova-plugin-whitelist" spec="1.3.1" /> + <plugin name="cordova-plugin-statusbar" spec="2.2.1" /> + <plugin name="cordova-plugin-device" spec="1.1.4" /> + <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" /> +</widget>
A
smartphoneApp/gulpfile.js
@@ -0,0 +1,27 @@
+var gulp = require('gulp'); +var sass = require('gulp-sass'); +var cleanCss = require('gulp-clean-css'); +var rename = require('gulp-rename'); + +var paths = { + sass: ['./scss/**/*.scss'] +}; + +gulp.task('default', ['sass']); + +gulp.task('sass', function(done) { + gulp.src('./scss/ionic.app.scss') + .pipe(sass()) + .on('error', sass.logError) + .pipe(gulp.dest('./www/css/')) + .pipe(cleanCss({ + keepSpecialComments: 0 + })) + .pipe(rename({ extname: '.min.css' })) + .pipe(gulp.dest('./www/css/')) + .on('end', done); +}); + +gulp.task('watch', ['sass'], function() { + gulp.watch(paths.sass, ['sass']); +});
A
smartphoneApp/hooks/README.md
@@ -0,0 +1,83 @@
+<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--> +# Cordova Hooks + +This directory may contain scripts used to customize cordova commands. This +directory used to exist at `.cordova/hooks`, but has now been moved to the +project root. Any scripts you add to these directories will be executed before +and after the commands corresponding to the directory name. Useful for +integrating your own build systems or integrating with version control systems. + +__Remember__: Make your scripts executable. + +## Hook Directories +The following subdirectories will be used for hooks: + + after_build/ + after_compile/ + after_docs/ + after_emulate/ + after_platform_add/ + after_platform_rm/ + after_platform_ls/ + after_plugin_add/ + after_plugin_ls/ + after_plugin_rm/ + after_plugin_search/ + after_prepare/ + after_run/ + after_serve/ + before_build/ + before_compile/ + before_docs/ + before_emulate/ + before_platform_add/ + before_platform_rm/ + before_platform_ls/ + before_plugin_add/ + before_plugin_ls/ + before_plugin_rm/ + before_plugin_search/ + before_prepare/ + before_run/ + before_serve/ + pre_package/ <-- Windows 8 and Windows Phone only. + +## Script Interface + +All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: + +* CORDOVA_VERSION - The version of the Cordova-CLI. +* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). +* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) +* CORDOVA_HOOK - Path to the hook that is being executed. +* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) + +If a script returns a non-zero exit code, then the parent cordova command will be aborted. + + +## Writing hooks + +We highly recommend writting your hooks using Node.js so that they are +cross-platform. Some good examples are shown here: + +[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) +
A
smartphoneApp/hooks/after_prepare/010_add_platform_class.js
@@ -0,0 +1,94 @@
+#!/usr/bin/env node + +// Add Platform Class +// v1.0 +// Automatically adds the platform class to the body tag +// after the `prepare` command. By placing the platform CSS classes +// directly in the HTML built for the platform, it speeds up +// rendering the correct layout/style for the specific platform +// instead of waiting for the JS to figure out the correct classes. + +var fs = require('fs'); +var path = require('path'); + +var rootdir = process.argv[2]; + +function addPlatformBodyTag(indexPath, platform) { + // add the platform class to the body tag + try { + var platformClass = 'platform-' + platform; + var cordovaClass = 'platform-cordova platform-webview'; + + var html = fs.readFileSync(indexPath, 'utf8'); + + var bodyTag = findBodyTag(html); + if(!bodyTag) return; // no opening body tag, something's wrong + + if(bodyTag.indexOf(platformClass) > -1) return; // already added + + var newBodyTag = bodyTag; + + var classAttr = findClassAttr(bodyTag); + if(classAttr) { + // body tag has existing class attribute, add the classname + var endingQuote = classAttr.substring(classAttr.length-1); + var newClassAttr = classAttr.substring(0, classAttr.length-1); + newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; + newBodyTag = bodyTag.replace(classAttr, newClassAttr); + + } else { + // add class attribute to the body tag + newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">'); + } + + html = html.replace(bodyTag, newBodyTag); + + fs.writeFileSync(indexPath, html, 'utf8'); + + process.stdout.write('add to body class: ' + platformClass + '\n'); + } catch(e) { + process.stdout.write(e); + } +} + +function findBodyTag(html) { + // get the body tag + try{ + return html.match(/<body(?=[\s>])(.*?)>/gi)[0]; + }catch(e){} +} + +function findClassAttr(bodyTag) { + // get the body tag's class attribute + try{ + return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0]; + }catch(e){} +} + +if (rootdir) { + + // go through each of the platform directories that have been prepared + var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); + + for(var x=0; x<platforms.length; x++) { + // open up the index.html file at the www root + try { + var platform = platforms[x].trim().toLowerCase(); + var indexPath; + + if(platform == 'android') { + indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html'); + } else { + indexPath = path.join('platforms', platform, 'www', 'index.html'); + } + + if(fs.existsSync(indexPath)) { + addPlatformBodyTag(indexPath, platform); + } + + } catch(e) { + process.stdout.write(e); + } + } + +}
A
smartphoneApp/ionic.config.json
@@ -0,0 +1,11 @@
+{ + "name": "smartphoneApp", + "app_id": "", + "type": "ionic1", + "integrations": { + "gulp": {} + }, + "watchPatterns": [ + "scss/**/*" + ] +}
A
smartphoneApp/package.json
@@ -0,0 +1,11 @@
+{ + "name": "smartphoneApp", + "version": "0.0.1", + "description": "An Ionic project", + "devDependencies": { + "gulp": "^3.5.6", + "gulp-clean-css": "^3.7.0", + "gulp-rename": "^1.2.0", + "gulp-sass": "^3.1.0" + } +}
A
smartphoneApp/resources/README.md
@@ -0,0 +1,8 @@
+These are Cordova resources. You can replace icon.png and splash.png and run +`ionic cordova resources` to generate custom icons and splash screens for your +app. See `ionic cordova resources --help` for details. + +Cordova reference documentation: + +- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html +- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
A
smartphoneApp/scss/ionic.app.scss
@@ -0,0 +1,23 @@
+/* +To customize the look and feel of Ionic, you can override the variables +in ionic's _variables.scss file. + +For example, you might change some of the default colors: + +$light: #fff !default; +$stable: #f8f8f8 !default; +$positive: #387ef5 !default; +$calm: #11c1f3 !default; +$balanced: #33cd5f !default; +$energized: #ffc900 !default; +$assertive: #ef473a !default; +$royal: #886aea !default; +$dark: #444 !default; +*/ + +// The path for our ionicons font files, relative to the built CSS in www/css +$ionicons-font-path: "../lib/ionic/fonts" !default; + +// Include all of Ionic +@import "www/lib/ionic/scss/ionic"; +
A
smartphoneApp/www/README.md
@@ -0,0 +1,32 @@
+This is an addon starter template for the [Ionic Framework](http://ionicframework.com/). + +## How to use this template + +*This template does not work on its own*. It is missing the Ionic library, and AngularJS. + +To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately. + +### With the Ionic tool: + +Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below: + +```bash +$ sudo npm install -g ionic cordova +$ ionic start myApp sidemenu +``` + +Then, to run it, cd into `myApp` and run: + +```bash +$ ionic platform add ios +$ ionic build ios +$ ionic emulate ios +``` + +Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android. + +## Demo +http://plnkr.co/edit/0RXSDB?p=preview + +## Issues +Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here!
A
smartphoneApp/www/index.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> + <title></title> + + <link rel="manifest" href="manifest.json"> + + <!-- un-comment this code to enable service worker + <script> + if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('service-worker.js') + .then(() => console.log('service worker installed')) + .catch(err => console.log('Error', err)); + } + </script>--> + + <link href="lib/ionic/css/ionic.css" rel="stylesheet"> + <link href="css/style.css" rel="stylesheet"> + + <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above + <link href="css/ionic.app.css" rel="stylesheet"> + --> + + <!-- ionic/angularjs js --> + <script src="lib/ionic/js/ionic.bundle.js"></script> + + <!-- cordova script (this will be a 404 during development) --> + <script src="cordova.js"></script> + + <!-- your app's js --> + <script src="js/app.js"></script> + <script src="js/main.js"></script> + <script src="js/menu.js"></script> + </head> + + <body ng-app="app"> + <ion-nav-view></ion-nav-view> + </body> +</html>
A
smartphoneApp/www/js/app.js
@@ -0,0 +1,44 @@
+ +angular.module('app', [ + 'ionic', + 'app.main', + 'app.menu' +]) + + .run(function($ionicPlatform) { + $ionicPlatform.ready(function() { + // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard + // for form inputs) + if (window.cordova && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + cordova.plugins.Keyboard.disableScroll(true); + + } + if (window.StatusBar) { + // org.apache.cordova.statusbar required + StatusBar.styleDefault(); + } + }); + }) + + .config(function($stateProvider, $urlRouterProvider) { + $stateProvider + + .state('app', { + url: '/app', + abstract: true, + templateUrl: 'templates/menu.html', + controller: 'MenuCtrl' + }) + + .state('app.main', { + url: '/main', + views: { + 'menuContent': { + templateUrl: 'templates/main.html' + } + } + }); + // if none of the above states are matched, use this as the fallback + $urlRouterProvider.otherwise('/app/main'); + });
A
smartphoneApp/www/js/main.js
@@ -0,0 +1,5 @@
+angular.module('app.main', []) + +.controller('MainCtrl', function($scope) { + +});
A
smartphoneApp/www/manifest.json
@@ -0,0 +1,12 @@
+ +{ + "name": "My Ionic App", + "short_name": "My Ionic App", + "start_url": "index.html", + "display": "standalone", + "icons": [{ + "src": "icon.png", + "sizes": "512x512", + "type": "image/png" + }] +}
A
smartphoneApp/www/service-worker.js
@@ -0,0 +1,12 @@
+ +self.addEventListener('activate', function (event) { + +}); + +self.addEventListener('fetch', function (event) { + +}); + +self.addEventListener('push', function (event) { + +});
A
smartphoneApp/www/templates/main.html
@@ -0,0 +1,26 @@
+<ion-view view-title="Hotdog - No Hotdog App"> + <ion-content> + <div class="row"> + <div class="col"> + <div class="button button-full button-stable"> + <i class="icon ion-camera"></i> Take Photo + </div> + </div> + <div class="col"> + <div class="button button-full button-stable"> + <i class="icon ion-image"></i> From Gallery + </div> + </div> + </div> + + <div class="list card"> + <div class="item item-image"> + <img src="http://www.trueactivist.com/wp-content/uploads/2015/07/hotdog-300x300.jpg"> + </div> + <a class="item item-icon-left balanced" href="#"> + <i class="icon ion-checkmark"></i> + Is a Hotdog + </a> + </div> + </ion-content> +</ion-view>