diff --git a/www/css/main.diary.css b/www/css/main.diary.css index 99107cb2c..99919d6a2 100644 --- a/www/css/main.diary.css +++ b/www/css/main.diary.css @@ -37,8 +37,8 @@ color:whitesmoke !important; } .angular-leaflet-map { - width: 200px; - height: 150px; + width: 300px; + height: 150px; } @@ -55,7 +55,7 @@ } a.item-content { padding: 0 !important; - background-color: #eeeeee !important; + background-color: transparent !important; } .leaflet-div-icon { background-color: white; @@ -67,11 +67,11 @@ a.item-content { border-color: white; } .leaflet-div-icon-start { - background-color: #72b026; + background-color: #33e0bb; border-radius: 6px; } .leaflet-div-icon-stop { - background-color: #d63e2a; + background-color: #ff5251; border-radius: 6px; } .inner-icon { diff --git a/www/css/style.css b/www/css/style.css index 3e9d6cdc8..748a2f8ea 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -4,4 +4,241 @@ border: 0px !important; border-color: transparent !important; border-top: transparent !important; border-bottom: transparent !important; -background-image: none !important; } \ No newline at end of file +background-image: none !important; } + +.list .item.item-accordion { + line-height: 38px; + padding-top: 0; + padding-bottom: 0; + transition: 0.09s all linear; +} +.list .item.item-accordion.ng-hide { + line-height: 0px; +} +.list .item.item-accordion.ng-hide-add, +.list .item.item-accordion.ng-hide-remove { + display: block !important; +} +.input-label { + font-size: 16px; +} +.list { + padding-top: 0.5px !important; +} +.card { + background: #fff; + border-radius: 2px; + display: inline-block; + height: 275px; + margin: 1rem; + position: relative; + width: 300px; +} +/* Dark theme */ +/* +.tab-nav{ + background-color: #212121 !important; background-size: 0 !important; +} +ion-header-bar { + background-color: #212121 !important; +} +.ion-view-background{ + background-color: #303030 !important; +} +.tabs-custom-dark > .tabs, +.tabs.tabs-custom-dark { + border-color: #5D3A23; + background-color: #5D3A23; + background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 30%); + color: #33e0bb; } + .tabs-custom-dark > .tabs .tab-item .badge, + .tabs.tabs-custom-dark .tab-item .badge { + background-color: #33e0bb; + color: #387ef5; } + +.tabs-striped.tabs-custom-dark .tabs { + background-color: #5D3A23; } + +.tabs-striped.tabs-custom-dark .tab-item { + color: rgba(255, 255, 255, 0.3); + opacity: 1; } + .tabs-striped.tabs-custom-dark .tab-item .badge { + opacity: 0.3; } + .tabs-striped.tabs-custom-dark .tab-item.tab-item-active, .tabs-striped.tabs-custom-dark .tab-item.active, .tabs-striped.tabs-positive .tab-item.activated { + margin-top: -2px; + color: #fff; + border-style: solid; + border-width: 2px 0 0 0; + border-color: #fff; } + +.title.title-center.header-item { + color: white; +} +.date-picker-button-dark { + color: #33e0bb !important; padding: 0 15px; border-color: transparent; margin-top: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.16), 0 2px 2px rgba(0,0,0,0.23); + border-style: solid; border-color: white; border-width: 0px; border-radius: 5px; +} +.date-picker-arrow-dark { + color: rgba(51,224,187, 0.7) !important; margin-top: 4px; background-color: transparent !important; +} + +*/ +/* Dark theme ends */ +/* Light theme */ +.tab-nav{ + background-color: #f5f5f5 !important; background-size: 0 !important; + box-shadow: 0 1px 2px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +.tab-item.tab-item-active, .tab-item.active, .tab-item.activated { + color: #2bb096; +} + +ion-header-bar { + background-color: #f5f5f5 !important; + box-shadow: 0 1px 2px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +.ion-view-background{ + background-color: #FAFAFA !important; +} +.ion-view-background-dark { + background-color: #303030 !important; +} +.tabs-custom > .tabs, +.tabs.tabs-custom { + border-color: #5D3A23; + background-color: #5D3A23; + background-image: linear-gradient(0deg, #0c60ee, #0c60ee 70%, transparent 70%); + color: #999; } + .tabs-custom > .tabs .tab-item .badge, + .tabs.tabs-custom .tab-item .badge { + background-color: #999; + color: #387ef5; } + +.tabs-striped.tabs-custom .tabs { + background-color: #5D3A23; } + +.tabs-striped.tabs-custom .tab-item { + color: rgba(255, 255, 255, 0.7); + opacity: 1; } + .tabs-striped.tabs-custom .tab-item .badge { + opacity: 0.7; } + .tabs-striped.tabs-custom .tab-item.tab-item-active, .tabs-striped.tabs-custom .tab-item.active, .tabs-striped.tabs-positive .tab-item.activated { + margin-top: -2px; + color: #fff; + border-style: solid; + border-width: 2px 0 0 0; + border-color: #fff; } +.title.title-center.header-item { + color: #303030; +} +.date-picker-button { + color: #303030 !important; padding: 0 15px; border-color: transparent; margin-top: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.16), 0 2px 2px rgba(0,0,0,0.23); + border-style: solid; border-color: white; border-width: 0px; border-radius: 5px; +} +.date-picker-arrow { + color: #303030 !important; margin-top: 4px; background-color: transparent !important; +} +/* Light theme ends */ + + +.earlier-later-expand-dark { + color: white; + margin: 16px 16px 0 16px; + font-size: 0.8em; + opacity: 0.7; +} +.earlier-later-expand { + color: #303030; + margin: 16px 16px 0 16px; + font-size: 0.8em; + opacity: 0.7; +} +.list-location { + color: #303030; +} +.list-location-dark { + color: white; +} +p.list-text-dark { + color: white; +} +p.list-text { + color: #303030; +} +a.list-text-dark { + color: white; +} +a.list-text { + color: #303030; +} +.tab-item .icon { + margin: 3px auto 1px auto; + font-size: 25px; + height: 25px; + +} + +.card-1 { + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); + transition: all 0.3s cubic-bezier(.25,.8,.25,1); +} + +.card-1:hover { + box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); +} + +.card-2 { + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} + +.card-3 { + box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); +} + +.card-4 { + box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); +} + +.card-5 { + box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22); +} + +button.button.ng-binding { + font-size: 15px; +} +button.button.ng-binding i.icon.ion-edit { + font-size: 12px; +} +button.button.back-button.buttons.button-clear.header-item { + color: #fff; +} + +/* Profile tab */ +.control-list-item { + background-color: white! important; height: 50px; margin-top: 0.5px; +} +.control-list-text { + background-color: white! important; padding: 15px; float: left; +} +.control-list-toggle { + float: right; margin-top: 5px; margin-right: 2px; +} +/* Diary list tab */ + +.dev-zone-input { + padding: 7px 0; font-size: 16px; line-height: 22px; height: 36px; +} +.dev-zone-title { + padding: 18px 22px; +} +.dev-zone-button { + position: absolute; + right: 16px; + top: 16px; +} +.list-card-dark { + margin: 16px; background-color: #424242; box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +.list-card { + margin: 16px; background-color: #fff; box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} \ No newline at end of file diff --git a/www/img/avatar_1.png b/www/img/avatar_1.png new file mode 100644 index 000000000..d4ff83f76 Binary files /dev/null and b/www/img/avatar_1.png differ diff --git a/www/index.html b/www/index.html index 2684abd93..3245ab445 100644 --- a/www/index.html +++ b/www/index.html @@ -67,7 +67,7 @@ - + diff --git a/www/js/controllers.js b/www/js/controllers.js index 51a51d465..670cceef9 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -22,6 +22,13 @@ angular.module('emission.controllers', []) console.log("Checking to see whether we are ready to load the screen"); if (window.plugins && window.plugins.appPreferences) { var prefs = plugins.appPreferences; + prefs.fetch('dark_theme').then(function(value) { + if (value == true) { + $rootScope.dark_theme = true; + } else { + $rootScope.dark_theme = false; + } + }); prefs.fetch('setup_complete').then(function(value) { console.log('setup_complete result '+value); if (value == true) { diff --git a/www/js/diary/list.js b/www/js/diary/list.js index c4d7d657a..f06d6874b 100644 --- a/www/js/diary/list.js +++ b/www/js/diary/list.js @@ -3,14 +3,17 @@ angular.module('emission.main.diary.list',['ui-leaflet', 'nvd3ChartDirectives', 'emission.main.common.services', 'emission.services']) -.controller("DiaryListCtrl", function($window, $scope, $ionicPlatform, $state, +.controller("DiaryListCtrl", function($window, $scope, $rootScope, $ionicPlatform, $state, $ionicScrollDelegate, $ionicPopup, $ionicLoading, $ionicActionSheet, leafletData, Timeline, CommonGraph, DiaryHelper, Config) { console.log("controller DiaryListCtrl called"); - + // Add option + // StatusBar.styleBlackOpaque() + $scope.dark_theme = $rootScope.dark_theme; + StatusBar.styleDefault(); var readAndUpdateForDay = function(day) { // This just launches the update. The update can complete in the background // based on the time when the database finishes reading. @@ -59,6 +62,25 @@ angular.module('emission.main.diary.list',['ui-leaflet', 'nvd3ChartDirectives', * setHours here, while the currDay is a moment, since we use it to perform * +date and -date operations. */ + $scope.listExpandClass = function () { + return ($scope.dark_theme)? "earlier-later-expand-dark" : "earlier-later-expand"; + } + $scope.listLocationClass = function() { + return ($scope.dark_theme)? "item item-icon-left list-location-dark" : "item item-icon-left list-location"; + + } + $scope.listTextClass = function() { + return ($scope.dark_theme)? "list-text-dark" : "list-text"; + } + $scope.ionViewBackgroundClass = function() { + return ($scope.dark_theme)? "ion-view-background-dark" : "ion-view-background"; + } + $scope.datePickerClass = function() { + + } + $scope.listCardClass = function() { + return ($scope.dark_theme)? "list card list-card-dark" : "list card list-card"; + } $scope.setCurrDay = function(val) { if (typeof(val) === 'undefined') { @@ -155,7 +177,9 @@ angular.module('emission.main.diary.list',['ui-leaflet', 'nvd3ChartDirectives', */ $scope.refresh = function() { + if ($ionicScrollDelegate.getScrollPosition().top < 5) { readAndUpdateForDay(Timeline.data.currDay); + } } /* For UI control */ @@ -194,6 +218,13 @@ angular.module('emission.main.diary.list',['ui-leaflet', 'nvd3ChartDirectives', $scope.starColor = DiaryHelper.starColor; $scope.arrowColor = DiaryHelper.arrowColor; $scope.getArrowClass = DiaryHelper.getArrowClass; + $scope.getStartTimeTagStyle = DiaryHelper.getStartTimeTagStyle; + $scope.getStopTimeTagStyle = DiaryHelper.getStopTimeTagStyle; + $scope.isCommon = DiaryHelper.isCommon; + // $scope.expandEarlierOrLater = DiaryHelper.expandEarlierOrLater; + // $scope.increaseRestElementsTranslate3d = DiaryHelper.increaseRestElementsTranslate3d; + + $scope.userModes = [ "walk", "bicycle", "car", "bus", "train", "unicorn" ]; @@ -207,9 +238,6 @@ angular.module('emission.main.diary.list',['ui-leaflet', 'nvd3ChartDirectives', }; - $scope.getTripHeightPixels = function(trip) { - return "400px"; - }; $scope.prevDay = function() { console.log("Called prevDay when currDay = "+Timeline.data.currDay.format('YYYY-MM-DD')); diff --git a/www/js/diary/services.js b/www/js/diary/services.js index 5a7fadc9b..6985bcbd3 100644 --- a/www/js/diary/services.js +++ b/www/js/diary/services.js @@ -3,6 +3,99 @@ angular.module('emission.main.diary.services', ['emission.services']) .factory('DiaryHelper', function(Timeline, CommonGraph){ var dh = {}; + // dh.expandEarlierOrLater = function(id) { + // document.querySelector('#hidden-' + id.toString()).setAttribute('style', 'display: block;'); + // dh.increaseRestElementsTranslate3d(id); + // } + // dh.increaseRestElementsTranslate3d = function(id) { + // var handle = document.querySelector('#hidden-' + id.toString()); + // var arr = handle.parentElement.parentElement.parentElement.style.transform.split(','); + // var oldVal = parseInt(arr[1].substring(1, arr[1].length - 2)); + // var newVal = oldVal + 40; + + // var oldVal1 = parseInt(handle.parentElement.parentElement.parentElement.style.height); + // var oldVal2 = parseInt(handle.parentElement.parentElement.parentElement.style.width); + // arr[1] = newVal.toString(); + // document.querySelector('#hidden-' + id.toString()).parentElement.parentElement.parentElement + // .setAttribute('style', 'transform: '+arr.join(',')); + // document.querySelector('#hidden-' + id.toString()).parentElement.parentElement.parentElement + // .setAttribute('style', 'height: '+oldVal1); + // document.querySelector('#hidden-' + id.toString()).parentElement.parentElement.parentElement + // .setAttribute('style', 'width: '+oldVal2); + // } + dh.isCommon = function(id) { + var ctrip = CommonGraph.findCommon(id); + return !angular.isUndefined(ctrip); + } + dh.getStartTimeTagStyle = function(id) { + var ctrip = CommonGraph.findCommon(id); + if (angular.isUndefined(ctrip)) { + return { + 'box-shadow': '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)', + 'text-align': 'center', + 'background-color': '#33e0bb', + 'color': 'black', + 'width': '48px', + 'height': '16px', + 'border-radius': '8px', + 'font-size': '9px', + 'position': 'absolute', + 'left': '-11%', + 'top': '15px', + 'line-height': '16px' + } + } else { + return { + 'box-shadow': '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)', + 'text-align': 'center', + 'background-color': '#33e0bb', + 'color': 'black', + 'width': '48px', + 'height': '30px', + 'border-radius': '8px', + 'font-size': '9px', + 'position': 'absolute', + 'left': '-11%', + 'top': '15px', + 'line-height': '9px', + 'padding-top': '7px' + } + } + } + dh.getStopTimeTagStyle = function(id) { + var ctrip = CommonGraph.findCommon(id); + if (angular.isUndefined(ctrip)) { + return { + 'box-shadow': '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)', + 'text-align': 'center', + 'background-color': '#ff5251', + 'color': 'black', + 'width': '48px', + 'height': '16px', + 'border-radius': '8px', + 'font-size': '9px', + 'position': 'absolute', + 'left': '-11%', + 'top': '275px', + 'line-height': '16px' + } + } else { + return { + 'box-shadow': '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)', + 'text-align': 'center', + 'background-color': '#ff5251', + 'color': 'black', + 'width': '48px', + 'height': '16px', + 'border-radius': '8px', + 'font-size': '9px', + 'position': 'absolute', + 'left': '-11%', + 'top': '310px', + 'line-height': '16px' + } + } + } dh.getIcon = function(section) { var icons = {"BICYCLING":"ion-android-bicycle", "WALKING":" ion-android-walk", @@ -183,9 +276,9 @@ angular.module('emission.main.diary.services', ['emission.services']) if (pn == 0) { return 'transparent'; } else if (pn == -1) { - return '#72b026'; + return '#33e0bb'; } else { - return '#d63e2a'; + return '#ff5251'; } } dh.parseEarlierOrLater = function(val) { diff --git a/www/js/main.js b/www/js/main.js index 0089fe01f..d908e102b 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -1,8 +1,8 @@ 'use strict'; -angular.module('emission.main', ['emission.main.diary', 'emission.main.common', 'emission.main.recent', 'emission.main.heatmap']) +angular.module('emission.main', ['emission.main.recent', 'emission.main.diary', 'emission.main.common', 'emission.main.heatmap', 'ngCordova', 'emission.services']) -.config(function($stateProvider, $ionicConfigProvider) { +.config(function($stateProvider, $ionicConfigProvider, $urlRouterProvider) { $stateProvider // setup an abstract state for the tabs directive .state('root.main', { @@ -32,16 +32,6 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', } }) - .state('root.main.recent', { - url: '/recent', - abstract: true, - views: { - 'main-recent': { - templateUrl: 'templates/main-recent.html', - controller: 'MainCtrl' - } - } - }) .state('root.main.control', { url: '/control', views: { @@ -50,19 +40,92 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', controller: 'ControlCtrl' } } + }) + .state('root.main.sensed', { + url: "/sensed", + views: { + 'main-control': { + templateUrl: "templates/recent/sensedData.html", + controller: 'sensedDataCtrl' + } + } + }) + .state('root.main.map', { + url: "/map", + views: { + 'main-control': { + templateUrl: "templates/recent/map.html", + controller: 'mapCtrl' + } + } + }) + .state('root.main.log', { + url: '/log', + views: { + 'main-control': { + templateUrl: 'templates/recent/log.html', + controller: 'logCtrl' + } + } + }); $ionicConfigProvider.tabs.style('standard') $ionicConfigProvider.tabs.position('bottom'); }) +.controller('appCtrl', function($scope, $ionicModal, $timeout) { + $scope.openNativeSettings = function() { + window.Logger.log(window.Logger.LEVEL_DEBUG, "about to open native settings"); + window.cordova.plugins.BEMLaunchNative.launch("NativeSettings", function(result) { + window.Logger.log(window.Logger.LEVEL_DEBUG, + "Successfully opened screen NativeSettings, result is "+result); + }, function(err) { + window.Logger.log(window.Logger.LEVEL_ERROR, + "Unable to open screen NativeSettings because of err "+err); + }); + } +}) -.controller('MainCtrl', function($scope, $state) { +.controller('MainCtrl', function($scope, $state, $rootScope) { // Currently this is blank since it is basically a placeholder for the // three screens. But we can totally add hooks here if we want. It is the // controller for all the screens because none of them do anything for now. + $scope.dark_theme = $rootScope.dark_theme; + $scope.tabsCustomClass = function() { + return ($scope.dark_theme)? "tabs-icon-top tabs-custom-dark" : "tabs-icon-top tabs-custom"; + } }) -.controller('ControlCtrl', function($scope, $state, $ionicPopup, $ionicActionSheet, $ionicPopover) { +.controller('ControlCtrl', function($scope, $window, $ionicScrollDelegate, $state, $ionicPopup, $ionicActionSheet, $ionicPopover, $rootScope) { + $scope.dark_theme = $rootScope.dark_theme; + $scope.ionViewBackgroundClass = function() { + return ($scope.dark_theme)? "ion-view-background-dark" : "ion-view-background"; + } + $scope.toggleDarkTheme = function() { + return $scope.dark_theme; + } + $scope.willUseDarkTheme = function() { + if ($scope.dark_theme) { + $rootScope.dark_theme = false; + $scope.dark_theme = false; + if (window.plugins && window.plugins.appPreferences) { + var prefs = plugins.appPreferences; + prefs.store('dark_theme', false); + } + // StatusBar.styleDefault(); + + } else { + $rootScope.dark_theme = true; + $scope.dark_theme = true; + if (window.plugins && window.plugins.appPreferences) { + var prefs = plugins.appPreferences; + prefs.store('dark_theme', true); + } + // StatusBar.style(2); + } + $ionicPopup.alert({template: 'Restart the app to see all changes!'}) + } + $scope.getConnectURL = function() { window.cordova.plugins.BEMConnectionSettings.getSettings(function(result) { $scope.$apply(function() { @@ -99,24 +162,22 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', }); }; - $scope.getSyncSettings = function() { - var promiseList = [] - promiseList.push(window.cordova.plugins.BEMServerSync.getConfig()); - - Promise.all(promiseList).then(function(resultList) { - var config = resultList[0]; - var accuracyOptions = resultList[1]; - $scope.settings.sync.config = config; - var retVal = []; - for (var prop in config) { - retVal.push({'key': prop, 'val': config[prop]}); - } - $scope.$apply(function() { - $scope.settings.sync.show_config = retVal; - }); - }); + $scope.getSyncSettings = function() { + var promiseList = [] + promiseList.push(window.cordova.plugins.BEMServerSync.getConfig()); + Promise.all(promiseList).then(function(resultList) { + var config = resultList[0]; + var accuracyOptions = resultList[1]; + $scope.settings.sync.config = config; + var retVal = []; + for (var prop in config) { + retVal.push({'key': prop, 'val': config[prop]}); + } + $scope.$apply(function() { + $scope.settings.sync.show_config = retVal; + }); + }); }; - $scope.getEmail = function() { /* return new Promise(function(resolve, reject) { @@ -140,7 +201,15 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', $ionicPopup.alert("while getting email, "+error); }); }; - + $scope.showLog = function() { + $state.go("root.main.log"); + } + $scope.showSensed = function() { + $state.go("root.main.sensed"); + } + $scope.showMap = function() { + $state.go("root.main.map"); + } $scope.getState = function() { /* return new Promise(function(resolve, reject) { @@ -169,7 +238,7 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', $scope.getConnectURL(); $scope.getCollectionSettings(); - $scope.getSyncSettings(); + $scope.getSyncSettings(); $scope.getEmail(); $scope.getState(); }; @@ -225,7 +294,6 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', } }); }; - $scope.editCollectionConfig = function($event) { $scope.settings.collect.new_config = JSON.parse(JSON.stringify($scope.settings.collect.config)); console.log("settings popup = "+$scope.collectSettingsPopup); @@ -267,11 +335,10 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', .then($scope.getSyncSettings); $scope.syncSettingsPopup.hide(); }; - // Execute action on hide popover $scope.$on('$destroy', function() { $scope.collectSettingsPopup.remove(); - $scope.syncSettingsPopup.remove(); + $scope.syncSettingsPopup.remove(); }); $scope.setAccuracy= function() { @@ -289,26 +356,23 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', } }); }; - - $scope.setSyncInterval = function() { - var syncIntervalActions = []; - syncIntervalActions.push({text: "1 min", value: 60}); - syncIntervalActions.push({text: "10 min", value: 10 * 60}); - syncIntervalActions.push({text: "30 min", value: 30 * 60}); - syncIntervalActions.push({text: "1 hr", value: 60 * 60}); - - $ionicActionSheet.show({ - buttons: syncIntervalActions, - titleText: "Select sync interval", - cancelText: "Cancel", - buttonClicked: function(index, button) { - $scope.settings.sync.new_config.sync_interval = button.value; - return true; - } - }); + $scope.setSyncInterval = function() { + var syncIntervalActions = []; + syncIntervalActions.push({text: "1 min", value: 60}); + syncIntervalActions.push({text: "10 min", value: 10 * 60}); + syncIntervalActions.push({text: "30 min", value: 30 * 60}); + syncIntervalActions.push({text: "1 hr", value: 60 * 60}); + $ionicActionSheet.show({ + buttons: syncIntervalActions, + titleText: "Select sync interval", + cancelText: "Cancel", + buttonClicked: function(index, button) { + $scope.settings.sync.new_config.sync_interval = button.value; + return true; + } + }); }; - $scope.isAndroid = function() { return ionic.Platform.isAndroid(); } @@ -323,10 +387,86 @@ angular.module('emission.main', ['emission.main.diary', 'emission.main.common', }).then(function(popover) { $scope.collectSettingsPopup = popover; }); - - $ionicPopover.fromTemplateUrl('templates/control/main-sync-settings.html', { - scope: $scope - }).then(function(popover) { - $scope.syncSettingsPopup = popover; + $ionicPopover.fromTemplateUrl('templates/control/main-sync-settings.html', { + scope: $scope + }).then(function(popover) { + $scope.syncSettingsPopup = popover; }); -}); + $scope.trackingOn = function() { + return $scope.settings.collect.state != "STATE_TRACKING_STOPPED"; + } + $scope.userStartStopTracking = function() { + if ($scope.startStopBtnToggle){ + $scope.forceTransition('STOP_TRACKING'); + $scope.startStopBtnToggle = false; + } else { + $scope.forceTransition('START_TRACKING'); + $scope.startStopBtnToggle = true; + } + } + $scope.startStopBtnToggle = $scope.trackingOn(); + $scope.getAvatarStyle = function() { + return { + 'width': ($window.screen.width * 0.30).toString() + 'px', + 'height': ($window.screen.width * 0.30).toString() + 'px', + 'border-radius': ($window.screen.width * 0.15).toString() + 'px', + 'margin-top': ($window.screen.width * 0.1).toString() + 'px', + 'margin-bottom': ($window.screen.width * 0.1).toString() + 'px', + 'border-style': 'solid', + 'border-width': '7px', + 'border-color': '#fff' + } + } + $scope.getButtonStyle = function(color) { + return { + 'text-align': 'center', + 'float': 'right', + 'height': '100%', + 'background-color': '#' + color, + 'color': '#fff', + 'padding': '15px 15px', + 'width': + ($window.screen.width * 0.25).toString() + 'px' + } + } + $scope.getIconButtonStyle = function(color) { + return { + 'text-align': 'center', + 'float': 'right', + 'height': '100%', + 'background-color': '#' + color, + 'color': '#fff', + 'padding': '15px 15px', + 'width': '50px' + } + } + $scope.getIconStyle = function() { + return { + 'font-size': '20px' + } + } + $scope.getExpandButtonClass = function() { + return ($scope.expanded)? "icon ion-ios-arrow-up" : "icon ion-ios-arrow-down"; + } + $scope.parseState = function(state) { + if (state) { + return state.substring(6); + } + } + $scope.toggleCollection = function() { + if ($scope.collectionExpanded()) { + $scope.expanded = false; + $ionicScrollDelegate.resize(); + $ionicScrollDelegate.scrollTo(0, 0, true); + + } else { + $scope.expanded = true; + $ionicScrollDelegate.resize(); + $ionicScrollDelegate.scrollTo(0, 1000, true); + + + } + } + $scope.collectionExpanded = function() { + return $scope.expanded; + } +}); \ No newline at end of file diff --git a/www/js/recent.js b/www/js/recent.js index 97d8f37a5..08913d7a5 100644 --- a/www/js/recent.js +++ b/www/js/recent.js @@ -1,37 +1,5 @@ angular.module('emission.main.recent', ['ngCordova', 'emission.services']) -.config(function($stateProvider, $urlRouterProvider) { - $stateProvider - // The root (root/main/recent) is configured in the main module - .state('root.main.recent.log', { - url: "/log", // /root/main/recent/log - views: { - 'menuContent': { - templateUrl: "templates/recent/log.html", - controller: 'logCtrl' - } - } - }) - - .state('root.main.recent.sensedData', { - url: "/sensedData", - views: { - 'menuContent': { - templateUrl: "templates/recent/sensedData.html", - controller: 'sensedDataCtrl' - } - } - }) - .state('root.main.recent.map', { - url: "/map", - views: { - 'menuContent': { - templateUrl: "templates/recent/map.html", - controller: 'mapCtrl' - } - } - }); -}) .controller('appCtrl', function($scope, $ionicModal, $timeout) { $scope.openNativeSettings = function() { diff --git a/www/templates/control/main-collect-settings.html b/www/templates/control/main-collect-settings.html index 8c5730527..9d3c7c53b 100644 --- a/www/templates/control/main-collect-settings.html +++ b/www/templates/control/main-collect-settings.html @@ -1,42 +1,49 @@ - - + + - + + Duty Cycling Simulate User - + + Use Visit Notifications Sync on remote push diff --git a/www/templates/control/main-control.html b/www/templates/control/main-control.html index 243288717..d0e52bf84 100644 --- a/www/templates/control/main-control.html +++ b/www/templates/control/main-control.html @@ -1,5 +1,5 @@ - -
+ + + + + + +
+
{{settings.auth.email}}
+
-
-
- Connection -
-
- {{settings.connect.url}} -
+
+
Tracking
+
-
-
-
- Collection +
+
Force sync
+
+
+
+
Dark theme
+ + + +
+
+
Developer zone
+
+
+ + +
+
+
{{parseState(settings.collect.state)}}
+
+
+
Check log
+
+
+
+
Check sensed data
+
+
+
+
Check map
+
+
+ +
+
Collection
+
+
+ -
{{entry.key}}
-
{{entry.val}}
+
{{entry.key}}
+
{{entry.val}}
-
+ +
host
+
{{settings.connect.url}}
+
+ + +
+
Sync
+
+ +
{{entry.key}}
+
{{entry.val}}
+
+
-
+ + diff --git a/www/templates/control/main-sync-settings.html b/www/templates/control/main-sync-settings.html index 9342b2318..7568ae21f 100644 --- a/www/templates/control/main-sync-settings.html +++ b/www/templates/control/main-sync-settings.html @@ -1,12 +1,13 @@ - - +> + - + -
Sync Interval (secs)
-
diff --git a/www/templates/diary/detail.html b/www/templates/diary/detail.html index d4f16c8d6..d76d868c0 100644 --- a/www/templates/diary/detail.html +++ b/www/templates/diary/detail.html @@ -3,20 +3,20 @@
-
{{getFormattedTime(tripgj.data.properties.start_ts)}}
+
{{getFormattedTime(tripgj.data.properties.start_ts)}}
{{parseEarlierOrLater(getEarlierOrLater(tripgj.data.properties.start_ts, tripgj.data.id))}}
-
{{getFormattedTime(tripgj.data.properties.end_ts)}} +
{{getFormattedTime(tripgj.data.properties.end_ts)}}
-
+
{{tripgj.start_place.properties.displayName.split(',')[0]}}
-
+
{{tripgj.end_place.properties.displayName.split(',')[0]}}
@@ -28,9 +28,9 @@
-
-

Distance

{{getFormattedDistance(trip.properties.distance)}} km
-

Time

{{getFormattedTimeRange(trip.properties.end_ts, trip.properties.start_ts)}}
+
+

Distance

{{getFormattedDistance(trip.properties.distance)}} km
+

Time

{{getFormattedTimeRange(trip.properties.end_ts, trip.properties.start_ts)}}

diff --git a/www/templates/diary/list.html b/www/templates/diary/list.html index fb26c0a70..dbac973d5 100644 --- a/www/templates/diary/list.html +++ b/www/templates/diary/list.html @@ -1,19 +1,22 @@ - -
-
- - - - - - - + + + + +
-
- + +
+ + + -
- - -
- -
- -
-
{{getFormattedTime(tripgj.data.properties.start_ts)}}
-
{{parseEarlierOrLater(getEarlierOrLater(tripgj.data.properties.start_ts, tripgj.data.id))}}
-
{{getFormattedTime(tripgj.data.properties.end_ts)}} -
-
-
+
+
{{getFormattedTime(tripgj.data.properties.start_ts)}} +
+ +
+
+ +
+ {{parseEarlierOrLater(getEarlierOrLater(tripgj.data.properties.start_ts, tripgj.data.id))}} +
-
- - {{tripgj.start_place.properties.displayName.split(',')[0]}} -
-
- - {{tripgj.end_place.properties.displayName.split(',')[0]}} -
+
+ + +
+
+

{{getFormattedDistance(tripgj.data.properties.distance)}} km in {{getFormattedTimeRange(tripgj.data.properties.start_ts, + tripgj.data.properties.end_ts)}}

-
-
+
+
+ +
+ +
+
-
-
- -
-
-
-

Distance

-

{{getFormattedDistance(tripgj.data.properties.distance)}} km

+ + + + + + + + + + +
+
+ + {{tripgj.start_place.properties.displayName.split(',')[0]}} + +
+
+ + {{tripgj.end_place.properties.displayName.split(',')[0]}} +
+
+ + + -
-
- +
{{getFormattedTime(tripgj.data.properties.end_ts)}}
diff --git a/www/templates/main.html b/www/templates/main.html index dfe4badcd..bb7e8e130 100644 --- a/www/templates/main.html +++ b/www/templates/main.html @@ -4,7 +4,7 @@ navigation history that also transitions its views in and out. --> - + @@ -22,12 +22,12 @@ - + - +