Adding new Settings shortcuts.

This commit is contained in:
Gunther Brunner
2014-05-22 22:27:28 +09:00
parent d14b9965b0
commit f5ffd14c92
9 changed files with 125 additions and 29 deletions

View File

@@ -1,31 +1,64 @@
// See https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
module.exports = function ShellCtrl($scope, gettext) {
// TODO: implement multiple devices
// $scope.results = []
$scope.result = null
$scope.referenceUrl = 'https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference'
$scope.run = function(command) {
if (command === 'clear') {
$scope.clear()
return
}
$scope.command = ''
var run = function (command) {
// Force run activity
command += ' --activity-clear-top'
return $scope.control.shell(command)
.progressed(function(result) {
$scope.result = result
$scope.data = result.data.join('')
$scope.$digest()
})
.then(function(result) {
$scope.result = result
$scope.data = result.data.join('')
$scope.$digest()
.then(function (result) {
console.log(result)
})
}
function openSetting(activity) {
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings\$' + activity)
}
$scope.openSettings = function () {
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings')
}
$scope.openWiFiSettings = function () {
//openSetting('WifiSettingsActivity')
run('am start -a android.settings.WIFI_SETTINGS')
}
$scope.openLocaleSettings = function () {
openSetting('LocalePickerActivity')
}
$scope.openIMESettings = function () {
openSetting('KeyboardLayoutPickerActivity')
}
$scope.openDisplaySettings = function () {
openSetting('DisplaySettingsActivity')
}
$scope.openDeviceInfo = function () {
openSetting('DeviceInfoSettingsActivity')
}
$scope.openManageApps = function () {
//openSetting('ManageApplicationsActivity')
run('am start -a android.settings.APPLICATION_SETTINGS')
}
$scope.openRunningApps = function () {
openSetting('RunningServicesActivity')
}
$scope.openDeveloperSettings = function () {
openSetting('DevelopmentSettingsActivity')
}
//'am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity'
//'am start -a android.intent.action.POWER_USAGE_SUMMARY'
$scope.clear = function () {
$scope.command = ''
$scope.data = ''