1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 19:42:01 +02:00

Added Ringer Mode Setting UI.

This commit is contained in:
Gunther Brunner 2014-08-25 15:00:33 +09:00
parent 019a2499e9
commit dbd48aaab4
4 changed files with 42 additions and 7 deletions

View file

@ -1,7 +1,6 @@
require('./input.css') require('./input.css')
module.exports = angular.module('stf.advanced.input', [ module.exports = angular.module('stf.advanced.input', [
require('stf/keycodes').name
]) ])
.run(["$templateCache", function ($templateCache) { .run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/advanced/input/input.jade', $templateCache.put('control-panes/advanced/input/input.jade',

View file

@ -1,4 +1,4 @@
module.exports = function InputCtrl($scope, KeycodesAndroid) { module.exports = function InputCtrl($scope) {
$scope.press = function (key) { $scope.press = function (key) {
$scope.control.keyPress(key) $scope.control.keyPress(key)

View file

@ -1,7 +1,7 @@
module.exports = function DeviceSettingsCtrl($scope, $timeout) { module.exports = function DeviceSettingsCtrl($scope, $timeout) {
$scope.wifiEnabled = true $scope.wifiEnabled = true
var getWifiStatus = function () { function getWifiStatus() {
if ($scope.control) { if ($scope.control) {
$scope.control.getWifiStatus().then(function (result) { $scope.control.getWifiStatus().then(function (result) {
$scope.$apply(function () { $scope.$apply(function () {
@ -9,7 +9,6 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) {
}) })
}) })
} }
} }
getWifiStatus() getWifiStatus()
@ -17,7 +16,28 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) {
if ($scope.control) { if ($scope.control) {
$scope.control.setWifiEnabled(!$scope.wifiEnabled) $scope.control.setWifiEnabled(!$scope.wifiEnabled)
$scope.wifiEnabled = !$scope.wifiEnabled $scope.wifiEnabled = !$scope.wifiEnabled
$timeout(getWifiStatus, 500) $timeout(getWifiStatus, 300)
$timeout(getWifiStatus, 2500)
} }
} }
$scope.$watch('ringerMode', function (newValue, oldValue) {
if (oldValue) {
if ($scope.control) {
$scope.control.setRingerMode(newValue)
}
}
})
function getRingerMode() {
if ($scope.control) {
$scope.control.getRingerMode().then(function (result) {
$scope.$apply(function () {
$scope.ringerMode = result.body
})
})
}
}
getRingerMode()
} }

View file

@ -6,5 +6,21 @@
button.btn.btn-sm.btn-primary-outline(ng-click='toggleWifi()', button.btn.btn-sm.btn-primary-outline(ng-click='toggleWifi()',
ng-model='wifiEnabled', btn-checkbox) ng-model='wifiEnabled', btn-checkbox)
i.fa.fa-signal(ng-show='wifiEnabled', tooltip='{{"Disable WiFi" | translate}}', tooltip-placement='bottom') i.fa.fa-signal.fa-fw(ng-show='wifiEnabled', tooltip='{{"Disable WiFi" | translate}}')
i.fa.fa-signal(ng-hide='wifiEnabled', tooltip='{{"Enable WiFi" | translate}}', tooltip-placement='bottom') i.fa.fa-signal.fa-fw(ng-hide='wifiEnabled', tooltip='{{"Enable WiFi" | translate}}')
//.btn-group
label.btn.btn-sm.btn-primary-outline(ng-model='wifiEnabled', btn-radio='false')
span.fa-stack.fa-lgx
i.fa.fa-signal.fa-stack-1x
i.fa.fa-ban.fa-stack-2x
label.btn.btn-sm.btn-primary-outline(ng-model='wifiEnabled', btn-radio='true')
i.fa.fa-signal.fa-fw(tooltip='{{"WiFi Enabled" | translate}}')
.btn-group
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"SILENT"')
i.fa.fa-volume-off.fa-fw(tooltip='{{"Silent Mode" | translate}}')
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"VIBRATE"')
i.fa.fa-mobile.fa-fw(tooltip='{{"Vibrate Mode" | translate}}')
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"NORMAL"')
i.fa.fa-volume-up.fa-fw(tooltip='{{"Normal Mode" | translate}}')