Compare commits
149 Commits
f22e4854ee
...
v1.7.2
Author | SHA1 | Date | |
---|---|---|---|
2a067507ae | |||
1c8eec735d | |||
53f46c10da | |||
c5f04afe85 | |||
4d7fa711f9 | |||
4bea2113fa | |||
890260b8eb | |||
230521149f | |||
9a50da550a | |||
941bb3e1af | |||
5653a9c70e | |||
8c6331237d | |||
1bbf04d548 | |||
a2d93d27cb | |||
0463e0aa19 | |||
41cf907be3 | |||
acae282a0d | |||
ebfceee69f | |||
69283c5fea | |||
fff0bde9d8 | |||
f9c76ba951 | |||
d1263b46b6 | |||
64801d8ff2 | |||
3d8257aeec | |||
67b2a81647 | |||
3e9590d7d2 | |||
21b8c6c7ec | |||
dc8cc14d20 | |||
4fc1f8a2a9 | |||
d7e1cd44e8 | |||
c1139e1cb8 | |||
03c8a1ff60 | |||
20acd563e7 | |||
5ae193847e | |||
391479b164 | |||
fa578b175d | |||
0008642044 | |||
359dd545c7 | |||
89ac69fd4b | |||
b88801500f | |||
128116025f | |||
5d3e89595f | |||
8e5ad15c34 | |||
8b29dd0985 | |||
c34ec83425 | |||
cdf1a8baa8 | |||
d28ee8d00d | |||
2bb6f81596 | |||
6f0dbc9555 | |||
a9bd7b9561 | |||
81d6ab7b5f | |||
034c76fe30 | |||
15637e914d | |||
cd6ed7543c | |||
f991325566 | |||
b744e76b07 | |||
06d63826e6 | |||
fb87d5e42d | |||
17109b12d4 | |||
92ca6d6cb4 | |||
5fdc68e396 | |||
ab0f2d88b4 | |||
06a6651fae | |||
473c464bf7 | |||
a5b9ced9ba | |||
9cea3f4285 | |||
0438a58f3e | |||
97f32bd012 | |||
6588443459 | |||
604ab0eb43 | |||
31c4f6c1d1 | |||
0c646b55fc | |||
88cdc366c5 | |||
2bd94e8a3d | |||
074f75ed20 | |||
d988e1f43d | |||
23502f52bb | |||
9a6083247f | |||
ba2a340bdf | |||
9e2f7c16f6 | |||
d042b3f35a | |||
220d2d316e | |||
4aa095e801 | |||
b5bd332ff5 | |||
969937f8a0 | |||
e3598cc475 | |||
e63d97be0c | |||
e60fb1535a | |||
8563234db3 | |||
448942e4e8 | |||
dcdb770d9f | |||
b5040cedb3 | |||
423839fa43 | |||
a6edab75ce | |||
cb430b957f | |||
b6a0f6dd91 | |||
bc32cbc179 | |||
d9cc604bdd | |||
db21011b7f | |||
dc35c8b7fb | |||
5a7cbfcdc9 | |||
913a37a320 | |||
14655fe55d | |||
cfc145c6c4 | |||
325bff305c | |||
4371fb56f7 | |||
6593f6c923 | |||
7fbac92360 | |||
7415830dd7 | |||
dce68d79bd | |||
397dadd8c7 | |||
c51c46707b | |||
d699285b5a | |||
cf3db22ffb | |||
f53abe2b23 | |||
ba2f96713d | |||
21d9351b2b | |||
a8bfc6f7ec | |||
71d9791603 | |||
d71177f3da | |||
eef6c3234a | |||
192142c76b | |||
9a2a0aa6a4 | |||
c18a880ad7 | |||
a845ea7c63 | |||
2d9695344b | |||
24d05e6d87 | |||
07b0513eae | |||
e445b787a9 | |||
82156059fa | |||
b976ff95b6 | |||
a4b2745b7b | |||
844be6a4a7 | |||
49a48fc371 | |||
722750b724 | |||
ab51eb3655 | |||
7b88e7a612 | |||
bb2f5c9842 | |||
883a7e8341 | |||
bfc0e3ac4f | |||
23ded3a851 | |||
6d363fd02d | |||
3c0f889db7 | |||
d018c27f0e | |||
7e36f0f32e | |||
666129de16 | |||
becdbd6546 | |||
d292988737 | |||
21ee06e9b1 |
2
.gitignore
vendored
@ -148,3 +148,5 @@ fabric.properties
|
||||
|
||||
/app/app-release.apk
|
||||
Automation_settings.xml
|
||||
/app/googlePlayFlavor/
|
||||
/.idea/deploymentTargetDropDown.xml
|
||||
|
10
.idea/runConfigurations.xml
generated
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -11,8 +11,8 @@ android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
versionCode 104
|
||||
versionName "1.6.33"
|
||||
versionCode 116
|
||||
versionName "1.7.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -40,23 +40,19 @@ android {
|
||||
googlePlayFlavor
|
||||
{
|
||||
dimension "version"
|
||||
// applicationIdSuffix ".googlePlay"
|
||||
versionNameSuffix "-googlePlay"
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
}
|
||||
|
||||
fdroidFlavor
|
||||
{
|
||||
dimension "version"
|
||||
// applicationIdSuffix ".fdroid"
|
||||
// versionNameSuffix "-fdroid"
|
||||
targetSdkVersion 28
|
||||
}
|
||||
|
||||
apkFlavor
|
||||
{
|
||||
dimension "version"
|
||||
// applicationIdSuffix ".apk"
|
||||
versionNameSuffix "-apk"
|
||||
targetSdkVersion 28
|
||||
}
|
||||
@ -64,16 +60,18 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:19.2.0'
|
||||
googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:17.1.0'
|
||||
|
||||
apkFlavorImplementation 'com.google.firebase:firebase-appindexing:19.2.0'
|
||||
apkFlavorImplementation 'com.google.android.gms:play-services-location:17.1.0'
|
||||
googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0'
|
||||
googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:18.0.0'
|
||||
|
||||
apkFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0'
|
||||
apkFlavorImplementation 'com.google.android.gms:play-services-location:18.0.0'
|
||||
|
||||
implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
|
||||
implementation 'org.apache.commons:commons-lang3:3.0'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
//implementation "androidx.security:security-crypto:1.0.0"
|
||||
//implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 2,
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
@ -10,9 +10,11 @@
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 104,
|
||||
"versionName": "1.6.33-googlePlay",
|
||||
"attributes": [],
|
||||
"versionCode": 116,
|
||||
"versionName": "1.7.2-googlePlay",
|
||||
"outputFile": "app-googlePlayFlavor-release.apk"
|
||||
}
|
||||
]
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
@ -65,6 +65,7 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.telephony"
|
||||
@ -121,31 +122,39 @@
|
||||
<receiver android:name=".receivers.PackageReplacedReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter>
|
||||
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
||||
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
|
||||
<!--<data
|
||||
android:path="com.jens.automation2"
|
||||
android:scheme="package" />-->
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receivers.AlarmListener" />
|
||||
<receiver android:name=".receivers.DateTimeListener" />
|
||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||
<receiver android:name=".receivers.TimeZoneListener" />
|
||||
|
||||
<receiver
|
||||
android:name=".DeviceAdmin"
|
||||
android:description="@string/app_name"
|
||||
android:label="@string/app_name"
|
||||
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
|
||||
<meta-data
|
||||
android:name="android.app.device_admin"
|
||||
android:resource="@xml/policies" />
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity android:name=".ActivityManageRule" />
|
||||
<activity android:name=".ActivityManageActionTriggerUrl" />
|
||||
<activity android:name=".ActivityDisplayLongMessage" />
|
||||
<activity android:name=".ActivityManageActionSendTextMessage" />
|
||||
<activity android:name=".ActivityManageActionPlaySound" />
|
||||
<activity android:name=".ActivityManageTriggerProfile" />
|
||||
<activity android:name=".ActivityManageTriggerTimeFrame" />
|
||||
<activity android:name=".ActivityMaintenance" />
|
||||
<activity android:name=".ActivityManageTriggerPhoneCall" />
|
||||
<activity android:name=".ActivityManageActionBrightnessSetting" />
|
||||
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
|
||||
<activity android:name=".ActivityHelp" />
|
||||
<activity android:name=".ActivityManageActionVibrate" />
|
||||
<activity
|
||||
android:name=".ActivityMainTabLayout"
|
||||
android:launchMode="singleTask">
|
||||
@ -206,7 +215,6 @@
|
||||
|
||||
<activity android:name=".ActivityPermissions" />
|
||||
|
||||
|
||||
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
|
||||
|
@ -291,10 +291,10 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
|
||||
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
|
||||
*/
|
||||
|
||||
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidatesByActivityDetection();
|
||||
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidates(Trigger_Enum.activityDetection);
|
||||
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
|
||||
{
|
||||
if(allRulesWithActivityDetection.get(i).applies(Miscellaneous.getAnyContext()))
|
||||
if(allRulesWithActivityDetection.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
|
||||
allRulesWithActivityDetection.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />-->
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
@ -62,6 +63,7 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.telephony"
|
||||
@ -118,31 +120,39 @@
|
||||
<receiver android:name=".receivers.PackageReplacedReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter>
|
||||
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
||||
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
|
||||
<!--<data
|
||||
android:path="com.jens.automation2"
|
||||
android:scheme="package" />-->
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receivers.AlarmListener" />
|
||||
<receiver android:name=".receivers.DateTimeListener" />
|
||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||
<receiver android:name=".receivers.TimeZoneListener" />
|
||||
|
||||
<receiver
|
||||
android:name=".DeviceAdmin"
|
||||
android:description="@string/app_name"
|
||||
android:label="@string/app_name"
|
||||
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
|
||||
<meta-data
|
||||
android:name="android.app.device_admin"
|
||||
android:resource="@xml/policies" />
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity android:name=".ActivityManageRule" />
|
||||
<activity android:name=".ActivityManageActionTriggerUrl" />
|
||||
<activity android:name=".ActivityDisplayLongMessage" />
|
||||
<activity android:name=".ActivityManageActionSendTextMessage" />
|
||||
<activity android:name=".ActivityManageActionPlaySound" />
|
||||
<activity android:name=".ActivityManageTriggerProfile" />
|
||||
<activity android:name=".ActivityManageTriggerTimeFrame" />
|
||||
<activity android:name=".ActivityMaintenance" />
|
||||
<activity android:name=".ActivityManageTriggerPhoneCall" />
|
||||
<activity android:name=".ActivityManageActionBrightnessSetting" />
|
||||
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
|
||||
<activity android:name=".ActivityHelp" />
|
||||
<activity android:name=".ActivityManageActionVibrate" />
|
||||
<activity
|
||||
android:name=".ActivityMainTabLayout"
|
||||
android:launchMode="singleTask">
|
||||
@ -169,6 +179,7 @@
|
||||
</intent-filter>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<meta-data
|
||||
android:name="android.nfc.action.TECH_DISCOVERED"
|
||||
@ -202,7 +213,6 @@
|
||||
|
||||
<activity android:name=".ActivityPermissions" />
|
||||
|
||||
|
||||
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />-->
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
@ -63,6 +64,7 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@ -112,31 +114,39 @@
|
||||
<receiver android:name=".receivers.PackageReplacedReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter>
|
||||
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
|
||||
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
|
||||
<!--<data
|
||||
android:path="com.jens.automation2"
|
||||
android:scheme="package" />-->
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receivers.AlarmListener" />
|
||||
<receiver android:name=".receivers.DateTimeListener" />
|
||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||
<receiver android:name=".receivers.TimeZoneListener" />
|
||||
|
||||
<receiver
|
||||
android:name=".DeviceAdmin"
|
||||
android:description="@string/app_name"
|
||||
android:label="@string/app_name"
|
||||
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
|
||||
<meta-data
|
||||
android:name="android.app.device_admin"
|
||||
android:resource="@xml/policies" />
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity android:name=".ActivityManageRule" />
|
||||
<activity android:name=".ActivityManageActionTriggerUrl" />
|
||||
<activity android:name=".ActivityDisplayLongMessage" />
|
||||
<activity android:name=".ActivityManageActionSendTextMessage" />
|
||||
<activity android:name=".ActivityManageActionPlaySound" />
|
||||
<activity android:name=".ActivityManageTriggerProfile" />
|
||||
<activity android:name=".ActivityManageTriggerTimeFrame" />
|
||||
<activity android:name=".ActivityMaintenance" />
|
||||
<activity android:name=".ActivityManageTriggerPhoneCall" />
|
||||
<activity android:name=".ActivityManageActionBrightnessSetting" />
|
||||
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
|
||||
<activity android:name=".ActivityHelp" />
|
||||
<activity android:name=".ActivityManageActionVibrate" />
|
||||
<activity
|
||||
android:name=".ActivityMainTabLayout"
|
||||
android:launchMode="singleTask">
|
||||
@ -197,7 +207,6 @@
|
||||
|
||||
<activity android:name=".ActivityPermissions" />
|
||||
|
||||
|
||||
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
|
||||
|
@ -301,7 +301,7 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
|
||||
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
|
||||
*/
|
||||
|
||||
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidatesByActivityDetection();
|
||||
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidates(Trigger_Enum.activityDetection);
|
||||
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
|
||||
{
|
||||
if(allRulesWithActivityDetection.get(i).applies(Miscellaneous.getAnyContext()))
|
||||
|
@ -5,6 +5,7 @@ import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -13,14 +14,18 @@ import java.util.Locale;
|
||||
|
||||
public class Action
|
||||
{
|
||||
Rule parentRule = null;
|
||||
|
||||
public static final String actionParameter2Split = "ap2split";
|
||||
public static final String intentPairSeperator = "intPairSplit";
|
||||
public static final String vibrateSeparator = ",";
|
||||
|
||||
public enum Action_Enum {
|
||||
setWifi,
|
||||
setBluetooth,
|
||||
setUsbTethering,
|
||||
setWifiTethering,
|
||||
setBluetoothTethering,
|
||||
setDisplayRotation,
|
||||
turnWifiOn,turnWifiOff,
|
||||
turnBluetoothOn,turnBluetoothOff,
|
||||
@ -31,13 +36,14 @@ public class Action
|
||||
enableScreenRotation,disableScreenRotation,
|
||||
startOtherActivity,
|
||||
waitBeforeNextAction,
|
||||
wakeupDevice,
|
||||
turnScreenOnOrOff,
|
||||
setAirplaneMode,
|
||||
setDataConnection,
|
||||
speakText,
|
||||
playMusic,
|
||||
setScreenBrightness,
|
||||
playSound,
|
||||
vibrate,
|
||||
sendTextMessage;
|
||||
|
||||
public String getFullName(Context context)
|
||||
@ -50,6 +56,8 @@ public class Action
|
||||
return context.getResources().getString(R.string.actionSetBluetooth);
|
||||
case setWifiTethering:
|
||||
return context.getResources().getString(R.string.actionSetWifiTethering);
|
||||
case setBluetoothTethering:
|
||||
return context.getResources().getString(R.string.actionSetBluetoothTethering);
|
||||
case setUsbTethering:
|
||||
return context.getResources().getString(R.string.actionSetUsbTethering);
|
||||
case setDisplayRotation:
|
||||
@ -82,8 +90,10 @@ public class Action
|
||||
return context.getResources().getString(R.string.startOtherActivity);
|
||||
case waitBeforeNextAction:
|
||||
return context.getResources().getString(R.string.waitBeforeNextAction);
|
||||
case wakeupDevice:
|
||||
return context.getResources().getString(R.string.wakeupDevice);
|
||||
case turnScreenOnOrOff:
|
||||
return context.getResources().getString(R.string.turnScreenOnOrOff);
|
||||
case vibrate:
|
||||
return context.getResources().getString(R.string.vibrate);
|
||||
case setAirplaneMode:
|
||||
return context.getResources().getString(R.string.airplaneMode);
|
||||
case setDataConnection:
|
||||
@ -144,85 +154,92 @@ public class Action
|
||||
{
|
||||
StringBuilder returnString = new StringBuilder();
|
||||
|
||||
if(this.getAction().equals(Action_Enum.setWifi))
|
||||
switch(getAction())
|
||||
{
|
||||
case setWifi:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setBluetooth))
|
||||
{
|
||||
break;
|
||||
case setBluetooth:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setUsbTethering))
|
||||
{
|
||||
break;
|
||||
case setUsbTethering:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setWifiTethering))
|
||||
{
|
||||
break;
|
||||
case setWifiTethering:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setDisplayRotation))
|
||||
{
|
||||
break;
|
||||
case setBluetoothTethering:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOff));
|
||||
break;
|
||||
case setDisplayRotation:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionEnableScreenRotation));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionDisableScreenRotation));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setAirplaneMode))
|
||||
{
|
||||
break;
|
||||
case setAirplaneMode:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setDataConnection))
|
||||
{
|
||||
break;
|
||||
case setDataConnection:
|
||||
if (this.getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOff));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.startOtherActivity))
|
||||
{
|
||||
break;
|
||||
case startOtherActivity:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.startOtherActivity));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.triggerUrl))
|
||||
{
|
||||
break;
|
||||
case triggerUrl:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTriggerUrl));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.speakText))
|
||||
{
|
||||
break;
|
||||
case speakText:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSpeakText));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.playMusic))
|
||||
{
|
||||
break;
|
||||
case playMusic:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionPlayMusic));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.sendTextMessage))
|
||||
{
|
||||
break;
|
||||
case sendTextMessage:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendTextMessage));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.wakeupDevice))
|
||||
{
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.wakeupDevice));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.playSound))
|
||||
{
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound));
|
||||
}
|
||||
break;
|
||||
case turnScreenOnOrOff:
|
||||
if (getParameter1())
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOn));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOff));
|
||||
break;
|
||||
case playSound:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound));
|
||||
break;
|
||||
case changeSoundProfile:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionChangeSoundProfile));
|
||||
break;
|
||||
case waitBeforeNextAction:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.waitBeforeNextAction));
|
||||
break;
|
||||
case setScreenBrightness:
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.setScreenBrightness));
|
||||
break;
|
||||
default:
|
||||
returnString.append(action.toString());
|
||||
}
|
||||
|
||||
if(this.getAction().equals(Action_Enum.triggerUrl))
|
||||
{
|
||||
@ -232,7 +249,7 @@ public class Action
|
||||
returnString.append(": " + components[2]);
|
||||
|
||||
if(parameter1)
|
||||
returnString.append(" using authentication.");
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.usingAuthentication) + ".");
|
||||
}
|
||||
else
|
||||
returnString.append(": " + components[0]);
|
||||
@ -246,14 +263,14 @@ public class Action
|
||||
String[] components = parameter2.split(Actions.smsSeparator);
|
||||
if(components.length >= 2)
|
||||
{
|
||||
returnString.append(" to number " + components[0]);
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.toNumber) + " " + components[0]);
|
||||
|
||||
returnString.append(". Message: " + components[1]);
|
||||
returnString.append(". " + Miscellaneous.getAnyContext().getResources().getString(R.string.message) + ": " + components[1]);
|
||||
}
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setScreenBrightness))
|
||||
{
|
||||
returnString.append(" to ");
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.to) + " ");
|
||||
|
||||
if(parameter1)
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto));
|
||||
@ -269,6 +286,16 @@ public class Action
|
||||
return returnString.toString();
|
||||
}
|
||||
|
||||
public Rule getParentRule()
|
||||
{
|
||||
return parentRule;
|
||||
}
|
||||
|
||||
public void setParentRule(Rule parentRule)
|
||||
{
|
||||
this.parentRule = parentRule;
|
||||
}
|
||||
|
||||
public static CharSequence[] getActionTypesAsArray()
|
||||
{
|
||||
ArrayList<String> actionTypesList = new ArrayList<String>();
|
||||
@ -345,18 +372,11 @@ public class Action
|
||||
* Old version. Those checks should not be necessary anymore. Also they didn't work
|
||||
* because profiles were created with names like silent, vibrate and normal.
|
||||
*/
|
||||
// if(this.getParameter2().equals("silent"))
|
||||
// Actions.setSound(context, AudioManager.RINGER_MODE_SILENT);
|
||||
// else if(this.getParameter2().equals("vibrate"))
|
||||
// Actions.setSound(context, AudioManager.RINGER_MODE_VIBRATE);
|
||||
// else if(this.getParameter2().equals("normal"))
|
||||
// Actions.setSound(context, AudioManager.RINGER_MODE_NORMAL);
|
||||
// else
|
||||
// {
|
||||
|
||||
Profile p = Profile.getByName(this.getParameter2());
|
||||
if (p != null)
|
||||
p.activate(context);
|
||||
// }
|
||||
|
||||
break;
|
||||
case triggerUrl:
|
||||
triggerUrl(context);
|
||||
@ -368,11 +388,14 @@ public class Action
|
||||
Actions.setUsbTethering(context, getParameter1(), toggleActionIfPossible);
|
||||
break;
|
||||
case setWifi:
|
||||
Actions.setWifi(context, getParameter1(), toggleActionIfPossible);
|
||||
Actions.WifiStuff.setWifi(context, getParameter1(), toggleActionIfPossible);
|
||||
break;
|
||||
case setWifiTethering:
|
||||
Actions.setWifiTethering(context, getParameter1(), toggleActionIfPossible);
|
||||
break;
|
||||
case setBluetoothTethering:
|
||||
Actions.BluetoothTetheringClass.setBluetoothTethering(context, getParameter1(), toggleActionIfPossible);
|
||||
break;
|
||||
case setDisplayRotation:
|
||||
Actions.setDisplayRotation(context, getParameter1(), toggleActionIfPossible);
|
||||
break;
|
||||
@ -382,9 +405,14 @@ public class Action
|
||||
case waitBeforeNextAction:
|
||||
Actions.waitBeforeNextAction(Long.parseLong(this.getParameter2()));
|
||||
break;
|
||||
case wakeupDevice:
|
||||
case turnScreenOnOrOff:
|
||||
if(getParameter1())
|
||||
{
|
||||
if(StringUtils.isNumeric(this.getParameter2()))
|
||||
Actions.wakeupDevice(Long.parseLong(this.getParameter2()));
|
||||
// wakeupDevice() will create a seperate thread. That'll take some time, we wait 100ms.
|
||||
else
|
||||
Actions.wakeupDevice((long)1000);
|
||||
// wakeupDevice() will create a separate thread. That'll take some time, we wait 100ms.
|
||||
try
|
||||
{
|
||||
Thread.sleep(100);
|
||||
@ -393,6 +421,11 @@ public class Action
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Actions.turnOffScreen();
|
||||
}
|
||||
break;
|
||||
case setAirplaneMode:
|
||||
Actions.setAirplaneMode(this.getParameter1(), toggleActionIfPossible);
|
||||
@ -412,6 +445,9 @@ public class Action
|
||||
case setScreenBrightness:
|
||||
Actions.setScreenBrightness(getParameter1(), Integer.parseInt(getParameter2()));
|
||||
break;
|
||||
case vibrate:
|
||||
Actions.vibrate(getParameter1(), getParameter2());
|
||||
break;
|
||||
case playSound:
|
||||
Actions.playSound(getParameter1(), getParameter2());
|
||||
break;
|
||||
@ -491,49 +527,12 @@ public class Action
|
||||
{
|
||||
Miscellaneous.logEvent("i", "HTTP Request", "Attempt " + String.valueOf(attempts++) + " of " + String.valueOf(Settings.httpAttempts), 3);
|
||||
|
||||
// try
|
||||
// {
|
||||
// Either thorough checking or no encryption
|
||||
if(!Settings.httpAcceptAllCertificates | !urlString.toLowerCase(Locale.getDefault()).contains("https"))
|
||||
// {
|
||||
// URL url = new URL(urlString);
|
||||
// URLConnection urlConnection = url.openConnection();
|
||||
// urlConnection.setReadTimeout(Settings.httpAttemptsTimeout * 1000);
|
||||
// InputStream in = urlConnection.getInputStream();
|
||||
// response = Miscellaneous.convertStreamToString(in);
|
||||
|
||||
if(!Settings.httpAcceptAllCertificates || !urlString.toLowerCase(Locale.getDefault()).contains("https"))
|
||||
response = Miscellaneous.downloadURL(urlString, urlUsername, urlPassword);
|
||||
// }
|
||||
else
|
||||
// {
|
||||
response = Miscellaneous.downloadURLwithoutCertificateChecking(urlString, urlUsername, urlPassword);
|
||||
// post = new HttpGet(new URI(urlString));
|
||||
// final HttpParams httpParams = new BasicHttpParams();
|
||||
// HttpConnectionParams.setConnectionTimeout(httpParams, Settings.httpAttemptsTimeout * 1000);
|
||||
// HttpClient client = new DefaultHttpClient(httpParams);
|
||||
//
|
||||
// client = sslClient(client);
|
||||
//
|
||||
// // Execute HTTP Post Request
|
||||
// HttpResponse result = client.execute(post);
|
||||
// response = EntityUtils.toString(result.getEntity());
|
||||
// }
|
||||
// }
|
||||
// catch (URISyntaxException e)
|
||||
// {
|
||||
// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3);
|
||||
// }
|
||||
// catch (ClientProtocolException e)
|
||||
// {
|
||||
// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3);
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep(Settings.httpAttemptGap * 1000);
|
||||
@ -542,10 +541,9 @@ public class Action
|
||||
{
|
||||
Miscellaneous.logEvent("w", "HTTP RESULT", "Failed to pause between HTTP requests.", 5);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// Miscellaneous.logEvent("i", "HTTPS RESULT", response, 3);
|
||||
Miscellaneous.logEvent("i", "HTTPS RESULT", response, 5);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -15,15 +21,18 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.MediaStore;
|
||||
import android.telephony.SmsManager;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.jens.automation2.actions.wifi_router.MyOnStartTetheringCallback;
|
||||
import com.jens.automation2.actions.wifi_router.MyOreoWifiManager;
|
||||
import com.jens.automation2.location.WifiBroadcastReceiver;
|
||||
@ -38,13 +47,16 @@ import org.apache.http.conn.util.InetAddressUtils;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.security.KeyStore;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
@ -67,9 +79,45 @@ public class Actions
|
||||
public static final String wireguard_tunnel_down = "com.wireguard.android.action.SET_TUNNEL_DOWN";
|
||||
public static final String wireguard_tunnel_refresh = "com.wireguard.android.action.REFRESH_TUNNEL_STATES";
|
||||
|
||||
public static class WifiStuff
|
||||
{
|
||||
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Wifi", "Changing Wifi to " + String.valueOf(desiredState), 4);
|
||||
if(context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q)
|
||||
return setWifiWithRoot(context, desiredState, toggleActionIfPossible);
|
||||
else
|
||||
return setWifiOldFashioned(context, desiredState, toggleActionIfPossible);
|
||||
}
|
||||
|
||||
public static Boolean setWifiWithRoot(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState) + ", but with root permissions.", 4);
|
||||
|
||||
String command = null;
|
||||
int state = 0;
|
||||
|
||||
String desiredStateString;
|
||||
if(desiredState)
|
||||
desiredStateString = "enable";
|
||||
else
|
||||
desiredStateString = "disable";
|
||||
|
||||
try
|
||||
{
|
||||
command = "svc wifi " + desiredStateString;
|
||||
Miscellaneous.logEvent("i", "setWifiWithRoot()", "Running command as root: " + command.toString(), 5);
|
||||
return executeCommandViaSu(new String[]{command});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Oops! Something went wrong, so we throw the exception here.
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean setWifiOldFashioned(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState), 4);
|
||||
|
||||
if (desiredState && Settings.useWifiForPositioning)
|
||||
WifiBroadcastReceiver.startWifiReceiver(autoMationServerRef.getLocationProvider());
|
||||
@ -110,6 +158,7 @@ public class Actions
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setDisplayRotation(Context myContext, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
@ -179,6 +228,7 @@ public class Actions
|
||||
}
|
||||
return currentlyEnabled;
|
||||
}
|
||||
|
||||
public static Boolean setWifiTethering(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "WifiTethering", "Changing WifiTethering to " + String.valueOf(desiredState), 4);
|
||||
@ -261,6 +311,149 @@ public class Actions
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class BluetoothTetheringClass
|
||||
{
|
||||
static Object instance = null;
|
||||
static Method setTetheringOn = null;
|
||||
static Method isTetheringOn = null;
|
||||
static Object mutex = new Object();
|
||||
|
||||
public static Boolean setBluetoothTethering(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Bluetooth Tethering", "Changing Bluetooth Tethering to " + String.valueOf(desiredState), 4);
|
||||
|
||||
// boolean state = isTetheringOn(context);
|
||||
|
||||
// if (toggleActionIfPossible)
|
||||
// {
|
||||
// Miscellaneous.logEvent("i", "Bluetooth Tethering", context.getResources().getString(R.string.toggling), 2);
|
||||
// desiredState = !state;
|
||||
// }
|
||||
|
||||
// if (((state && !desiredState) || (!state && desiredState)))
|
||||
// {
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
Class<?> classBluetoothPan = null;
|
||||
Constructor<?> BTPanCtor = null;
|
||||
Object BTSrvInstance = null;
|
||||
Method mBTPanConnect = null;
|
||||
|
||||
String sClassName = "android.bluetooth.BluetoothPan";
|
||||
try
|
||||
{
|
||||
classBluetoothPan = Class.forName(sClassName);
|
||||
Constructor<?> ctor = classBluetoothPan.getDeclaredConstructor(Context.class, BluetoothProfile.ServiceListener.class);
|
||||
|
||||
ctor.setAccessible(true);
|
||||
// Set Tethering ON
|
||||
|
||||
Class[] paramSet = new Class[1];
|
||||
paramSet[0] = boolean.class;
|
||||
|
||||
synchronized (mutex)
|
||||
{
|
||||
setTetheringOn = classBluetoothPan.getDeclaredMethod("setBluetoothTethering", paramSet);
|
||||
isTetheringOn = classBluetoothPan.getDeclaredMethod("isTetheringOn", null);
|
||||
instance = ctor.newInstance(context, new BTPanServiceListener(context));
|
||||
}
|
||||
|
||||
classBluetoothPan = Class.forName("android.bluetooth.BluetoothPan");
|
||||
mBTPanConnect = classBluetoothPan.getDeclaredMethod("connect", BluetoothDevice.class);
|
||||
BTPanCtor = classBluetoothPan.getDeclaredConstructor(Context.class, BluetoothProfile.ServiceListener.class);
|
||||
BTPanCtor.setAccessible(true);
|
||||
BTSrvInstance = BTPanCtor.newInstance(context, new BTPanServiceListener(context));
|
||||
|
||||
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
|
||||
|
||||
// If there are paired devices
|
||||
if (pairedDevices.size() > 0)
|
||||
{
|
||||
// Loop through paired devices
|
||||
for (BluetoothDevice device : pairedDevices)
|
||||
{
|
||||
try
|
||||
{
|
||||
mBTPanConnect.invoke(BTSrvInstance, device);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
catch(InvocationTargetException e)
|
||||
{
|
||||
/*
|
||||
Exact error message: "Bluetooth binder is null"
|
||||
This means this device doesn't have bluetooth.
|
||||
*/
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", "Device probably doesn't have bluetooth. " + Log.getStackTraceString(e), 1);
|
||||
Toast.makeText(context, context.getResources().getString(R.string.deviceDoesNotHaveBluetooth), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class BTPanServiceListener implements BluetoothProfile.ServiceListener
|
||||
{
|
||||
private final Context context;
|
||||
|
||||
public BTPanServiceListener(final Context context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(final int profile, final BluetoothProfile proxy)
|
||||
{
|
||||
//Some code must be here or the compiler will optimize away this callback.
|
||||
|
||||
try
|
||||
{
|
||||
synchronized (mutex)
|
||||
{
|
||||
setTetheringOn.invoke(instance, true);
|
||||
if ((Boolean) isTetheringOn.invoke(instance, null))
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", "BT Tethering is on", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", "BT Tethering is off", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(final int profile)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean setUsbTethering(Context context2, Boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
//TODO:toggle not really implemented, yet
|
||||
@ -455,12 +648,53 @@ public class Actions
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setSound(Context context, int soundSetting)
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public static void setDoNotDisturb(Context context, int desiredSetting)
|
||||
{
|
||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(soundSetting), 4);
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
// Check if the notification policy access has been granted for the app.
|
||||
/* if (!notificationManager.isNotificationPolicyAccessGranted())
|
||||
{
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
||||
startActivity(intent);
|
||||
return;
|
||||
}*/
|
||||
|
||||
notificationManager.setInterruptionFilter(desiredSetting);
|
||||
|
||||
/*if (notificationManager.getCurrentInterruptionFilter() == NotificationManager.INTERRUPTION_FILTER_ALL)
|
||||
{
|
||||
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
|
||||
}*/
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public static boolean isDoNotDisturbActive(Context context)
|
||||
{
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
int result = notificationManager.getCurrentInterruptionFilter();
|
||||
return (notificationManager.getCurrentInterruptionFilter() != NotificationManager.INTERRUPTION_FILTER_ALL);
|
||||
}
|
||||
|
||||
public static void setSound(Context context, int desiredSoundSetting)
|
||||
{
|
||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(desiredSoundSetting), 4);
|
||||
|
||||
AudioManager myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
myAudioManager.setRingerMode(soundSetting);
|
||||
|
||||
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && desiredSoundSetting == AudioManager.RINGER_MODE_SILENT)
|
||||
// {
|
||||
// AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
// am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, AudioManager.FLAG_PLAY_SOUND);
|
||||
// am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
||||
// }
|
||||
// else
|
||||
// myAudioManager.setRingerMode(desiredSoundSetting);
|
||||
}
|
||||
|
||||
private static String getIPAddressUsb(final boolean useIPv4)
|
||||
@ -542,6 +776,49 @@ public class Actions
|
||||
Miscellaneous.logEvent("i", "Play sound file", "Not playing sound file because phone is on some kind of mute state.", 2);
|
||||
}
|
||||
|
||||
public static void vibrate(boolean parameter1, String parameter2)
|
||||
{
|
||||
String vibrateDurations[] = parameter2.split(Action.vibrateSeparator);
|
||||
|
||||
int counter = 1;
|
||||
for(String vibrate : vibrateDurations)
|
||||
{
|
||||
if(counter % 2 != 0)
|
||||
{
|
||||
Vibrator vibrator = (Vibrator) Miscellaneous.getAnyContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
vibrator.vibrate(VibrationEffect.createOneShot(Long.parseLong(vibrate), VibrationEffect.DEFAULT_AMPLITUDE));
|
||||
else
|
||||
vibrator.vibrate(Long.parseLong(vibrate));
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(Long.parseLong(vibrate));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "VibrateSleep", Log.getStackTraceString(e), 5);
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setDND(Context context, int desiredDndMode)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
|
||||
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.setInterruptionFilter(desiredDndMode);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("w", context.getResources().getString(R.string.soundSettings), "Cannot change DND to " + String.valueOf(desiredDndMode) + ". This Android version is too and doesn\'t have that feature, yet.", 4);
|
||||
}
|
||||
|
||||
public void useDownloadedWebpage(String result)
|
||||
{
|
||||
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();
|
||||
@ -817,9 +1094,11 @@ public class Actions
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
WakeLock wakeLock = pm.newWakeLock((WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "Automation:Wakelock");
|
||||
WakeLock wakeLock = pm.newWakeLock((PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "Automation:Wakelock");
|
||||
wakeLock.acquire();
|
||||
|
||||
try
|
||||
@ -833,14 +1112,90 @@ public class Actions
|
||||
|
||||
wakeLock.release();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Wakeup device action", "Error while waking up device: " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*public static void turnOnScreen()
|
||||
{
|
||||
// turn on screen
|
||||
Miscellaneous.logEvent("i", "Actions", "Turning screen on.", 3);
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
|
||||
wakeLock.acquire();
|
||||
}*/
|
||||
|
||||
@TargetApi(21) //Suppress lint error for PROXIMITY_SCREEN_OFF_WAKE_LOCK
|
||||
public static void turnOffScreen()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Actions", "Turning screen off.", 3);
|
||||
|
||||
|
||||
/*params.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
params.screenBrightness = 0;
|
||||
getWindow().setAttributes(params);*/
|
||||
|
||||
// PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
// WakeLock wakeLock = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
|
||||
// WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK , AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
|
||||
// wakeLock.acquire();
|
||||
|
||||
// WakeLock wakeLock = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
|
||||
// WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK , "tag");
|
||||
// wakeLock.acquire();
|
||||
|
||||
// wakeLock.release();
|
||||
lockScreen();
|
||||
}
|
||||
|
||||
public static void lockScreen()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Actions", "Locking screen.", 3);
|
||||
|
||||
// Works, but requires Manifest.permission.BIND_DEVICE_ADMIN
|
||||
// https://stackoverflow.com/questions/23898406/java-lang-securityexception-no-active-admin-owned-by-uid-10047-for-policy-4-on
|
||||
DevicePolicyManager deviceManager = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
deviceManager.lockNow();
|
||||
}
|
||||
|
||||
// using root
|
||||
/*private void turnOffScreen()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("android.os.PowerManager");
|
||||
PowerManager mPowerManager = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
|
||||
for(Method m : c.getDeclaredMethods())
|
||||
{
|
||||
if(m.getName().equals("goToSleep"))
|
||||
{
|
||||
m.setAccessible(true);
|
||||
if(m.getParameterTypes().length == 1)
|
||||
{
|
||||
m.invoke(mPowerManager,SystemClock.uptimeMillis()-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}*/
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
@SuppressLint("NewApi")
|
||||
public static boolean setAirplaneMode(boolean desiredState, boolean toggleActionIfPossible)
|
||||
{
|
||||
// Beginning from SDK Version 17 this may not work anymore.
|
||||
// Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, value is unchanged.
|
||||
/*
|
||||
Beginning from SDK Version 17 this may not work anymore.
|
||||
Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, value is unchanged.
|
||||
|
||||
https://stackoverflow.com/questions/22349928/permission-denial-not-allowed-to-send-broadcast-android-intent-action-airplane
|
||||
https://stackoverflow.com/questions/7066427/turn-off-airplane-mode-in-android
|
||||
*/
|
||||
|
||||
boolean returnValue = false;
|
||||
|
||||
@ -866,9 +1221,15 @@ public class Actions
|
||||
if (desiredState)
|
||||
desiredValueInt = 1;
|
||||
|
||||
if(Build.VERSION.SDK_INT < 17)
|
||||
if (Build.VERSION.SDK_INT < 17 || ActivityPermissions.havePermission(Manifest.permission.WRITE_SECURE_SETTINGS, context))
|
||||
{
|
||||
returnValue = android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, desiredValueInt);
|
||||
//returnValue = android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, desiredValueInt);
|
||||
|
||||
returnValue = android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.Global.AIRPLANE_MODE_ON, desiredValueInt);
|
||||
|
||||
// Intent airplaneIntent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
// airplaneIntent.putExtra("state", desiredState);
|
||||
// context.sendBroadcast(airplaneIntent);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -883,7 +1244,6 @@ public class Actions
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
String[] commands = new String[]
|
||||
{
|
||||
"settings put global airplane_mode_on 0",
|
||||
@ -1074,6 +1434,7 @@ public class Actions
|
||||
/**
|
||||
* Turns data on and off.
|
||||
* Requires root permissions from lollipop on.
|
||||
*
|
||||
* @param toggleActionIfPossible
|
||||
*/
|
||||
public static boolean setDataConnection(boolean desiredState, boolean toggleActionIfPossible)
|
||||
@ -1097,7 +1458,7 @@ public class Actions
|
||||
desiredState = !isEnabled;
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT <= 20)
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH)
|
||||
{
|
||||
for (Method m : iConnectivityManagerClass.getDeclaredMethods())
|
||||
{
|
||||
@ -1123,15 +1484,13 @@ public class Actions
|
||||
}
|
||||
}
|
||||
|
||||
protected static boolean setDataConnectionWithRoot(boolean enable)
|
||||
protected static boolean setDataConnectionWithRoot(boolean desiredState)
|
||||
{
|
||||
try
|
||||
{
|
||||
int desiredState = 0;
|
||||
if(enable)
|
||||
desiredState = 1;
|
||||
|
||||
if(MobileDataStuff.setMobileNetworkFromLollipop(desiredState, autoMationServerRef))
|
||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1)
|
||||
{
|
||||
if(MobileDataStuff.setMobileNetworkFromAndroid9(desiredState, autoMationServerRef))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
||||
return true;
|
||||
@ -1142,6 +1501,33 @@ public class Actions
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
if (MobileDataStuff.setMobileNetworkTillAndroid5(desiredState, autoMationServerRef))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MobileDataStuff.setMobileNetworkAndroid6Till8(desiredState, autoMationServerRef))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String rootString;
|
||||
@ -1156,20 +1542,23 @@ public class Actions
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static boolean setMobileNetworkFromLollipop(int desiredState, Context context) throws Exception
|
||||
public static boolean setMobileNetworkAndroid6Till8(boolean desiredState, Context context) throws Exception
|
||||
{
|
||||
String command = null;
|
||||
int state = 0;
|
||||
|
||||
try
|
||||
{
|
||||
int desiredStateString;
|
||||
if(desiredState)
|
||||
desiredStateString = 1;
|
||||
else
|
||||
desiredStateString = 0;
|
||||
|
||||
// Get the current state of the mobile network.
|
||||
state = isMobileDataEnabled() ? 0 : 1;
|
||||
// boolean state = isMobileDataEnabled() ? 0 : 1;
|
||||
// Get the value of the "TRANSACTION_setDataEnabled" field.
|
||||
String transactionCode = getTransactionCode(context);
|
||||
// Android 5.1+ (API 22) and later.
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
||||
// Loop through the subscription list i.e. SIM list.
|
||||
for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++)
|
||||
@ -1180,19 +1569,8 @@ public class Actions
|
||||
int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId();
|
||||
// Execute the command via `su` to turn off
|
||||
// mobile network for a subscription service.
|
||||
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredState;
|
||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", "Running command: " + command.toString(), 5);
|
||||
return executeCommandViaSu(new String[] { command });
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
// Android 5.0 (API 21) only.
|
||||
if (transactionCode != null && transactionCode.length() > 0)
|
||||
{
|
||||
// Execute the command via `su` to turn off mobile network.
|
||||
command = "service call phone " + transactionCode + " i32 " + desiredState;
|
||||
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredStateString;
|
||||
Miscellaneous.logEvent("i", "setMobileNetworkAndroid6Till8()", "Running command: " + command.toString(), 5);
|
||||
return executeCommandViaSu(new String[]{command});
|
||||
}
|
||||
}
|
||||
@ -1206,6 +1584,75 @@ public class Actions
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static boolean setMobileNetworkTillAndroid5(boolean desiredState, Context context) throws Exception
|
||||
{
|
||||
String command = null;
|
||||
|
||||
try
|
||||
{
|
||||
int desiredStateString;
|
||||
if(desiredState)
|
||||
desiredStateString = 1;
|
||||
else
|
||||
desiredStateString = 0;
|
||||
|
||||
// Get the current state of the mobile network.
|
||||
// int currentState = isMobileDataEnabled() ? 0 : 1;
|
||||
// Get the value of the "TRANSACTION_setDataEnabled" field.
|
||||
String transactionCode = getTransactionCode(context);
|
||||
// Android 5.0 (API 21) only.
|
||||
if (transactionCode != null && transactionCode.length() > 0)
|
||||
{
|
||||
// Execute the command via `su` to turn off mobile network.
|
||||
command = "service call phone " + transactionCode + " i32 " + desiredStateString;
|
||||
Miscellaneous.logEvent("i", "setMobileNetworkTillAndroid5()", "Running command: " + command.toString(), 5);
|
||||
return executeCommandViaSu(new String[]{command});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Oops! Something went wrong, so we throw the exception here.
|
||||
throw e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static boolean setMobileNetworkFromAndroid9(boolean desiredState, Context context) throws Exception
|
||||
{
|
||||
String command = null;
|
||||
|
||||
String desiredStateString;
|
||||
if(desiredState)
|
||||
desiredStateString = "enable";
|
||||
else
|
||||
desiredStateString = "disable";
|
||||
|
||||
try
|
||||
{
|
||||
/*
|
||||
Android 8.1 is the last version on which the transaction code can be determined
|
||||
with the below method. From 9.0 on the field TRANSACTION_setDataEnabled does not
|
||||
exist anymore. Usually it was 83 and we'll just try this number hardcoded.
|
||||
Alternatively the bottom of this might be an approach:
|
||||
https://stackoverflow.com/questions/26539445/the-setmobiledataenabled-method-is-no-longer-callable-as-of-android-l-and-later
|
||||
*/
|
||||
|
||||
// Execute the command via `su` to turn off
|
||||
// mobile network for a subscription service.
|
||||
command = "svc data " + desiredStateString;
|
||||
Miscellaneous.logEvent("i", "setMobileNetworkFromAndroid9()", "Running command: " + command.toString(), 5);
|
||||
return executeCommandViaSu(new String[]{command});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Oops! Something went wrong, so we throw the exception here.
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static boolean isMobileDataEnabled()
|
||||
{
|
||||
@ -1311,4 +1758,16 @@ public class Actions
|
||||
int actualBrightnessValue = (int) ((float) brightnessValue / 100.0 * 255.0);
|
||||
android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, actualBrightnessValue);
|
||||
}
|
||||
|
||||
public boolean isAirplaneModeOn(Context context)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
{
|
||||
return android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 0) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return android.provider.Settings.Global.getInt(context.getContentResolver(), android.provider.Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import com.jens.automation2.R.layout;
|
||||
|
||||
public class ActivityHelp extends Activity
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
@ -19,5 +18,4 @@ public class ActivityHelp extends Activity
|
||||
TextView tvHelpTextEnergySaving = (TextView) findViewById(R.id.tvHelpTextEnergySaving);
|
||||
tvHelpTextEnergySaving.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
}
|
@ -184,8 +184,16 @@ public class ActivityMainProfiles extends ActivityGeneric
|
||||
startActivityForResult(manageSpecificProfileIntent, 2000);
|
||||
break;
|
||||
case 2:
|
||||
if(profile.delete(myAutomationService))
|
||||
Rule user = profile.isInUseByRules();
|
||||
if(user == null)
|
||||
{
|
||||
if (profile.delete(ActivityMainProfiles.this))
|
||||
updateListView();
|
||||
else
|
||||
Toast.makeText(ActivityMainProfiles.this, getResources().getString(R.string.profileCouldNotBeDeleted), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else
|
||||
Toast.makeText(ActivityMainProfiles.this, String.format(getResources().getString(R.string.ruleXIsUsingProfileY), user.getName(), profile.getName()), Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -19,17 +19,21 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.jens.automation2.AutomationService.serviceCommands;
|
||||
import com.jens.automation2.receivers.AlarmListener;
|
||||
import com.jens.automation2.receivers.DateTimeListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActivityMainRules extends ActivityGeneric
|
||||
{
|
||||
private ListView ruleListView;
|
||||
ArrayList<Rule> ruleList = new ArrayList<>();
|
||||
private ArrayAdapter<Rule> ruleListViewAdapter;
|
||||
public static Rule ruleToEdit;
|
||||
protected static ActivityMainRules instance = null;
|
||||
|
||||
public static final int requestCodeCreateRule = 3000;
|
||||
public static final int requestCodeChangeRule = 4000;
|
||||
|
||||
public static ActivityMainRules getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
@ -52,21 +56,14 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
// if(!ActivityPermissions.havePermission(ActivityPermissions.writeExternalStoragePermissionName, ActivityMainRules.this))
|
||||
// {
|
||||
// Toast.makeText(ActivityMainRules.this, getResources().getString(R.string.appRequiresPermissiontoAccessExternalStorage), Toast.LENGTH_LONG).show();
|
||||
// return;
|
||||
// }
|
||||
|
||||
ruleToEdit = null;
|
||||
Intent startAddRuleIntent = new Intent(ActivityMainRules.this, ActivityManageRule.class);
|
||||
startActivityForResult(startAddRuleIntent, 3000);
|
||||
startActivityForResult(startAddRuleIntent, requestCodeCreateRule);
|
||||
}
|
||||
});
|
||||
|
||||
ruleListViewAdapter = new RuleArrayAdapter(this, R.layout.view_for_rule_listview, ruleList);
|
||||
ruleListView = (ListView)findViewById(R.id.lvRuleList);
|
||||
|
||||
ruleListViewAdapter = new RuleArrayAdapter(this, R.layout.view_for_rule_listview, Rule.getRuleCollection());
|
||||
ruleListView.setClickable(true);
|
||||
|
||||
ruleListView.setOnItemLongClickListener(new OnItemLongClickListener()
|
||||
@ -112,7 +109,6 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
|
||||
private static class RuleArrayAdapter extends ArrayAdapter<Rule>
|
||||
{
|
||||
|
||||
public RuleArrayAdapter(Context context, int resource, ArrayList<Rule> objects)
|
||||
{
|
||||
super(context, resource, objects);
|
||||
@ -163,13 +159,13 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
if(AutomationService.isMyServiceRunning(this))
|
||||
bindToService();
|
||||
|
||||
if(requestCode == 3000) //add Rule
|
||||
if(requestCode == requestCodeCreateRule) //add Rule
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
}
|
||||
|
||||
if(requestCode == 4000) //editRule
|
||||
if(requestCode == requestCodeChangeRule) //editRule
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
@ -190,7 +186,7 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.whatToDoWithRule));
|
||||
alertDialogBuilder.setItems(new String[]{ getResources().getString(R.string.runManually), getResources().getString(R.string.edit), getResources().getString(R.string.deleteCapital) }, new DialogInterface.OnClickListener()
|
||||
alertDialogBuilder.setItems(new String[]{ getResources().getString(R.string.runManually), getResources().getString(R.string.edit), getResources().getString(R.string.deleteCapital), getResources().getString(R.string.clone) }, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
@ -212,11 +208,22 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
case 1:
|
||||
ruleToEdit = ruleThisIsAbout;
|
||||
Intent manageSpecificRuleIntent = new Intent (ActivityMainRules.this, ActivityManageRule.class);
|
||||
startActivityForResult(manageSpecificRuleIntent, 4000);
|
||||
startActivityForResult(manageSpecificRuleIntent, requestCodeChangeRule);
|
||||
break;
|
||||
case 2:
|
||||
if(ruleThisIsAbout.delete())
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
ruleToEdit = ruleThisIsAbout;
|
||||
if(ruleToEdit.cloneRule(ActivityMainRules.this))
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -229,6 +236,11 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
public void updateListView()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "ListView", "Attempting to update RuleListView", 4);
|
||||
|
||||
ruleList.clear();
|
||||
for(Rule r : Rule.getRuleCollection())
|
||||
ruleList.add(r);
|
||||
|
||||
try
|
||||
{
|
||||
if(ruleListView.getAdapter() == null)
|
||||
@ -242,7 +254,7 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
try
|
||||
{
|
||||
if(AutomationService.isMyServiceRunning(this))
|
||||
AlarmListener.reloadAlarms();
|
||||
DateTimeListener.reloadAlarms();
|
||||
}
|
||||
catch(NullPointerException e)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.jens.automation2.AutomationService.serviceCommands;
|
||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||
import com.jens.automation2.location.CellLocationChangedReceiver;
|
||||
import com.jens.automation2.location.LocationProvider;
|
||||
|
||||
import java.io.File;
|
||||
@ -43,8 +44,9 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
|
||||
private static ActivityMainScreen activityMainScreenInstance = null;
|
||||
private ToggleButton toggleService, tbLockSound;
|
||||
private Button bShowHelp, bPrivacy, bSettingsErase, bAddSoundLockTIme;
|
||||
private Button bShowHelp, bPrivacy, bSettingsErase, bAddSoundLockTIme, bDonate;
|
||||
private TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvlockSoundDuration;
|
||||
private static boolean updateNoteDisplayed = false;
|
||||
|
||||
private ListView lvRuleHistory;
|
||||
private ArrayAdapter<Rule> ruleHistoryListViewAdapter;
|
||||
@ -80,6 +82,12 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
tvlockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration);
|
||||
tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound);
|
||||
toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener);
|
||||
|
||||
bDonate = (Button)findViewById(R.id.bDonate);
|
||||
|
||||
if(!BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
|
||||
toggleService.setChecked(AutomationService.isMyServiceRunning(this));
|
||||
toggleService.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@ -109,6 +117,18 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
}
|
||||
});
|
||||
|
||||
bDonate.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
String privacyPolicyUrl = "https://server47.de/donate";
|
||||
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(privacyPolicyUrl));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
|
||||
tbLockSound.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
@ -407,6 +427,15 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
else
|
||||
activityMainScreenInstance.checkForNews();
|
||||
|
||||
if(BuildConfig.FLAVOR.equals("apkFlavor") && Settings.automaticUpdateCheck)
|
||||
{
|
||||
Calendar now = Calendar.getInstance();
|
||||
if (Settings.lastUpdateCheck == Settings.default_lastUpdateCheck || now.getTimeInMillis() >= Settings.lastUpdateCheck + (long)(Settings.updateCheckFrequencyDays * 24 * 60 * 60 * 1000))
|
||||
{
|
||||
activityMainScreenInstance.checkForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
Settings.considerDone(Settings.constNewsOptInDone);
|
||||
Settings.writeSettings(Miscellaneous.getAnyContext());
|
||||
}
|
||||
@ -588,6 +617,15 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
Miscellaneous.messageBox(title, text, ActivityMainScreen.getActivityMainScreenInstance());
|
||||
}
|
||||
|
||||
synchronized void checkForUpdate()
|
||||
{
|
||||
if(Settings.automaticUpdateCheck)
|
||||
{
|
||||
AsyncTasks.AsyncTaskUpdateCheck updateCheckTask = new AsyncTasks.AsyncTaskUpdateCheck();
|
||||
updateCheckTask.execute(ActivityMainScreen.this);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void checkForNews()
|
||||
{
|
||||
if(Settings.displayNewsOnMainScreen)
|
||||
@ -617,4 +655,38 @@ public class ActivityMainScreen extends ActivityGeneric
|
||||
Miscellaneous.logEvent("e", "Error displaying news", Log.getStackTraceString(e), 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void processUpdateCheckResult(Boolean result)
|
||||
{
|
||||
if(result && !updateNoteDisplayed)
|
||||
{
|
||||
updateNoteDisplayed = true;
|
||||
|
||||
AlertDialog.Builder updateNoteBuilder = new AlertDialog.Builder(ActivityMainScreen.this);
|
||||
updateNoteBuilder.setMessage(getResources().getString(R.string.updateAvailable));
|
||||
updateNoteBuilder.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
String url = "https://server47.de/automation/";
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(browserIntent);
|
||||
|
||||
updateNoteDisplayed = false;
|
||||
}
|
||||
});
|
||||
updateNoteBuilder.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
updateNoteDisplayed = false;
|
||||
}
|
||||
});
|
||||
updateNoteBuilder.show();
|
||||
}
|
||||
|
||||
AsyncTasks.AsyncTaskUpdateCheck.checkRunning = false;
|
||||
}
|
||||
}
|
@ -13,12 +13,17 @@ import com.jens.automation2.receivers.NfcReceiver;
|
||||
@SuppressLint("NewApi")
|
||||
public class ActivityMainTabLayout extends TabActivity
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main_tab_layout);
|
||||
|
||||
Settings.readFromPersistentStorage(ActivityMainTabLayout.this);
|
||||
|
||||
if(Settings.tabsPlacement == 1)
|
||||
setContentView(R.layout.main_tab_layout_tabs_at_bottom);
|
||||
else
|
||||
setContentView(R.layout.main_tab_layout_tabs_at_top);
|
||||
|
||||
TabHost tabHost = getTabHost();
|
||||
|
||||
|
@ -16,6 +16,8 @@ import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -27,7 +29,7 @@ public class ActivityMaintenance extends Activity
|
||||
|
||||
final static String prefsFileName = "com.jens.automation2_preferences.xml";
|
||||
|
||||
TextView tvFileStoreLocation;
|
||||
TextView tvFileStoreLocation, tvAppVersion;
|
||||
Button bVolumeTest, bMoreSettings, bSettingsSetToDefault, bShareConfigAndLog, bImportConfiguration, bExportConfiguration;
|
||||
|
||||
@Override
|
||||
@ -101,6 +103,13 @@ public class ActivityMaintenance extends Activity
|
||||
});
|
||||
|
||||
tvFileStoreLocation = (TextView)findViewById(R.id.tvFileStoreLocation);
|
||||
tvAppVersion = (TextView)findViewById(R.id.tvAppVersion);
|
||||
|
||||
tvAppVersion.setText(
|
||||
"Version: " + BuildConfig.VERSION_NAME + Miscellaneous.lineSeparator +
|
||||
"Version code: " + String.valueOf(BuildConfig.VERSION_CODE) + Miscellaneous.lineSeparator +
|
||||
"Flavor: " + BuildConfig.FLAVOR
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -192,6 +201,9 @@ public class ActivityMaintenance extends Activity
|
||||
try
|
||||
{
|
||||
XmlFileInterface.readFile();
|
||||
ActivityMainPoi.getInstance().updateListView();
|
||||
ActivityMainRules.getInstance().updateListView();
|
||||
ActivityMainProfiles.getInstance().updateListView();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -220,12 +232,19 @@ public class ActivityMaintenance extends Activity
|
||||
|
||||
// Clean up
|
||||
for(DocumentFile file : directory.listFiles())
|
||||
{
|
||||
/*
|
||||
On some few users' devices it seems this caused a crash because file.getName() was null.
|
||||
The reason for that remains unknown, but we don't want the export to crash because of it.
|
||||
*/
|
||||
if(!StringUtils.isEmpty(file.getName()))
|
||||
{
|
||||
if (file.getName().equals(XmlFileInterface.settingsFileName) && file.canWrite())
|
||||
file.delete();
|
||||
else if (file.getName().equals(prefsFileName) && file.canWrite())
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
DocumentFile dstRules = directory.createFile("text/xml", XmlFileInterface.settingsFileName);
|
||||
DocumentFile dstPrefs = directory.createFile("text/xml", prefsFileName);
|
||||
@ -298,17 +317,9 @@ public class ActivityMaintenance extends Activity
|
||||
|
||||
String subject = "Automation logs";
|
||||
|
||||
StringBuilder emailBody = new StringBuilder();
|
||||
emailBody.append("Device details" + Miscellaneous.lineSeparator);
|
||||
emailBody.append("OS version: " + System.getProperty("os.version") + Miscellaneous.lineSeparator);
|
||||
emailBody.append("API Level: " + android.os.Build.VERSION.SDK + Miscellaneous.lineSeparator);
|
||||
emailBody.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
|
||||
emailBody.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
|
||||
emailBody.append("Product: " + android.os.Build.PRODUCT);
|
||||
|
||||
Uri uri = Uri.parse("content://com.jens.automation2/" + Settings.zipFileName);
|
||||
|
||||
Miscellaneous.sendEmail(ActivityMaintenance.this, "android-development@gmx.de", "Automation logs", emailBody.toString(), uri);
|
||||
Miscellaneous.sendEmail(ActivityMaintenance.this, "android-development@gmx.de", "Automation logs", getSystemInfo(), uri);
|
||||
}
|
||||
});
|
||||
alertDialogBuilder.setNegativeButton(context.getResources().getString(R.string.no), null);
|
||||
@ -317,6 +328,19 @@ public class ActivityMaintenance extends Activity
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
public static String getSystemInfo()
|
||||
{
|
||||
StringBuilder systemInfoText = new StringBuilder();
|
||||
systemInfoText.append("Device details" + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("OS version: " + System.getProperty("os.version") + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("API Level: " + android.os.Build.VERSION.SDK + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Product: " + android.os.Build.PRODUCT + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Flavor: " + BuildConfig.FLAVOR);
|
||||
return systemInfoText.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@ -27,7 +26,7 @@ public class ActivityManageActionPlaySound extends Activity
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_manage_play_sound);
|
||||
setContentView(R.layout.activity_manage_action_play_sound);
|
||||
|
||||
chkPlaySoundAlwaysPlay = (CheckBox)findViewById(R.id.chkPlaySoundAlwaysPlay);
|
||||
etSelectedSoundFile = (EditText)findViewById(R.id.etSelectedSoundFile);
|
||||
|
@ -36,7 +36,7 @@ public class ActivityManageActionSendTextMessage extends Activity
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.setContentView(R.layout.send_textmessage_editor);
|
||||
this.setContentView(R.layout.activity_manage_action_send_textmessage);
|
||||
|
||||
etSendTextMessage = (EditText)findViewById(R.id.etSendTextMessage);
|
||||
etPhoneNumber = (EditText)findViewById(R.id.etPhoneNumber);
|
||||
@ -59,7 +59,7 @@ public class ActivityManageActionSendTextMessage extends Activity
|
||||
backToRuleManager();
|
||||
}
|
||||
else
|
||||
Toast.makeText(getBaseContext(), getResources().getString(R.string.textTooShort), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterPhoneNumberAndText), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -84,20 +84,10 @@ public class ActivityManageActionSendTextMessage extends Activity
|
||||
etPhoneNumber.setText(parameters[0]);
|
||||
etSendTextMessage.setText(parameters[1]);
|
||||
}
|
||||
|
||||
|
||||
// String url = getIntent().getStringExtra("urlToTrigger");
|
||||
// if(url != null)
|
||||
// existingUrl = url;
|
||||
}
|
||||
|
||||
private void backToRuleManager()
|
||||
{
|
||||
// Intent returnIntent = new Intent();
|
||||
// returnIntent.putExtra("urlToTrigger", existingUrl);
|
||||
|
||||
// setResult(RESULT_OK, returnIntent);
|
||||
|
||||
if(edit && resultingAction != null)
|
||||
{
|
||||
ActivityManageActionSendTextMessage.resultingAction.setParameter2(etPhoneNumber.getText().toString() + Actions.smsSeparator + etSendTextMessage.getText().toString());
|
||||
|
@ -24,7 +24,7 @@ public class ActivityManageActionSpeakText extends Activity
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.setContentView(R.layout.speak_text_editor);
|
||||
this.setContentView(R.layout.activity_manage_action_speak_text);
|
||||
|
||||
etSpeakText = (EditText)findViewById(R.id.etTextToSpeak);
|
||||
bSaveSpeakText = (Button)findViewById(R.id.bSaveTriggerUrl);
|
||||
@ -44,7 +44,7 @@ public class ActivityManageActionSpeakText extends Activity
|
||||
backToRuleManager();
|
||||
}
|
||||
else
|
||||
Toast.makeText(getBaseContext(), getResources().getString(R.string.textTooShort), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterPhoneNumberAndText), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
return null;
|
||||
}
|
||||
|
||||
private AlertDialog getActionStartActivityDialog1()
|
||||
private AlertDialog getActionStartActivityDialog1Application()
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.selectApplication));
|
||||
@ -241,33 +241,78 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
dialog.dismiss();
|
||||
getActionStartActivityDialog2(applicationArray[which]).show();
|
||||
getActionStartActivityDialog2(applicationArray[which]);
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
private AlertDialog getActionStartActivityDialog2(String applicationName)
|
||||
private void getActionStartActivityDialog2(String applicationName)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.selectPackageOfApplication));
|
||||
final String[] packageArray = ActivityManageActionStartActivity.getPackageListString(this, applicationName);
|
||||
if(packageArray.length > 1)
|
||||
{
|
||||
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
getActionStartActivityDialog3(packageArray[which]).show();
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
|
||||
|
||||
getActionStartActivityDialog4ActivityPickMethod(packageArray[which]).show();
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
getActionStartActivityDialog4ActivityPickMethod(packageArray[0]).show();
|
||||
}
|
||||
}
|
||||
|
||||
private AlertDialog getActionStartActivityDialog4ActivityPickMethod(final String packageName)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setMessage(getResources().getString(R.string.launcherOrManualExplanation));
|
||||
alertDialogBuilder.setPositiveButton(getResources().getString(R.string.takeLauncherActivity), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
// Pick the launcher automatically
|
||||
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
if (launchIntent != null)
|
||||
{
|
||||
ActivityInfo ai = ActivityManageActionStartActivity.getActivityInfoForPackageNameAndActivityName(packageName, launchIntent.getComponent().getClassName());
|
||||
etPackageName.setText(ai.packageName);
|
||||
etActivityOrActionPath.setText(ai.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
getActionStartActivityDialog5Activity(packageName).show();
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.launcherNotFound) + Miscellaneous.lineSeparator + getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialogBuilder.setNegativeButton(getResources().getString(R.string.pickActivityManually), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
getActionStartActivityDialog5Activity(packageName).show();
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
|
||||
}
|
||||
});
|
||||
|
||||
final String activityArray[] = ActivityManageActionStartActivity.getActivityListForPackageName(packageName);
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
private AlertDialog getActionStartActivityDialog3(final String packageName)
|
||||
|
||||
private AlertDialog getActionStartActivityDialog5Activity(final String packageName)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.selectActivityToBeStarted));
|
||||
@ -283,7 +328,6 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@ -598,7 +642,6 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@ -615,9 +658,7 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
protected void onPostExecute(Void result)
|
||||
{
|
||||
progressDialog.dismiss();
|
||||
getActionStartActivityDialog1().show();
|
||||
}
|
||||
|
||||
|
||||
getActionStartActivityDialog1Application().show();
|
||||
}
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public class ActivityManageActionTriggerUrl extends Activity
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.setContentView(R.layout.activity_manage_action_url_editor);
|
||||
this.setContentView(R.layout.activity_manage_action_trigger_url);
|
||||
|
||||
etTriggerUrl = (EditText)findViewById(R.id.etTriggerUrl);
|
||||
etTriggerUrlUsername = (EditText)findViewById(R.id.etTriggerUrlUsername);
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class ActivityManageActionVibrate extends Activity
|
||||
{
|
||||
TextView etVibratePattern;
|
||||
Button bTestVibratePattern, bSaveVibratePattern;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_manage_action_vibrate);
|
||||
|
||||
etVibratePattern = (EditText)findViewById(R.id.etVibratePattern);
|
||||
bTestVibratePattern = (Button)findViewById(R.id.bTestVibratePattern);
|
||||
bSaveVibratePattern = (Button)findViewById(R.id.bSaveVibratePattern);
|
||||
|
||||
bSaveVibratePattern.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
if(checkInput())
|
||||
{
|
||||
Intent answer = new Intent();
|
||||
answer.putExtra("vibratePattern", etVibratePattern.getText().toString());
|
||||
setResult(RESULT_OK, answer);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bTestVibratePattern.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
if(checkInput())
|
||||
{
|
||||
if (ActivityPermissions.havePermission(Manifest.permission.VIBRATE, ActivityManageActionVibrate.this))
|
||||
{
|
||||
String pattern = etVibratePattern.getText().toString();
|
||||
Actions.vibrate(false, pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Intent input = getIntent();
|
||||
|
||||
if(input.hasExtra("vibratePattern"))
|
||||
etVibratePattern.setText(input.getStringExtra("vibratePattern"));
|
||||
}
|
||||
|
||||
boolean checkInput()
|
||||
{
|
||||
String vibratePattern = etVibratePattern.getText().toString();
|
||||
String regex = "^[0-9,]+$";
|
||||
if(StringUtils.isEmpty(vibratePattern) || !vibratePattern.matches(regex) || vibratePattern.substring(0, 1).equals(",") || vibratePattern.substring(vibratePattern.length()-1).equals(","))
|
||||
{
|
||||
Toast.makeText(ActivityManageActionVibrate.this, getResources().getString(R.string.pleaseEnterValidVibrationPattern), Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -21,6 +22,12 @@ import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.jens.automation2.receivers.ConnectivityReceiver;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class ActivityManagePoi extends Activity
|
||||
{
|
||||
public LocationManager myLocationManager;
|
||||
@ -31,6 +38,11 @@ public class ActivityManagePoi extends Activity
|
||||
Button bGetPosition, bSavePoi;
|
||||
ImageButton ibShowOnMap;
|
||||
EditText guiPoiName, guiPoiLatitude, guiPoiLongitude, guiPoiRadius;
|
||||
Calendar locationSearchStart = null;
|
||||
Timer timer = null;
|
||||
|
||||
final static int defaultRadius = 250;
|
||||
final static int searchTimeout = 120;
|
||||
|
||||
private static ProgressDialog progressDialog;
|
||||
|
||||
@ -104,7 +116,7 @@ public class ActivityManagePoi extends Activity
|
||||
myLocationManager.removeUpdates(myLocationListenerGps);
|
||||
ActivityMainPoi.poiToEdit = new PointOfInterest();
|
||||
ActivityMainPoi.poiToEdit.setLocation(new Location("POINT_LOCATION"));
|
||||
if(loadFormValuesToVariable())
|
||||
if(loadFormValuesToVariable(false))
|
||||
if(ActivityMainPoi.poiToEdit.create(this))
|
||||
{
|
||||
this.setResult(RESULT_OK);
|
||||
@ -114,7 +126,7 @@ public class ActivityManagePoi extends Activity
|
||||
private void changePoi()
|
||||
{
|
||||
myLocationManager.removeUpdates(myLocationListenerGps);
|
||||
if(loadFormValuesToVariable())
|
||||
if(loadFormValuesToVariable(false))
|
||||
if(ActivityMainPoi.poiToEdit.change(this))
|
||||
{
|
||||
this.setResult(RESULT_OK);
|
||||
@ -149,49 +161,143 @@ public class ActivityManagePoi extends Activity
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
locationSearchStart = Calendar.getInstance();
|
||||
startTimeout();
|
||||
|
||||
if(!Settings.privacyLocationing || !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider1, 3);
|
||||
myLocationManager.requestLocationUpdates(provider1, 500, Settings.satisfactoryAccuracyNetwork, myLocationListenerNetwork);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "POI Manager", "Skipping network location query because private locationing is active.", 4);
|
||||
|
||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider2, 3);
|
||||
myLocationManager.requestLocationUpdates(provider2, 500, Settings.satisfactoryAccuracyGps, myLocationListenerGps);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void compareLocations()
|
||||
private void startTimeout()
|
||||
{
|
||||
if(timer != null)
|
||||
stopTimeout();
|
||||
|
||||
timer = new Timer();
|
||||
|
||||
class TimeoutTask extends TimerTask
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
evaluateLocationResults();
|
||||
}
|
||||
}
|
||||
|
||||
Miscellaneous.logEvent("i", "POI Manager", "Starting timeout for location search: " + String.valueOf(searchTimeout) + " seconds", 5);
|
||||
|
||||
TimerTask timeoutTask = new TimeoutTask();
|
||||
timer.schedule(timeoutTask, searchTimeout * 1000);
|
||||
}
|
||||
|
||||
private void stopTimeout()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI Manager", "Stopping timeout for location search.", 5);
|
||||
|
||||
if(timer != null)
|
||||
{
|
||||
timer.purge();
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void evaluateLocationResults()
|
||||
{
|
||||
/*
|
||||
Procedure:
|
||||
If we get a GPS result we take it and suggest a default minimum radius.
|
||||
If private locationing is active that's the only possible outcome other than a timeout.
|
||||
|
||||
If private locationing is not active
|
||||
If we get a network
|
||||
*/
|
||||
|
||||
// We have GPS
|
||||
if(locationGps != null)
|
||||
{
|
||||
myLocationManager.removeUpdates(myLocationListenerNetwork);
|
||||
|
||||
guiPoiLatitude.setText(String.valueOf(locationGps.getLatitude()));
|
||||
guiPoiLongitude.setText(String.valueOf(locationGps.getLongitude()));
|
||||
|
||||
String text;
|
||||
if(locationNetwork != null)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.comparing), 4);
|
||||
|
||||
double variance = locationGps.distanceTo(locationNetwork);
|
||||
|
||||
String text = String.format(getResources().getString(R.string.distanceBetween), Math.round(variance));
|
||||
|
||||
// Toast.makeText(getBaseContext(), text, Toast.LENGTH_LONG).show();
|
||||
Miscellaneous.logEvent("i", "POI Manager", text, 4);
|
||||
// if(variance > 50 && guiPoiRadius.getText().toString().length()>0 && Integer.parseInt(guiPoiRadius.getText().toString())<variance)
|
||||
// {
|
||||
// String text = "Positioning via network is off by " + variance + " meters. The radius you specify shouldn't be smaller than that.";
|
||||
getDialog(text, Math.round(variance) + 1).show();
|
||||
// Toast.makeText(getBaseContext(), "Positioning via network is off by " + variance + " meters. The radius you specify shouldn't be smaller than that.", Toast.LENGTH_LONG).show();
|
||||
// }
|
||||
text = String.format(getResources().getString(R.string.distanceBetween), Math.round(variance));
|
||||
getRadiusConfirmationDialog(text, Math.round(variance) + 1).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
progressDialog.dismiss();
|
||||
myLocationManager.removeUpdates(myLocationListenerNetwork);
|
||||
guiPoiRadius.setText("250");
|
||||
text = String.format(getResources().getString(R.string.locationFound), defaultRadius);
|
||||
getRadiusConfirmationDialog(text, defaultRadius).show();
|
||||
}
|
||||
Miscellaneous.logEvent("i", "POI Manager", text, 4);
|
||||
} // we have a great network signal:
|
||||
else if(locationNetwork != null && locationNetwork.getAccuracy() <= Settings.satisfactoryAccuracyGps && locationNetwork.getAccuracy() <= defaultRadius)
|
||||
{
|
||||
/*
|
||||
We do not yet have a GPS result. But we have a network result that is good enough
|
||||
to accept it a sole result. In that case we suggest a default radius, no variance.
|
||||
*/
|
||||
|
||||
guiPoiLatitude.setText(String.valueOf(locationNetwork.getLatitude()));
|
||||
guiPoiLongitude.setText(String.valueOf(locationNetwork.getLongitude()));
|
||||
|
||||
String text = String.format(getResources().getString(R.string.locationFound), defaultRadius);
|
||||
Miscellaneous.logEvent("i", "POI Manager", text, 4);
|
||||
|
||||
getRadiusConfirmationDialog(text, defaultRadius).show();
|
||||
}
|
||||
else if( // we have a bad network signal and nothing else, GPS result may still come in
|
||||
locationNetwork != null
|
||||
&&
|
||||
Calendar.getInstance().getTimeInMillis()
|
||||
<
|
||||
(locationSearchStart.getTimeInMillis() + ((long)searchTimeout * 1000))
|
||||
)
|
||||
{
|
||||
// Only a network location was found and it is also not very accurate.
|
||||
}
|
||||
else if( // we have a bad network signal and nothing else, timeout has expired, nothing else can possibly come in
|
||||
locationNetwork != null
|
||||
&&
|
||||
Calendar.getInstance().getTimeInMillis()
|
||||
>
|
||||
(locationSearchStart.getTimeInMillis() + ((long)searchTimeout * 1000))
|
||||
)
|
||||
{
|
||||
// Only a network location was found and it is also not very accurate.
|
||||
|
||||
guiPoiLatitude.setText(String.valueOf(locationNetwork.getLatitude()));
|
||||
guiPoiLongitude.setText(String.valueOf(locationNetwork.getLongitude()));
|
||||
|
||||
String text = String.format(getResources().getString(R.string.locationFoundInaccurate), defaultRadius);
|
||||
getRadiusConfirmationDialog(text, defaultRadius).show();
|
||||
Miscellaneous.logEvent("i", "POI Manager", text, 4);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logNotAllMeasurings), 4);
|
||||
{
|
||||
String text = String.format(getResources().getString(R.string.noLocationCouldBeFound), String.valueOf(searchTimeout));
|
||||
Miscellaneous.logEvent("i", "POI Manager", text, 2);
|
||||
|
||||
if(myLocationListenerNetwork != null)
|
||||
myLocationManager.removeUpdates(myLocationListenerNetwork);
|
||||
|
||||
myLocationManager.removeUpdates(myLocationListenerGps);
|
||||
progressDialog.dismiss();
|
||||
getErrorDialog(text).show();
|
||||
}
|
||||
}
|
||||
|
||||
private AlertDialog getNotificationDialog(String text)
|
||||
@ -203,15 +309,6 @@ public class ActivityManagePoi extends Activity
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
// switch(which)
|
||||
// {
|
||||
// case DialogInterface.BUTTON_POSITIVE:
|
||||
// guiPoiRadius.setText(String.valueOf(value));
|
||||
// break;
|
||||
// case DialogInterface.BUTTON_NEGATIVE:
|
||||
// break;
|
||||
// }
|
||||
|
||||
progressDialog = ProgressDialog.show(ActivityManagePoi.this, "", getResources().getString(R.string.gettingPosition), true, true);
|
||||
getLocation();
|
||||
}
|
||||
@ -222,8 +319,11 @@ public class ActivityManagePoi extends Activity
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
private AlertDialog getDialog(String text, final double value)
|
||||
|
||||
private AlertDialog getRadiusConfirmationDialog(String text, final double value)
|
||||
{
|
||||
stopTimeout();
|
||||
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener()
|
||||
{
|
||||
@ -249,9 +349,30 @@ public class ActivityManagePoi extends Activity
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
private AlertDialog getErrorDialog(String text)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
};
|
||||
alertDialogBuilder.setMessage(text);
|
||||
alertDialogBuilder.setPositiveButton(getResources().getString(R.string.ok), null);
|
||||
|
||||
if (Looper.myLooper() == null)
|
||||
Looper.prepare();
|
||||
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
public class MyLocationListenerGps implements LocationListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location)
|
||||
{
|
||||
@ -261,10 +382,11 @@ public class ActivityManagePoi extends Activity
|
||||
// {
|
||||
// Miscellaneous.logEvent("i", "POI Manager", "satisfactoryNetworkAccuracy of " + String.valueOf(Settings.SATISFACTORY_ACCURACY_GPS) + "m reached. Removing location updates...");
|
||||
|
||||
Miscellaneous.logEvent("i", "POI Manager", "Unsubscribing from GPS location updates.", 5);
|
||||
myLocationManager.removeUpdates(this);
|
||||
locationGps = location;
|
||||
|
||||
compareLocations();
|
||||
evaluateLocationResults();
|
||||
// }
|
||||
}
|
||||
|
||||
@ -288,66 +410,27 @@ public class ActivityManagePoi extends Activity
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// public class MyLocationListenerWifi implements LocationListener
|
||||
// {
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChanged(Location location)
|
||||
// {
|
||||
// Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.gotGpsUpdate) + " " + String.valueOf(location.getAccuracy()));
|
||||
// // Deactivate when accuracy reached
|
||||
//// if(location.getAccuracy() < Settings.SATISFACTORY_ACCURACY_GPS)
|
||||
//// {
|
||||
//// Miscellaneous.logEvent("i", "POI Manager", "satisfactoryNetworkAccuracy of " + String.valueOf(Settings.SATISFACTORY_ACCURACY_GPS) + "m reached. Removing location updates...");
|
||||
//
|
||||
// myLocationManager.removeUpdates(this);
|
||||
// locationGps = location;
|
||||
//
|
||||
// compareLocations();
|
||||
//// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProviderDisabled(String provider)
|
||||
// {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProviderEnabled(String provider)
|
||||
// {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStatusChanged(String provider, int status, Bundle extras)
|
||||
// {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
public class MyLocationListenerNetwork implements LocationListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGotNetworkUpdate) + " " + String.valueOf(location.getAccuracy()), 3);
|
||||
// Deactivate when accuracy reached
|
||||
// if(location.getAccuracy() < Settings.SATISFACTORY_ACCURACY_GPS)
|
||||
// {
|
||||
// String text = "Network position found. satisfactoryNetworkAccuracy of " + String.valueOf(Settings.SATISFACTORY_ACCURACY_NETWORK) + "m reached. Removing location updates...";
|
||||
// Miscellaneous.logEvent("i", "POI Manager", text);
|
||||
|
||||
myLocationManager.removeUpdates(this);
|
||||
locationNetwork = location;
|
||||
|
||||
compareLocations();
|
||||
// }
|
||||
// Deactivate when accuracy reached
|
||||
if(location.getAccuracy() <= Settings.satisfactoryAccuracyGps)
|
||||
{
|
||||
// Accuracy is so good that we don't need to wait for GPS result
|
||||
Miscellaneous.logEvent("i", "POI Manager", "Unsubscribing from network location updates.", 5);
|
||||
myLocationManager.removeUpdates(myLocationListenerGps);
|
||||
}
|
||||
|
||||
evaluateLocationResults();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -370,7 +453,6 @@ public class ActivityManagePoi extends Activity
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void editPoi(PointOfInterest poi)
|
||||
@ -381,11 +463,13 @@ public class ActivityManagePoi extends Activity
|
||||
guiPoiRadius.setText(String.valueOf(poi.getRadius()));
|
||||
}
|
||||
|
||||
public boolean loadFormValuesToVariable()
|
||||
public boolean loadFormValuesToVariable(boolean checkOnlyCoordinates)
|
||||
{
|
||||
if(ActivityMainPoi.poiToEdit == null)
|
||||
ActivityMainPoi.poiToEdit = new PointOfInterest();
|
||||
|
||||
if(!checkOnlyCoordinates)
|
||||
{
|
||||
if (guiPoiName.getText().length() == 0)
|
||||
{
|
||||
Toast.makeText(this, getResources().getString(R.string.pleaseEnterValidName), Toast.LENGTH_LONG).show();
|
||||
@ -393,6 +477,7 @@ public class ActivityManagePoi extends Activity
|
||||
}
|
||||
else
|
||||
ActivityMainPoi.poiToEdit.setName(guiPoiName.getText().toString());
|
||||
}
|
||||
|
||||
if(ActivityMainPoi.poiToEdit.getLocation() == null)
|
||||
ActivityMainPoi.poiToEdit.setLocation(new Location("POINT_LOCATION"));
|
||||
@ -417,6 +502,8 @@ public class ActivityManagePoi extends Activity
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!checkOnlyCoordinates)
|
||||
{
|
||||
try
|
||||
{
|
||||
ActivityMainPoi.poiToEdit.setRadius(Double.parseDouble(guiPoiRadius.getText().toString()), this);
|
||||
@ -431,13 +518,14 @@ public class ActivityManagePoi extends Activity
|
||||
Toast.makeText(this, getResources().getString(R.string.unknownError), Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showOnMap()
|
||||
{
|
||||
if(loadFormValuesToVariable())
|
||||
if(loadFormValuesToVariable(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
@ -37,8 +38,8 @@ public class ActivityManageProfile extends Activity
|
||||
final static int intentCodeRingtonePickerNotificationsFile = 9020;
|
||||
final static int intentCodeRingtonePickerNotificationsRingtone = 9021;
|
||||
|
||||
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback;
|
||||
Spinner spinnerSoundMode;
|
||||
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback, checkBoxChangeDnd;
|
||||
Spinner spinnerSoundMode, spinnerDndMode;
|
||||
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms;
|
||||
Button bChangeSoundIncomingCalls, bChangeSoundNotifications, bSaveProfile;
|
||||
TextView tvIncomingCallsRingtone, tvNotificationsRingtone;
|
||||
@ -47,6 +48,7 @@ public class ActivityManageProfile extends Activity
|
||||
File incomingCallsRingtone = null, notificationsRingtone = null;
|
||||
|
||||
ArrayAdapter<String> soundModeAdapter;
|
||||
ArrayAdapter<String> dndModeAdapter;
|
||||
|
||||
public void setIncomingCallsRingtone(File incomingCallsRingtone)
|
||||
{
|
||||
@ -85,6 +87,7 @@ public class ActivityManageProfile extends Activity
|
||||
this.setContentView(R.layout.activity_manage_specific_profile);
|
||||
|
||||
checkBoxChangeSoundMode = (CheckBox)findViewById(R.id.checkBoxChangeSoundMode);
|
||||
checkBoxChangeDnd = (CheckBox)findViewById(R.id.checkBoxChangeDnd);
|
||||
checkBoxChangeVolumeMusicVideoGameMedia = (CheckBox)findViewById(R.id.checkBoxChangeVolumeMusicVideoGameMedia);
|
||||
checkBoxChangeVolumeNotifications = (CheckBox)findViewById(R.id.checkBoxChangeVolumeNotifications);
|
||||
checkBoxChangeVolumeAlarms = (CheckBox)findViewById(R.id.checkBoxChangeVolumeAlarms);
|
||||
@ -99,6 +102,7 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxHapticFeedback = (CheckBox)findViewById(R.id.checkBoxHapticFeedback);
|
||||
checkBoxVibrateWhenRinging = (CheckBox)findViewById(R.id.checkBoxVibrateWhenRinging);
|
||||
spinnerSoundMode = (Spinner)findViewById(R.id.spinnerSoundMode);
|
||||
spinnerDndMode = (Spinner)findViewById(R.id.spinnerDndMode);
|
||||
seekBarVolumeMusic = (SeekBar)findViewById(R.id.seekBarVolumeMusic);
|
||||
seekBarVolumeNotifications = (SeekBar)findViewById(R.id.seekBarVolumeNotifications);
|
||||
seekBarVolumeAlarms = (SeekBar)findViewById(R.id.seekBarVolumeAlarms);
|
||||
@ -114,6 +118,7 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxScreenLockUnlockSound.setEnabled(false);
|
||||
checkBoxHapticFeedback.setEnabled(false);
|
||||
spinnerSoundMode.setEnabled(false);
|
||||
spinnerDndMode.setEnabled(false);
|
||||
seekBarVolumeMusic.setEnabled(false);
|
||||
seekBarVolumeNotifications.setEnabled(false);
|
||||
seekBarVolumeAlarms.setEnabled(false);
|
||||
@ -121,6 +126,14 @@ public class ActivityManageProfile extends Activity
|
||||
bChangeSoundNotifications.setEnabled(false);
|
||||
|
||||
spinnerSoundMode.setSelection(0);
|
||||
spinnerDndMode.setSelection(0);
|
||||
|
||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
{
|
||||
// Disable DND controls
|
||||
checkBoxChangeDnd.setEnabled(false);
|
||||
spinnerDndMode.setEnabled(false);
|
||||
}
|
||||
|
||||
// Scale SeekBars to the system's maximum volume values
|
||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
@ -128,9 +141,31 @@ public class ActivityManageProfile extends Activity
|
||||
seekBarVolumeNotifications.setMax(am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION));
|
||||
seekBarVolumeAlarms.setMax(am.getStreamMaxVolume(AudioManager.STREAM_ALARM));
|
||||
|
||||
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[] { getResources().getString(R.string.soundModeSilent), getResources().getString(R.string.soundModeVibrate), getResources().getString(R.string.soundModeNormal) });
|
||||
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
|
||||
{
|
||||
getResources().getString(R.string.soundModeSilent),
|
||||
getResources().getString(R.string.soundModeVibrate),
|
||||
getResources().getString(R.string.soundModeNormal)
|
||||
});
|
||||
spinnerSoundMode.setAdapter(soundModeAdapter);
|
||||
|
||||
dndModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
|
||||
{
|
||||
getResources().getString(R.string.dndOff),
|
||||
getResources().getString(R.string.dndPriority),
|
||||
getResources().getString(R.string.dndNothing),
|
||||
getResources().getString(R.string.dndAlarms)
|
||||
});
|
||||
spinnerDndMode.setAdapter(dndModeAdapter);
|
||||
/*
|
||||
Order in spinner: 1, 2, 4, 3
|
||||
NotificationManager.INTERRUPTION_FILTER_UNKNOWN -> Returned when the value is unavailable for any reason.
|
||||
NotificationManager.INTERRUPTION_FILTER_ALL -> 1 -> Normal interruption filter - no notifications are suppressed. -> essentially turn off DND
|
||||
NotificationManager.INTERRUPTION_FILTER_PRIORITY -> 2 -> Priority interruption filter - all notifications are suppressed except those that match the priority criteria.
|
||||
NotificationManager.INTERRUPTION_FILTER_ALARMS -> 4 -> Alarms only interruption filter - all notifications except those of category
|
||||
NotificationManager.INTERRUPTION_FILTER_NONE -> 3 -> No interruptions filter - all notifications are suppressed and all audio streams (except those used for phone calls) and vibrations are muted.
|
||||
*/
|
||||
|
||||
checkBoxChangeSoundMode.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
@ -139,6 +174,14 @@ public class ActivityManageProfile extends Activity
|
||||
spinnerSoundMode.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
checkBoxChangeDnd.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
spinnerDndMode.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
checkBoxChangeVolumeMusicVideoGameMedia.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
@ -327,6 +370,7 @@ public class ActivityManageProfile extends Activity
|
||||
{
|
||||
etName.setText(ActivityMainProfiles.profileToEdit.getName());
|
||||
checkBoxChangeSoundMode.setChecked(ActivityMainProfiles.profileToEdit.getChangeSoundMode());
|
||||
checkBoxChangeDnd.setChecked(ActivityMainProfiles.profileToEdit.getChangeDndMode());
|
||||
checkBoxChangeVolumeMusicVideoGameMedia.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeMusicVideoGameMedia());
|
||||
checkBoxChangeVolumeNotifications.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeNotifications());
|
||||
checkBoxChangeVolumeAlarms.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeAlarms());
|
||||
@ -338,6 +382,7 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxChangeVibrateWhenRinging.setChecked(ActivityMainProfiles.profileToEdit.getChangeVibrateWhenRinging());
|
||||
|
||||
spinnerSoundMode.setSelection(ActivityMainProfiles.profileToEdit.getSoundMode());
|
||||
spinnerDndMode.setSelection(ActivityMainProfiles.profileToEdit.getDndMode()-1);
|
||||
seekBarVolumeMusic.setProgress(ActivityMainProfiles.profileToEdit.getVolumeMusic());
|
||||
seekBarVolumeNotifications.setProgress(ActivityMainProfiles.profileToEdit.getVolumeNotifications());
|
||||
seekBarVolumeAlarms.setProgress(ActivityMainProfiles.profileToEdit.getVolumeAlarms());
|
||||
@ -359,6 +404,7 @@ public class ActivityManageProfile extends Activity
|
||||
|
||||
ActivityMainProfiles.profileToEdit.setName(etName.getText().toString());
|
||||
ActivityMainProfiles.profileToEdit.setChangeSoundMode(checkBoxChangeSoundMode.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeDndMode(checkBoxChangeDnd.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeMusicVideoGameMedia(checkBoxChangeVolumeMusicVideoGameMedia.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeNotifications(checkBoxChangeVolumeNotifications.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeAlarms(checkBoxChangeVolumeAlarms.isChecked());
|
||||
@ -374,6 +420,7 @@ public class ActivityManageProfile extends Activity
|
||||
ActivityMainProfiles.profileToEdit.setHapticFeedback(checkBoxHapticFeedback.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setVibrateWhenRinging(checkBoxVibrateWhenRinging.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setSoundMode(spinnerSoundMode.getSelectedItemPosition());
|
||||
ActivityMainProfiles.profileToEdit.setDndMode(spinnerDndMode.getSelectedItemPosition()+1);
|
||||
ActivityMainProfiles.profileToEdit.setVolumeMusic(seekBarVolumeMusic.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setVolumeNotifications(seekBarVolumeNotifications.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setVolumeAlarms(seekBarVolumeAlarms.getProgress());
|
||||
@ -401,21 +448,23 @@ public class ActivityManageProfile extends Activity
|
||||
}
|
||||
|
||||
if(!checkBoxChangeSoundMode.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeDnd.isChecked()
|
||||
&&
|
||||
!checkBoxChangeVolumeMusicVideoGameMedia.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeVolumeNotifications.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeVolumeAlarms.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeIncomingCallsRingtone.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeNotificationRingtone.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeAudibleSelection.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeScreenLockUnlockSound.isChecked()
|
||||
&
|
||||
&&
|
||||
!checkBoxChangeHapticFeedback.isChecked()
|
||||
)
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -13,6 +13,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -48,32 +49,36 @@ import java.util.Collections;
|
||||
public class ActivityManageRule extends Activity
|
||||
{
|
||||
final static String activityDetectionClassPath = "com.jens.automation2.receivers.ActivityDetectionReceiver";
|
||||
public final static String intentNameTriggerParameter1 = "triggerParameter1";
|
||||
public final static String intentNameTriggerParameter2 = "triggerParameter2";
|
||||
public final static String intentNameActionParameter1 = "actionParameter1";
|
||||
public final static String intentNameActionParameter2 = "actionParameter2";
|
||||
|
||||
public Context context;
|
||||
private Button cmdTriggerAdd, cmdActionAdd, cmdSaveRule;
|
||||
private ListView triggerListView, actionListView;
|
||||
private EditText etRuleName;
|
||||
private CheckBox chkRuleActive, chkRuleToggle;
|
||||
private static ActivityManageRule instance = null;
|
||||
Button cmdTriggerAdd, cmdActionAdd, cmdSaveRule;
|
||||
ListView triggerListView, actionListView;
|
||||
EditText etRuleName;
|
||||
CheckBox chkRuleActive, chkRuleToggle;
|
||||
static ActivityManageRule instance = null;
|
||||
ImageView imageHelpButton;
|
||||
|
||||
private static ProgressDialog progressDialog = null;
|
||||
static ProgressDialog progressDialog = null;
|
||||
|
||||
private static Trigger_Enum triggerType;
|
||||
private static boolean triggerParameter;
|
||||
private static PointOfInterest triggerPoi;
|
||||
private static String triggerProcess;
|
||||
private static int triggerBattery;
|
||||
private static double triggerSpeed;
|
||||
private static double triggerNoise;
|
||||
private static TimeFrame triggerTimeFrame;
|
||||
private static String triggerWifiName;
|
||||
static Trigger_Enum triggerType;
|
||||
static boolean triggerParameter;
|
||||
static PointOfInterest triggerPoi;
|
||||
static String triggerProcess;
|
||||
static int triggerBattery;
|
||||
static double triggerSpeed;
|
||||
static double triggerNoise;
|
||||
static TimeFrame triggerTimeFrame;
|
||||
static String triggerWifiName;
|
||||
|
||||
private static Rule ruleToEdit;
|
||||
private static boolean newRule;
|
||||
static Rule ruleToEdit;
|
||||
static boolean newRule;
|
||||
|
||||
private static Trigger newTrigger;
|
||||
private static Action newAction;
|
||||
static Trigger newTrigger;
|
||||
static Action newAction;
|
||||
|
||||
ArrayAdapter<Trigger> triggerListViewAdapter;
|
||||
ArrayAdapter<Action> actionListViewAdapter;
|
||||
@ -88,21 +93,28 @@ public class ActivityManageRule extends Activity
|
||||
final static int requestCodeActionStartActivityEdit = 3001;
|
||||
final static int requestCodeTriggerNfcTagAdd = 4000;
|
||||
final static int requestCodeTriggerNfcTagEdit = 4001;
|
||||
final static int requestCodeActionSpeakTextAdd = 5000;
|
||||
final static int requestCodeActionSpeakTextEdit = 1001;
|
||||
final static int requestCodeActionSpeakTextAdd = 5101;
|
||||
final static int requestCodeActionSpeakTextEdit = 5102;
|
||||
final static int requestCodeTriggerBluetoothAdd = 6000;
|
||||
final static int requestCodeTriggerBluetoothEdit = 6001;
|
||||
final static int requestCodeActionScreenBrightnessAdd = 401;
|
||||
final static int requestCodeActionScreenBrightnessEdit = 402;
|
||||
final static int requestCodeActionSendTextMessage = 7001;
|
||||
final static int requestCodeTriggerDeviceOrientationAdd = 301;
|
||||
final static int requestCodeTriggerDeviceOrientationEdit = 302;
|
||||
final static int requestCodeTriggerNotificationAdd = 8000;
|
||||
final static int requestCodeTriggerNfcNotificationEdit = 8001;
|
||||
final static int requestCodeActionPlaySoundAdd = 501;
|
||||
final static int requestCodeActionPlaySoundEdit = 502;
|
||||
final static int requestCodeTriggerPhoneCallAdd = 601;
|
||||
final static int requestCodeTriggerPhoneCallEdit = 602;
|
||||
final static int requestCodeTriggerProfileAdd = 603;
|
||||
final static int requestCodeTriggerProfileEdit = 604;
|
||||
final static int requestCodeTriggerWifiAdd = 723;
|
||||
final static int requestCodeTriggerWifiEdit = 724;
|
||||
final static int requestCodeActionSendTextMessageAdd = 5001;
|
||||
final static int requestCodeActionSendTextMessageEdit = 5002;
|
||||
final static int requestCodeActionVibrateAdd = 801;
|
||||
final static int requestCodeActionVibrateEdit = 802;
|
||||
|
||||
public static ActivityManageRule getInstance()
|
||||
{
|
||||
@ -117,7 +129,7 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
context = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.manage_specific_rule);
|
||||
setContentView(R.layout.activity_manage_specific_rule);
|
||||
|
||||
instance = this;
|
||||
|
||||
@ -161,7 +173,13 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
hideKeyboard();
|
||||
newTrigger = new Trigger();
|
||||
getTriggerTypeDialog(context).show();
|
||||
|
||||
AlertDialog dia = getTriggerTypeDialog(context);
|
||||
|
||||
if(Miscellaneous.isDarkModeEnabled(ActivityManageRule.this))
|
||||
dia.getListView().setBackgroundColor(getResources().getColor(R.color.darkScreenBackgroundColor));
|
||||
|
||||
dia.show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -171,7 +189,13 @@ public class ActivityManageRule extends Activity
|
||||
public void onClick(View v)
|
||||
{
|
||||
hideKeyboard();
|
||||
getActionTypeDialog().show();
|
||||
|
||||
AlertDialog dia = getActionTypeDialog();
|
||||
|
||||
if(Miscellaneous.isDarkModeEnabled(ActivityManageRule.this))
|
||||
dia.getListView().setBackgroundColor(getResources().getColor(R.color.darkScreenBackgroundColor));
|
||||
|
||||
dia.show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -228,27 +252,11 @@ public class ActivityManageRule extends Activity
|
||||
Trigger selectedTrigger = (Trigger)triggerListView.getItemAtPosition(arg2);
|
||||
switch(selectedTrigger.getTriggerType())
|
||||
{
|
||||
// case batteryLevel:
|
||||
// break;
|
||||
// case charging:
|
||||
// break;
|
||||
// case noiseLevel:
|
||||
// break;
|
||||
// case pointOfInterest:
|
||||
// break;
|
||||
// case process_started_stopped:
|
||||
// break;
|
||||
// case speed:
|
||||
// break;
|
||||
case timeFrame:
|
||||
ActivityManageTriggerTimeFrame.editedTimeFrameTrigger = selectedTrigger;
|
||||
Intent timeFrameEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerTimeFrame.class);
|
||||
startActivityForResult(timeFrameEditor, requestCodeTriggerTimeframeEdit);
|
||||
break;
|
||||
// case usb_host_connection:
|
||||
// break;
|
||||
// case wifiConnection:
|
||||
// break;
|
||||
case bluetoothConnection:
|
||||
ActivityManageTriggerBluetooth.editedBluetoothTrigger = selectedTrigger;
|
||||
Intent bluetoothEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerBluetooth.class);
|
||||
@ -266,13 +274,25 @@ public class ActivityManageRule extends Activity
|
||||
phoneCallEditor.putExtra("edit", true);
|
||||
startActivityForResult(phoneCallEditor, requestCodeTriggerPhoneCallEdit);
|
||||
break;
|
||||
case profileActive:
|
||||
Intent profileActiveEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerProfile.class);
|
||||
profileActiveEditor.putExtra(ActivityManageRule.intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
|
||||
profileActiveEditor.putExtra(ActivityManageRule.intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
|
||||
startActivityForResult(profileActiveEditor, requestCodeTriggerProfileEdit);
|
||||
break;
|
||||
case wifiConnection:
|
||||
Intent wifiEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerWifi.class);
|
||||
wifiEditor.putExtra("edit", true);
|
||||
wifiEditor.putExtra("wifiState", selectedTrigger.getTriggerParameter());
|
||||
wifiEditor.putExtra("wifiName", selectedTrigger.getTriggerParameter2());
|
||||
wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiState, selectedTrigger.getTriggerParameter());
|
||||
wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiName, selectedTrigger.getTriggerParameter2());
|
||||
startActivityForResult(wifiEditor, requestCodeTriggerWifiEdit);
|
||||
break;
|
||||
case deviceOrientation:
|
||||
Intent devicePositionEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerDeviceOrientation.class);
|
||||
devicePositionEditor.putExtra(ActivityManageRule.intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
|
||||
devicePositionEditor.putExtra(ActivityManageTriggerDeviceOrientation.vectorFieldName, selectedTrigger.getTriggerParameter2());
|
||||
startActivityForResult(devicePositionEditor, requestCodeTriggerDeviceOrientationEdit);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -306,14 +326,6 @@ public class ActivityManageRule extends Activity
|
||||
Action a = (Action)actionListView.getItemAtPosition(arg2);
|
||||
switch(a.getAction())
|
||||
{
|
||||
// case changeSoundProfile:
|
||||
// break;
|
||||
// case disableScreenRotation:
|
||||
// break;
|
||||
// case enableScreenRotation:
|
||||
// break;
|
||||
// case setAirplaneMode:
|
||||
// break;
|
||||
case startOtherActivity:
|
||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
|
||||
ActivityManageActionStartActivity.resultingAction = a;
|
||||
@ -323,6 +335,7 @@ public class ActivityManageRule extends Activity
|
||||
case triggerUrl:
|
||||
Intent activityEditTriggerUrlIntent = new Intent(ActivityManageRule.this, ActivityManageActionTriggerUrl.class);
|
||||
ActivityManageActionTriggerUrl.resultingAction = a;
|
||||
ActivityManageActionTriggerUrl.resultingAction.setParentRule(ruleToEdit);
|
||||
activityEditTriggerUrlIntent.putExtra("edit", true);
|
||||
startActivityForResult(activityEditTriggerUrlIntent, requestCodeActionTriggerUrlEdit);
|
||||
break;
|
||||
@ -336,20 +349,24 @@ public class ActivityManageRule extends Activity
|
||||
Intent activitySendTextMessageIntent = new Intent(ActivityManageRule.this, ActivityManageActionSendTextMessage.class);
|
||||
ActivityManageActionSendTextMessage.resultingAction = a;
|
||||
activitySendTextMessageIntent.putExtra("edit", true);
|
||||
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessage);
|
||||
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessageEdit);
|
||||
break;
|
||||
case setScreenBrightness:
|
||||
Intent activityEditScreenBrightnessIntent = new Intent(ActivityManageRule.this, ActivityManageActionBrightnessSetting.class);
|
||||
// ActivityEditTriggerUrl.resultingAction = a;
|
||||
activityEditScreenBrightnessIntent.putExtra("autoBrightness", a.getParameter1());
|
||||
activityEditScreenBrightnessIntent.putExtra("brightnessValue", Integer.parseInt(a.getParameter2()));
|
||||
startActivityForResult(activityEditScreenBrightnessIntent, requestCodeActionScreenBrightnessEdit);
|
||||
break;
|
||||
case vibrate:
|
||||
Intent activityEditVibrateIntent = new Intent(ActivityManageRule.this, ActivityManageActionVibrate.class);
|
||||
activityEditVibrateIntent.putExtra("vibratePattern", a.getParameter2());
|
||||
startActivityForResult(activityEditVibrateIntent, requestCodeActionVibrateEdit);
|
||||
break;
|
||||
case playSound:
|
||||
Intent actionPlaySoundIntent = new Intent(context, ActivityManageActionPlaySound.class);
|
||||
actionPlaySoundIntent.putExtra("edit", true);
|
||||
actionPlaySoundIntent.putExtra("actionParameter1", a.getParameter1());
|
||||
actionPlaySoundIntent.putExtra("actionParameter2", a.getParameter2());
|
||||
actionPlaySoundIntent.putExtra(intentNameActionParameter1, a.getParameter1());
|
||||
actionPlaySoundIntent.putExtra(intentNameActionParameter2, a.getParameter2());
|
||||
startActivityForResult(actionPlaySoundIntent, requestCodeActionPlaySoundEdit);
|
||||
break;
|
||||
default:
|
||||
@ -419,6 +436,11 @@ public class ActivityManageRule extends Activity
|
||||
ruleToEdit.setName(etRuleName.getText().toString());
|
||||
ruleToEdit.setRuleActive(chkRuleActive.isChecked());
|
||||
ruleToEdit.setRuleToggle(chkRuleToggle.isChecked());
|
||||
|
||||
for(Trigger t : ruleToEdit.getTriggerSet())
|
||||
t.setParentRule(ruleToEdit);
|
||||
for(Action a : ruleToEdit.getActionSet())
|
||||
a.setParentRule(ruleToEdit);
|
||||
}
|
||||
|
||||
private void loadVariablesIntoGui()
|
||||
@ -481,6 +503,10 @@ public class ActivityManageRule extends Activity
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.headphone));
|
||||
else if(types[i].toString().equals(Trigger_Enum.notification.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.notification));
|
||||
else if(types[i].toString().equals(Trigger_Enum.deviceOrientation.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.smartphone));
|
||||
else if(types[i].toString().equals(Trigger_Enum.profileActive.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.sound));
|
||||
else
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.placeholder));
|
||||
}
|
||||
@ -553,10 +579,14 @@ public class ActivityManageRule extends Activity
|
||||
Intent wifiTriggerEditor = new Intent(myContext, ActivityManageTriggerWifi.class);
|
||||
startActivityForResult(wifiTriggerEditor, requestCodeTriggerWifiAdd);
|
||||
return;
|
||||
// booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
|
||||
}
|
||||
// else if(triggerType == Trigger_Enum.wifiConnection)
|
||||
// booleanChoices = new String[]{getResources().getString(R.string.connected), getResources().getString(R.string.disconnected)};
|
||||
else if(triggerType == Trigger_Enum.deviceOrientation)
|
||||
{
|
||||
newTrigger.setTriggerType(Trigger_Enum.deviceOrientation);
|
||||
Intent devicePositionTriggerEditor = new Intent(myContext, ActivityManageTriggerDeviceOrientation.class);
|
||||
startActivityForResult(devicePositionTriggerEditor, requestCodeTriggerDeviceOrientationAdd);
|
||||
return;
|
||||
}
|
||||
else if(triggerType == Trigger_Enum.process_started_stopped)
|
||||
booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
|
||||
else if(triggerType == Trigger_Enum.notification)
|
||||
@ -576,7 +606,21 @@ public class ActivityManageRule extends Activity
|
||||
Intent phoneTriggerEditor = new Intent(myContext, ActivityManageTriggerPhoneCall.class);
|
||||
startActivityForResult(phoneTriggerEditor, requestCodeTriggerPhoneCallAdd);
|
||||
return;
|
||||
// booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
|
||||
}
|
||||
else if(triggerType == Trigger_Enum.profileActive)
|
||||
{
|
||||
if(Profile.getProfileCollection().size() > 0)
|
||||
{
|
||||
newTrigger.setTriggerType(Trigger_Enum.profileActive);
|
||||
Intent profileTriggerEditor = new Intent(myContext, ActivityManageTriggerProfile.class);
|
||||
startActivityForResult(profileTriggerEditor, requestCodeTriggerProfileAdd);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(context, getResources().getString(R.string.noProfilesCreateOneFirst), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(triggerType == Trigger_Enum.activityDetection)
|
||||
{
|
||||
@ -599,7 +643,7 @@ public class ActivityManageRule extends Activity
|
||||
}
|
||||
catch (IllegalAccessException | InvocationTargetException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Miscellaneous.logEvent("w", "ActivityDetection", "Either play services are not available or the ActivityDetection classes are not. " + Log.getStackTraceString(e), 4);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -630,16 +674,17 @@ public class ActivityManageRule extends Activity
|
||||
if(triggerType == Trigger_Enum.nfcTag)
|
||||
{
|
||||
if (NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
|
||||
getTriggerParamterDialog(context, booleanChoices).show();
|
||||
getTriggerParameterDialog(context, booleanChoices).show();
|
||||
}
|
||||
else
|
||||
getTriggerParamterDialog(context, booleanChoices).show();
|
||||
getTriggerParameterDialog(context, booleanChoices).show();
|
||||
}
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
private AlertDialog getTriggerParamterDialog(final Context myContext, final String[] choices)
|
||||
|
||||
private AlertDialog getTriggerParameterDialog(final Context myContext, final String[] choices)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.selectTypeOfTrigger));
|
||||
@ -686,13 +731,6 @@ public class ActivityManageRule extends Activity
|
||||
String[] choices = (String[]) choicesList.toArray(new String[choicesList.size()]);
|
||||
getTriggerNoiseDialog(myContext, choices).show();
|
||||
}
|
||||
// else if(triggerType.equals(Trigger.Event_Enum.timeFrame))
|
||||
// {
|
||||
// newTrigger.setTriggerType(Trigger.Event_Enum.timeFrame);
|
||||
// ActivityManageTimeFrame.editedTimeFrameTrigger = null;
|
||||
// Intent timeFrameEditor = new Intent(myContext, ActivityManageTimeFrame.class);
|
||||
// startActivityForResult(timeFrameEditor, 2000);
|
||||
// }
|
||||
else if(triggerType.equals(Trigger_Enum.wifiConnection))
|
||||
{
|
||||
newTrigger.setTriggerType(Trigger_Enum.wifiConnection);
|
||||
@ -703,7 +741,6 @@ public class ActivityManageRule extends Activity
|
||||
progressDialog = ProgressDialog.show(myContext, null, getResources().getString(R.string.gettingListOfInstalledApplications), true, false);
|
||||
newTrigger.setTriggerType(Trigger_Enum.process_started_stopped);
|
||||
new GenerateApplicationSelectionsDialogTask().execute(ActivityManageRule.this);
|
||||
// getTriggerRunningProcessDialog1(myContext).show();
|
||||
}
|
||||
else if(triggerType.equals(Trigger_Enum.phoneCall))
|
||||
{
|
||||
@ -1014,7 +1051,6 @@ public class ActivityManageRule extends Activity
|
||||
@Override
|
||||
protected String[] doInBackground(ActivityManageRule... params)
|
||||
{
|
||||
// Looper.prepare();
|
||||
final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(params[0]);
|
||||
return applicationArray;
|
||||
}
|
||||
@ -1110,6 +1146,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
//add TriggerUrl
|
||||
ActivityManageActionTriggerUrl.resultingAction.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getActionSet().add(ActivityManageActionTriggerUrl.resultingAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1127,6 +1164,7 @@ public class ActivityManageRule extends Activity
|
||||
//add TimeFrame
|
||||
if(resultCode == RESULT_OK && ActivityManageTriggerTimeFrame.editedTimeFrameTrigger != null)
|
||||
{
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
@ -1138,6 +1176,7 @@ public class ActivityManageRule extends Activity
|
||||
//edit TimeFrame
|
||||
if(resultCode == RESULT_OK && ActivityManageTriggerTimeFrame.editedTimeFrameTrigger != null)
|
||||
{
|
||||
ActivityManageTriggerTimeFrame.editedTimeFrameTrigger.setParentRule(ruleToEdit);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
else
|
||||
@ -1147,8 +1186,9 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false));
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra("wifiName"));
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
@ -1157,8 +1197,12 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false));
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra("wifiName"));
|
||||
Trigger editedTrigger = new Trigger();
|
||||
editedTrigger.setTriggerType(Trigger_Enum.wifiConnection);
|
||||
editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
|
||||
editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
|
||||
editedTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
@ -1168,6 +1212,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction = ActivityManageActionStartActivity.resultingAction;
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1178,6 +1223,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction = ActivityManageActionStartActivity.resultingAction;
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
// ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1188,6 +1234,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK && ActivityManageTriggerNfc.generatedId != null)
|
||||
{
|
||||
newTrigger.setNfcTagId(ActivityManageTriggerNfc.generatedId);
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
@ -1201,13 +1248,15 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerNotification.intentNameNotificationDirection, false));
|
||||
newTrigger.setTriggerParameter2(
|
||||
data.getStringExtra("app") + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra("titleDir") + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra("title") + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra("textDir") + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra("text")
|
||||
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationApp) + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitleDir) + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitle) + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTextDir) + Trigger.triggerParameter2Split +
|
||||
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationText)
|
||||
);
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
@ -1216,6 +1265,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger = ActivityManageTriggerNotification.resultingTrigger;
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
@ -1223,6 +1273,7 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra("triggerParameter2"));
|
||||
this.refreshTriggerList();
|
||||
@ -1233,6 +1284,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger = ActivityManageTriggerPhoneCall.resultingTrigger;
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
@ -1241,6 +1293,7 @@ public class ActivityManageRule extends Activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
//add SpeakText
|
||||
ActivityManageActionSpeakText.resultingAction.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getActionSet().add(ActivityManageActionSpeakText.resultingAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1249,8 +1302,9 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
//add SpeakText
|
||||
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
|
||||
//edit SpeakText
|
||||
ActivityManageActionSpeakText.resultingAction.setParentRule(ruleToEdit);
|
||||
newAction = ActivityManageActionSpeakText.resultingAction;
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
@ -1259,6 +1313,7 @@ public class ActivityManageRule extends Activity
|
||||
//add bluetooth trigger
|
||||
if(resultCode == RESULT_OK && ActivityManageTriggerBluetooth.editedBluetoothTrigger != null)
|
||||
{
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
@ -1270,6 +1325,7 @@ public class ActivityManageRule extends Activity
|
||||
//edit bluetooth trigger
|
||||
if(resultCode == RESULT_OK && ActivityManageTriggerBluetooth.editedBluetoothTrigger != null)
|
||||
{
|
||||
ActivityManageTriggerBluetooth.editedBluetoothTrigger.setParentRule(ruleToEdit);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
else
|
||||
@ -1281,6 +1337,7 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
newAction.setParameter1(data.getBooleanExtra("autoBrightness", false));
|
||||
newAction.setParameter2(String.valueOf(data.getIntExtra("brightnessValue", 0)));
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1295,6 +1352,30 @@ public class ActivityManageRule extends Activity
|
||||
if(data.hasExtra("brightnessValue"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(String.valueOf(data.getIntExtra("brightnessValue", 0)));
|
||||
|
||||
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
|
||||
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeActionVibrateAdd)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
newAction.setParameter2(data.getStringExtra("vibratePattern"));
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeActionVibrateEdit)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
|
||||
|
||||
if(data.hasExtra("vibratePattern"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra("vibratePattern"));
|
||||
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
@ -1302,8 +1383,9 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction.setParameter1(data.getBooleanExtra("actionParameter1", false));
|
||||
newAction.setParameter2(data.getStringExtra("actionParameter2"));
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
newAction.setParameter1(data.getBooleanExtra(intentNameActionParameter1, false));
|
||||
newAction.setParameter2(data.getStringExtra(intentNameActionParameter2));
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1312,29 +1394,87 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
if(data.hasExtra("actionParameter1"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra("actionParameter1", false));
|
||||
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
|
||||
|
||||
if(data.hasExtra("actionParameter2"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra("actionParameter2"));
|
||||
if(data.hasExtra(intentNameActionParameter1))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra(intentNameActionParameter1, false));
|
||||
|
||||
if(data.hasExtra(intentNameActionParameter2))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra(intentNameActionParameter2));
|
||||
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Check with has data been changed or something like that.
|
||||
/*try
|
||||
else if(requestCode == requestCodeActionSendTextMessageAdd)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "ActivityManageSpecificRule", getResources().getString(R.string.noDataChangedReadingAnyway), 4);
|
||||
XmlFileInterface.readFile();
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
ActivityManageActionSendTextMessage.resultingAction.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
}
|
||||
else if(requestCode == requestCodeActionSendTextMessageEdit)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "ActivityManageSpecificRule", getResources().getString(R.string.errorReadingPoisAndRulesFromFile) + ": " + Log.getStackTraceString(e), 5);
|
||||
}*/
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction = ActivityManageActionSendTextMessage.resultingAction;
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
//ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeTriggerDeviceOrientationAdd)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerDeviceOrientation.vectorFieldName));
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeTriggerDeviceOrientationEdit)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
Trigger editedTrigger = new Trigger();
|
||||
editedTrigger.setTriggerType(Trigger_Enum.deviceOrientation);
|
||||
editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
|
||||
editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerDeviceOrientation.vectorFieldName));
|
||||
editedTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeTriggerProfileAdd)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
|
||||
newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
|
||||
newTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeTriggerProfileEdit)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
Trigger editedTrigger = new Trigger();
|
||||
editedTrigger.setTriggerType(Trigger_Enum.profileActive);
|
||||
editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
|
||||
editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
|
||||
editedTrigger.setParentRule(ruleToEdit);
|
||||
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
||||
this.refreshTriggerList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Dialog getActionTypeDialog()
|
||||
protected AlertDialog getActionTypeDialog()
|
||||
{
|
||||
final ArrayList<Item> items = new ArrayList<Item>();
|
||||
|
||||
@ -1351,14 +1491,16 @@ public class ActivityManageRule extends Activity
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.router));
|
||||
else if(types[i].toString().equals(Action_Enum.setWifiTethering.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.router));
|
||||
else if(types[i].toString().equals(Action_Enum.setBluetoothTethering.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.router));
|
||||
else if(types[i].toString().equals(Action_Enum.setDisplayRotation.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.displayrotation));
|
||||
else if(types[i].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.wait));
|
||||
else if(types[i].toString().equals(Action_Enum.setAirplaneMode.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.plane));
|
||||
else if(types[i].toString().equals(Action_Enum.wakeupDevice.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.alarm));
|
||||
else if(types[i].toString().equals(Action_Enum.turnScreenOnOrOff.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.smartphone));
|
||||
else if(types[i].toString().equals(Action_Enum.changeSoundProfile.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.sound));
|
||||
else if(types[i].toString().equals(Action_Enum.triggerUrl.toString()))
|
||||
@ -1375,10 +1517,12 @@ public class ActivityManageRule extends Activity
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.brightness));
|
||||
else if(types[i].toString().equals(Action_Enum.playSound.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.sound));
|
||||
else if(types[i].toString().equals(Action_Enum.vibrate.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.vibrate));
|
||||
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
|
||||
{
|
||||
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
|
||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
|
||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.message));
|
||||
}
|
||||
else
|
||||
@ -1419,14 +1563,15 @@ public class ActivityManageRule extends Activity
|
||||
newAction.setAction(Action_Enum.triggerUrl);
|
||||
ActivityManageActionTriggerUrl.resultingAction = null;
|
||||
Intent editTriggerIntent = new Intent(context, ActivityManageActionTriggerUrl.class);
|
||||
startActivityForResult(editTriggerIntent, 1000);
|
||||
startActivityForResult(editTriggerIntent, requestCodeActionTriggerUrlAdd);
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifi.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setWifi);
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
Toast.makeText(context, context.getResources().getString(R.string.android10WifiToggleNotice), Toast.LENGTH_LONG).show();
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
Miscellaneous.messageBox(context.getResources().getString(R.string.app_name), context.getResources().getString(R.string.android10WifiToggleNotice), context).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString()))
|
||||
{
|
||||
@ -1438,18 +1583,27 @@ public class ActivityManageRule extends Activity
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setUsbTethering);
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
|
||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
|
||||
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), context).show();
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setWifiTethering);
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1)
|
||||
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.wifiTetheringFailForAboveNougat), context).show();
|
||||
else
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetoothTethering.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setBluetoothTethering);
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
|
||||
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH))
|
||||
Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageRule.this).show();;
|
||||
|
||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.O)
|
||||
Miscellaneous.messageBox(context.getResources().getString(R.string.notice), context.getResources().getString(R.string.btTetheringNotice), context).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDisplayRotation.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setDisplayRotation);
|
||||
@ -1469,27 +1623,26 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
newAction.setAction(Action_Enum.startOtherActivity);
|
||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
|
||||
startActivityForResult(intent, 3000);
|
||||
startActivityForResult(intent, requestCodeActionStartActivityAdd);
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.waitBeforeNextAction);
|
||||
getActionWaitBeforeNextActionDialog(ActivityManageRule.this).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakeupDevice.toString()))
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.turnScreenOnOrOff.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.wakeupDevice);
|
||||
getActionWakeupDeviceDialog(ActivityManageRule.this).show();
|
||||
newAction.setAction(Action_Enum.turnScreenOnOrOff);
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setAirplaneMode.toString()))
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= 17)
|
||||
{
|
||||
Toast.makeText(context, getResources().getString(R.string.airplaneModeSdk17Warning), Toast.LENGTH_LONG).show();
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.airplaneMode), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
|
||||
}
|
||||
newAction.setAction(Action_Enum.setAirplaneMode);
|
||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||
if(Build.VERSION.SDK_INT >= 17)
|
||||
{
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.airplaneMode), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
|
||||
}
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDataConnection.toString()))
|
||||
{
|
||||
@ -1503,18 +1656,17 @@ public class ActivityManageRule extends Activity
|
||||
newAction.setAction(Action_Enum.speakText);
|
||||
ActivityManageActionSpeakText.resultingAction = null;
|
||||
Intent editTriggerIntent = new Intent(context, ActivityManageActionSpeakText.class);
|
||||
startActivityForResult(editTriggerIntent, 5000);
|
||||
startActivityForResult(editTriggerIntent, requestCodeActionSpeakTextAdd);
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString()))
|
||||
{
|
||||
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
|
||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
|
||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
|
||||
{
|
||||
//launch other activity to enter parameters;
|
||||
newAction.setAction(Action_Enum.sendTextMessage);
|
||||
ActivityManageActionSendTextMessage.resultingAction = null;
|
||||
Intent editTriggerIntent = new Intent(context, ActivityManageActionSendTextMessage.class);
|
||||
startActivityForResult(editTriggerIntent, 5001);
|
||||
startActivityForResult(editTriggerIntent, requestCodeActionSendTextMessageAdd);
|
||||
}
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.playMusic.toString()))
|
||||
@ -1523,6 +1675,12 @@ public class ActivityManageRule extends Activity
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
refreshActionList();
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.vibrate.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.vibrate);
|
||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionVibrate.class);
|
||||
startActivityForResult(intent, requestCodeActionVibrateAdd);
|
||||
}
|
||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setScreenBrightness.toString()))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setScreenBrightness);
|
||||
@ -1640,63 +1798,6 @@ public class ActivityManageRule extends Activity
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
/*private AlertDialog getActionStartActivityDialog1(final Context myContext)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||
alertDialogBuilder.setTitle(myContext.getResources().getString(R.string.selectApplication));
|
||||
final String[] applicationArray = ActivityManageStartActivity.getApplicationNameListString(ActivityManageSpecificRule.this);
|
||||
alertDialogBuilder.setItems(applicationArray, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
getActionStartActivityDialog2(myContext, applicationArray[which]).show();
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
private AlertDialog getActionStartActivityDialog2(final Context myContext, String applicationName)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||
alertDialogBuilder.setTitle(myContext.getResources().getString(R.string.selectPackageOfApplication));
|
||||
final String[] packageArray = ActivityManageStartActivity.getPackageListString(ActivityManageSpecificRule.this, applicationName);
|
||||
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
getActionStartActivityDialog3(ActivityManageSpecificRule.this, packageArray[which]).show();
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
private AlertDialog getActionStartActivityDialog3(final Context myContext, final String packageName)
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||
alertDialogBuilder.setTitle(myContext.getResources().getString(R.string.selectActivityToBeStarted));
|
||||
final String activityArray[] = ActivityManageStartActivity.getActivityListForPackageName(packageName);
|
||||
alertDialogBuilder.setItems(activityArray, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
ActivityInfo ai = ActivityManageStartActivity.getActivityInfoForPackageNameAndActivityName(packageName, activityArray[which]);
|
||||
// Log.i("Selected", ai.packageName + " / " + ai.name);
|
||||
newAction.setParameter2(ai.packageName + ";" + ai.name);
|
||||
newAction.toString();
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
refreshActionList();
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
return alertDialog;
|
||||
}*/
|
||||
|
||||
private AlertDialog getActionWaitBeforeNextActionDialog(final Context myContext)
|
||||
{
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
|
||||
|
@ -0,0 +1,297 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.jens.automation2.receivers.DeviceOrientationListener;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class ActivityManageTriggerDeviceOrientation extends Activity
|
||||
{
|
||||
TextView currentAzimuth, currentPitch, currentRoll, tvAppliesAzimuth, tvAppliesPitch, tvAppliesRoll;
|
||||
Button bApplyPositionValues, bSavePositionValues;
|
||||
EditText etDesiredAzimuth, etDesiredAzimuthTolerance, etDesiredPitch, etDesiredPitchTolerance, etDesiredRoll, etDesiredRollTolerance;
|
||||
CheckBox chkDevicePositionApplies;
|
||||
|
||||
public static String vectorFieldName = "deviceVector";
|
||||
|
||||
boolean editMode = false;
|
||||
|
||||
float desiredAzimuth, desiredPitch, desiredRoll, desiredAzimuthTolerance, desiredPitchTolerance, desiredRollTolerance;
|
||||
|
||||
public void updateFields(float azimuth, float pitch, float roll)
|
||||
{
|
||||
currentAzimuth.setText(Float.toString(azimuth));
|
||||
currentPitch.setText(Float.toString(pitch));
|
||||
currentRoll.setText(Float.toString(roll));
|
||||
|
||||
try
|
||||
{
|
||||
desiredAzimuth = Float.parseFloat(etDesiredAzimuth.getText().toString());
|
||||
desiredAzimuthTolerance = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
|
||||
if (desiredAzimuthTolerance == 180 || (desiredAzimuth - desiredAzimuthTolerance <= azimuth && azimuth <= desiredAzimuth + desiredAzimuthTolerance))
|
||||
{
|
||||
tvAppliesAzimuth.setText(getResources().getString(R.string.yes));
|
||||
tvAppliesAzimuth.setTextColor(Color.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
tvAppliesAzimuth.setText(getResources().getString(R.string.no));
|
||||
tvAppliesAzimuth.setTextColor(Color.RED);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
tvAppliesAzimuth.setText("");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
desiredPitch = Float.parseFloat(etDesiredPitch.getText().toString());
|
||||
desiredPitchTolerance = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
|
||||
if (desiredPitchTolerance == 180 || (desiredPitch - desiredPitchTolerance <= pitch && pitch <= desiredPitch + desiredPitchTolerance))
|
||||
{
|
||||
tvAppliesPitch.setText(getResources().getString(R.string.yes));
|
||||
tvAppliesPitch.setTextColor(Color.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
tvAppliesPitch.setText(getResources().getString(R.string.no));
|
||||
tvAppliesPitch.setTextColor(Color.RED);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
tvAppliesPitch.setText("");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
desiredRoll = Float.parseFloat(etDesiredRoll.getText().toString());
|
||||
desiredRollTolerance = Float.parseFloat(etDesiredRollTolerance.getText().toString());
|
||||
if (desiredRollTolerance == 180 || (desiredRoll - desiredRollTolerance <= roll && roll <= desiredRoll + desiredRollTolerance))
|
||||
{
|
||||
tvAppliesRoll.setText(getResources().getString(R.string.yes));
|
||||
tvAppliesRoll.setTextColor(Color.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
tvAppliesRoll.setText(getResources().getString(R.string.no));
|
||||
tvAppliesRoll.setTextColor(Color.RED);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
tvAppliesRoll.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_manage_trigger_device_orientation);
|
||||
|
||||
currentAzimuth = (TextView) findViewById(R.id.tvCurrentAzimuth);
|
||||
currentPitch = (TextView) findViewById(R.id.tvCurrentOrientationPitch);
|
||||
currentRoll = (TextView) findViewById(R.id.tvCurrentRoll);
|
||||
tvAppliesAzimuth = (TextView) findViewById(R.id.tvAppliesAzimuth);
|
||||
tvAppliesPitch = (TextView) findViewById(R.id.tvAppliesPitch);
|
||||
tvAppliesRoll = (TextView) findViewById(R.id.tvAppliesRoll);
|
||||
|
||||
bApplyPositionValues = (Button) findViewById(R.id.bApplyPositionValues);
|
||||
bSavePositionValues = (Button) findViewById(R.id.bSavePositionValues);
|
||||
|
||||
etDesiredAzimuth = (EditText) findViewById(R.id.etDesiredAzimuth);
|
||||
etDesiredAzimuthTolerance = (EditText) findViewById(R.id.etDesiredAzimuthTolerance);
|
||||
etDesiredPitch = (EditText) findViewById(R.id.etDesiredPitch);
|
||||
etDesiredPitchTolerance = (EditText) findViewById(R.id.etDesiredPitchTolerance);
|
||||
etDesiredRoll = (EditText) findViewById(R.id.etDesiredRoll);
|
||||
etDesiredRollTolerance = (EditText) findViewById(R.id.etDesiredRollTolerance);
|
||||
|
||||
chkDevicePositionApplies = (CheckBox)findViewById(R.id.chkDevicePositionApplies);
|
||||
|
||||
// etDesiredAzimuth.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
// etDesiredPitch.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
// etDesiredRoll.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
|
||||
etDesiredAzimuthTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
etDesiredPitchTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
etDesiredRollTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
|
||||
|
||||
if(getIntent().hasExtra(vectorFieldName))
|
||||
{
|
||||
editMode = true;
|
||||
try
|
||||
{
|
||||
boolean chkValue = getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true);
|
||||
chkDevicePositionApplies.setChecked(chkValue);
|
||||
String values[] = getIntent().getStringExtra(vectorFieldName).split(Trigger.triggerParameter2Split);
|
||||
etDesiredAzimuth.setText(values[0]);
|
||||
etDesiredAzimuthTolerance.setText(values[1]);
|
||||
etDesiredPitch.setText(values[2]);
|
||||
etDesiredPitchTolerance.setText(values[3]);
|
||||
etDesiredRoll.setText(values[4]);
|
||||
etDesiredRollTolerance.setText(values[5]);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Toast.makeText(ActivityManageTriggerDeviceOrientation.this, getResources().getString(R.string.triggerWrong), Toast.LENGTH_SHORT).show();
|
||||
Miscellaneous.logEvent("e", "DevicePositionTrigger", "There\'s something wrong with a device position trigger. Content: " + getIntent().getStringExtra(vectorFieldName) + ", " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
bApplyPositionValues.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
// Round the values. Too long decimals will destroy the layout
|
||||
|
||||
if(!StringUtils.isEmpty(currentAzimuth.getText()))
|
||||
etDesiredAzimuth.setText(String.valueOf(Math.round(Float.parseFloat(currentAzimuth.getText().toString()))));
|
||||
|
||||
if(!StringUtils.isEmpty(currentPitch.getText()))
|
||||
etDesiredPitch.setText(String.valueOf(Math.round(Float.parseFloat(currentPitch.getText().toString()))));
|
||||
|
||||
if(!StringUtils.isEmpty(currentRoll.getText()))
|
||||
etDesiredRoll.setText(String.valueOf(Math.round(Float.parseFloat(currentRoll.getText().toString()))));
|
||||
}
|
||||
});
|
||||
|
||||
bSavePositionValues.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
if(!checkInputs(true))
|
||||
{
|
||||
Toast.makeText(ActivityManageTriggerDeviceOrientation.this, getResources().getString(R.string.enterValidNumbersIntoAllFields), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save
|
||||
Intent returnData = new Intent();
|
||||
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter1, chkDevicePositionApplies.isChecked());
|
||||
returnData.putExtra(vectorFieldName,
|
||||
etDesiredAzimuth.getText().toString() + Trigger.triggerParameter2Split +
|
||||
etDesiredAzimuthTolerance.getText().toString() + Trigger.triggerParameter2Split +
|
||||
etDesiredPitch.getText().toString() + Trigger.triggerParameter2Split +
|
||||
etDesiredPitchTolerance.getText().toString() + Trigger.triggerParameter2Split +
|
||||
etDesiredRoll.getText().toString() + Trigger.triggerParameter2Split +
|
||||
etDesiredRollTolerance.getText().toString());
|
||||
|
||||
setResult(RESULT_OK, returnData);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean checkInputs(boolean showMessages)
|
||||
{
|
||||
if(
|
||||
!StringUtils.isEmpty(etDesiredAzimuth.getText().toString()) && Miscellaneous.isNumeric(etDesiredAzimuth.getText().toString())
|
||||
&&
|
||||
!StringUtils.isEmpty(etDesiredAzimuthTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredAzimuthTolerance.getText().toString())
|
||||
&&
|
||||
!StringUtils.isEmpty(etDesiredPitch.getText().toString()) && Miscellaneous.isNumeric(etDesiredPitch.getText().toString())
|
||||
&&
|
||||
!StringUtils.isEmpty(etDesiredPitchTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredPitchTolerance.getText().toString())
|
||||
&&
|
||||
!StringUtils.isEmpty(etDesiredRoll.getText().toString()) && Miscellaneous.isNumeric(etDesiredRoll.getText().toString())
|
||||
&&
|
||||
!StringUtils.isEmpty(etDesiredRollTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredRollTolerance.getText().toString())
|
||||
)
|
||||
{
|
||||
float da = Float.parseFloat(etDesiredAzimuth.getText().toString());
|
||||
float dp = Float.parseFloat(etDesiredPitch.getText().toString());
|
||||
float dr = Float.parseFloat(etDesiredRoll.getText().toString());
|
||||
|
||||
if(Math.abs(da) > 180 || Math.abs(dp) > 180 || Math.abs(dr) > 180)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(showMessages)
|
||||
{
|
||||
float dat = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
|
||||
float dpt = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
|
||||
float drt = Float.parseFloat(etDesiredRollTolerance.getText().toString());
|
||||
|
||||
/*
|
||||
The user may enter a tolerance of 180° for two directions, but not all three.
|
||||
Otherwise this trigger would always apply.
|
||||
*/
|
||||
if (Math.abs(dat) >= 180 && Math.abs(dpt) >= 180 && Math.abs(drt) >= 180)
|
||||
{
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.warning), getResources().getString(R.string.toleranceOf180OnlyAllowedIn2Fields), ActivityManageTriggerDeviceOrientation.this).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
DeviceOrientationListener.getInstance().startSensorFromConfigActivity(ActivityManageTriggerDeviceOrientation.this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
DeviceOrientationListener.getInstance().stopSensorFromConfigActivity();
|
||||
}
|
||||
|
||||
public class InputFilterMinMax implements InputFilter
|
||||
{
|
||||
private float minimumValue;
|
||||
private float maximumValue;
|
||||
|
||||
public InputFilterMinMax(float minimumValue, float maximumValue)
|
||||
{
|
||||
this.minimumValue = minimumValue;
|
||||
this.maximumValue = maximumValue;
|
||||
}
|
||||
|
||||
private boolean isInRange(float a, float b, float c)
|
||||
{
|
||||
return b > a ? c >= a && c <= b : c >= b && c <= a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)
|
||||
{
|
||||
try
|
||||
{
|
||||
int input = Integer.parseInt(dest.subSequence(0, dstart).toString() + source + dest.subSequence(dend, dest.length()));
|
||||
if (isInRange(minimumValue, maximumValue, input))
|
||||
return null;
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,13 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
|
||||
|
||||
public class ActivityManageTriggerNotification extends Activity
|
||||
{
|
||||
public static final String intentNameNotificationApp = "app";
|
||||
public static final String intentNameNotificationTitleDir = "titleDir";
|
||||
public static final String intentNameNotificationTitle = "title";
|
||||
public static final String intentNameNotificationTextDir = "textDir";
|
||||
public static final String intentNameNotificationText = "text";
|
||||
public static final String intentNameNotificationDirection = "direction";
|
||||
|
||||
public static Trigger editedNotificationTrigger;
|
||||
boolean edit = false;
|
||||
ProgressDialog progressDialog = null;
|
||||
@ -323,12 +330,12 @@ public class ActivityManageTriggerNotification extends Activity
|
||||
else
|
||||
{
|
||||
Intent data = new Intent();
|
||||
data.putExtra("direction", chkNotificationDirection.isChecked());
|
||||
data.putExtra("app", app);
|
||||
data.putExtra("titleDir", titleDir);
|
||||
data.putExtra("title", title);
|
||||
data.putExtra("textDir", textDir);
|
||||
data.putExtra("text", text);
|
||||
data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
|
||||
data.putExtra(intentNameNotificationApp, app);
|
||||
data.putExtra(intentNameNotificationTitleDir, titleDir);
|
||||
data.putExtra(intentNameNotificationTitle, title);
|
||||
data.putExtra(intentNameNotificationTextDir, textDir);
|
||||
data.putExtra(intentNameNotificationText, text);
|
||||
ActivityManageTriggerNotification.this.setResult(RESULT_OK, data);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,117 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityManageTriggerProfile extends Activity
|
||||
{
|
||||
public static final String profileFieldName = "profileName";
|
||||
|
||||
boolean editMode = false;
|
||||
|
||||
Button bSaveTriggerProfile;
|
||||
Spinner spinnerProfiles;
|
||||
CheckBox chkProfileActive, chkProfileCheckSettings;
|
||||
|
||||
ArrayAdapter<Profile> profileSpinnerAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_manage_trigger_profile);
|
||||
|
||||
bSaveTriggerProfile = (Button)findViewById(R.id.bSaveTriggerProfile);
|
||||
spinnerProfiles = (Spinner)findViewById(R.id.spinnerProfiles);
|
||||
chkProfileActive = (CheckBox)findViewById(R.id.chkProfileActive);
|
||||
chkProfileCheckSettings = (CheckBox)findViewById(R.id.chkProfileCheckSettings);
|
||||
|
||||
try
|
||||
{
|
||||
profileSpinnerAdapter = new ArrayAdapter<Profile>(this, R.layout.text_view_for_poi_listview_mediumtextsize, Profile.getProfileCollection());
|
||||
loadProfileItems();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("w", "ActivityManageTriggerProfile", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
|
||||
if(getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter2))
|
||||
{
|
||||
editMode = true;
|
||||
|
||||
boolean active = getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true);
|
||||
chkProfileActive.setChecked(active);
|
||||
|
||||
try
|
||||
{
|
||||
String values[] = getIntent().getStringExtra(ActivityManageRule.intentNameTriggerParameter2).split(Trigger.triggerParameter2Split);
|
||||
if(values.length >= 2)
|
||||
{
|
||||
boolean checkSettings = Boolean.parseBoolean(values[0]);
|
||||
chkProfileCheckSettings.setChecked(checkSettings);
|
||||
|
||||
String profileName = values[0];
|
||||
|
||||
List<Profile> profileList = Profile.getProfileCollection();
|
||||
for(int i = 0; i < profileList.size(); i++)
|
||||
{
|
||||
if(profileList.get(i).getName().equals(profileName))
|
||||
{
|
||||
spinnerProfiles.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Toast.makeText(ActivityManageTriggerProfile.this, getResources().getString(R.string.triggerWrong), Toast.LENGTH_SHORT).show();
|
||||
Miscellaneous.logEvent("e", "ActivityManageTriggerProfile", "There\'s something wrong with parameters. Content: " + getIntent().getStringExtra(ActivityManageRule.intentNameActionParameter2) + ", " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
bSaveTriggerProfile.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent returnData = new Intent();
|
||||
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter1, chkProfileActive.isChecked());
|
||||
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter2,
|
||||
spinnerProfiles.getSelectedItem().toString() + Trigger.triggerParameter2Split +
|
||||
chkProfileCheckSettings.isChecked());
|
||||
|
||||
setResult(RESULT_OK, returnData);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadProfileItems()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(spinnerProfiles.getAdapter() == null)
|
||||
spinnerProfiles.setAdapter(profileSpinnerAdapter);
|
||||
|
||||
profileSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
catch(NullPointerException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,11 +6,16 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
@ -18,8 +23,9 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
{
|
||||
Button bSaveTimeFrame;
|
||||
TimePicker startPicker, stopPicker;
|
||||
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday;
|
||||
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday, chkRepeat;
|
||||
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
|
||||
EditText etRepeatEvery;
|
||||
|
||||
public static Trigger editedTimeFrameTrigger = null;
|
||||
|
||||
@ -44,6 +50,8 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
checkSunday = (CheckBox)findViewById(R.id.checkSunday);
|
||||
radioTimeFrameEntering = (RadioButton)findViewById(R.id.radioTimeFrameEntering);
|
||||
radioTimeFrameLeaving = (RadioButton)findViewById(R.id.radioTimeFrameLeaving);
|
||||
chkRepeat = (CheckBox)findViewById(R.id.chkRepeat);
|
||||
etRepeatEvery = (EditText)findViewById(R.id.etRepeatEvery);
|
||||
|
||||
bSaveTimeFrame.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@ -94,9 +102,41 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
return;
|
||||
}
|
||||
|
||||
boolean goOn = false;
|
||||
if(chkRepeat.isChecked())
|
||||
{
|
||||
if(!StringUtils.isEmpty(etRepeatEvery.getText().toString()))
|
||||
{
|
||||
try
|
||||
{
|
||||
long value = Long.parseLong(etRepeatEvery.getText().toString());
|
||||
if(value > 0)
|
||||
{
|
||||
goOn = true;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
goOn = true;
|
||||
|
||||
if(!goOn)
|
||||
{
|
||||
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterRepetitionTime), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if(editedTimeFrameTrigger.getTimeFrame() == null)
|
||||
{
|
||||
// add new one
|
||||
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList));
|
||||
if(chkRepeat.isChecked())
|
||||
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, Long.parseLong(etRepeatEvery.getText().toString())));
|
||||
else
|
||||
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
// edit one
|
||||
@ -104,6 +144,11 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
editedTimeFrameTrigger.getTimeFrame().setTriggerTimeStop(stopTime);
|
||||
editedTimeFrameTrigger.getTimeFrame().getDayList().clear();
|
||||
editedTimeFrameTrigger.getTimeFrame().setDayList(dayList);
|
||||
|
||||
if(chkRepeat.isChecked())
|
||||
editedTimeFrameTrigger.getTimeFrame().setRepetition(Long.parseLong(etRepeatEvery.getText().toString()));
|
||||
else
|
||||
editedTimeFrameTrigger.getTimeFrame().setRepetition(0);
|
||||
}
|
||||
|
||||
editedTimeFrameTrigger.setTriggerParameter(radioTimeFrameEntering.isChecked());
|
||||
@ -113,6 +158,15 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
}
|
||||
});
|
||||
|
||||
chkRepeat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
etRepeatEvery.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
if(editedTimeFrameTrigger.getTimeFrame() != null)
|
||||
loadVariableIntoGui();
|
||||
}
|
||||
@ -158,6 +212,12 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(editedTimeFrameTrigger.getTimeFrame().getRepetition() > 0)
|
||||
{
|
||||
chkRepeat.setChecked(true);
|
||||
etRepeatEvery.setText(String.valueOf(editedTimeFrameTrigger.getTimeFrame().getRepetition()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,9 +7,12 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
@ -32,6 +35,9 @@ import java.util.List;
|
||||
|
||||
public class ActivityManageTriggerWifi extends Activity
|
||||
{
|
||||
public final static String intentNameWifiState = "wifiState";
|
||||
public final static String intentNameWifiName = "wifiName";
|
||||
|
||||
RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected;
|
||||
EditText etTriggerWifiName;
|
||||
Spinner spinnerWifiList;
|
||||
@ -55,6 +61,7 @@ public class ActivityManageTriggerWifi extends Activity
|
||||
|
||||
wifiSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList);
|
||||
spinnerWifiList.setAdapter(wifiSpinnerAdapter);
|
||||
spinnerWifiList.setEnabled(false); // bug in Android; this only works when done in code, not in xml
|
||||
|
||||
if (getIntent().hasExtra("edit"))
|
||||
{
|
||||
@ -127,11 +134,19 @@ public class ActivityManageTriggerWifi extends Activity
|
||||
}
|
||||
|
||||
void reallyLoadWifiList()
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= 30)
|
||||
{
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.wifiApi30), ActivityManageTriggerWifi.this).show();
|
||||
loadListOfVisibleWifis();
|
||||
}
|
||||
else
|
||||
{
|
||||
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||
|
||||
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
|
||||
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
|
||||
}
|
||||
|
||||
if (wifiList.size() > 0)
|
||||
{
|
||||
@ -147,6 +162,24 @@ public class ActivityManageTriggerWifi extends Activity
|
||||
wifiSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
void loadListOfVisibleWifis()
|
||||
{
|
||||
List<ScanResult> results = null;
|
||||
|
||||
try
|
||||
{
|
||||
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
|
||||
results = wifiManager.getScanResults();
|
||||
|
||||
for (ScanResult wifi : results)
|
||||
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "loadListOfVisibleWifis()", Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
|
||||
{
|
||||
|
@ -2,9 +2,12 @@ package com.jens.automation2;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@ -12,6 +15,8 @@ import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -40,6 +45,8 @@ public class ActivityPermissions extends Activity
|
||||
private static final int requestCodeForPermissionsNotificationPolicy = 12044;
|
||||
private static final int requestCodeForPermissionsBackgroundLocation = 12045;
|
||||
private static final int requestCodeForPermissionsNotifications = 12046;
|
||||
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
|
||||
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
|
||||
protected String[] specificPermissionsToRequest = null;
|
||||
|
||||
public static String intentExtraName = "permissionsToBeRequested";
|
||||
@ -85,15 +92,6 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
});
|
||||
|
||||
// bRequestPermissions.setOnClickListener(new View.OnClickListener()
|
||||
// {
|
||||
// @Override
|
||||
// public void onClick(View v)
|
||||
// {
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
|
||||
bRequestPermissions.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
@ -102,9 +100,6 @@ public class ActivityPermissions extends Activity
|
||||
// Request the basic permissions, that are absolutely required.
|
||||
//getRequiredPermissions(true); // request permissions to access sd card access and "receive boot completed"
|
||||
|
||||
//fillPermissionMaps();
|
||||
|
||||
|
||||
if(specificPermissionsToRequest != null)
|
||||
requestSpecificPermission(specificPermissionsToRequest);
|
||||
else
|
||||
@ -123,7 +118,6 @@ public class ActivityPermissions extends Activity
|
||||
if(extras != null)
|
||||
{
|
||||
specificPermissionsToRequest = extras.getStringArray(ActivityPermissions.intentExtraName);;
|
||||
// requestSpecificPermission(permissionsToRequest);
|
||||
tvPermissionsExplanationLong.setText(R.string.permissionsExplanationSmall);
|
||||
tvPermissionsExplanation.setText("");
|
||||
fillExplanationText();
|
||||
@ -289,6 +283,16 @@ public class ActivityPermissions extends Activity
|
||||
{
|
||||
return verifyNotificationPermission();
|
||||
}
|
||||
else if (s.equals(Manifest.permission.BIND_DEVICE_ADMIN))
|
||||
{
|
||||
return haveDeviceAdmin();
|
||||
}
|
||||
else if (s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))
|
||||
{
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
String packageName = context.getApplicationContext().getPackageName();
|
||||
return pm.isIgnoringBatteryOptimizations(packageName);
|
||||
}
|
||||
else
|
||||
{
|
||||
int res = context.checkCallingOrSelfPermission(s);
|
||||
@ -299,6 +303,28 @@ public class ActivityPermissions extends Activity
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean haveDeviceAdmin()
|
||||
{
|
||||
DevicePolicyManager deviceManger = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
ComponentName compName = new ComponentName(Miscellaneous.getAnyContext(), DeviceAdmin.class);
|
||||
boolean active = deviceManger.isAdminActive(compName);
|
||||
return active;
|
||||
}
|
||||
|
||||
public static void requestDeviceAdmin()
|
||||
{
|
||||
if(!haveDeviceAdmin())
|
||||
{
|
||||
// DevicePolicyManager deviceManger = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
ComponentName compName = new ComponentName(ActivityPermissions.getInstance(), DeviceAdmin.class) ;
|
||||
|
||||
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN );
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN , compName );
|
||||
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION , Miscellaneous.getAnyContext().getResources().getString(R.string.deviceAdminNote));
|
||||
ActivityPermissions.getInstance().startActivityForResult(intent, requestCodeForPermissionsDeviceAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getRequiredPermissions(boolean onlyGeneral)
|
||||
{
|
||||
ArrayList<String> requiredPermissions = new ArrayList<String>();
|
||||
@ -315,19 +341,17 @@ public class ActivityPermissions extends Activity
|
||||
addToArrayListUnique("android.permission.RECEIVE_BOOT_COMPLETED", requiredPermissions);
|
||||
*/
|
||||
|
||||
// if (!havePermission(ActivityPermissions.writeExternalStoragePermissionName, workingContext))
|
||||
// addToArrayListUnique(ActivityPermissions.writeExternalStoragePermissionName, requiredPermissions);
|
||||
|
||||
if(!havePermission(Manifest.permission.WRITE_SETTINGS, workingContext))
|
||||
{
|
||||
for (Profile profile : Profile.getProfileCollection())
|
||||
{
|
||||
if (profile.changeIncomingCallsRingtone)
|
||||
{
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, workingContext))
|
||||
addToArrayListUnique(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, requiredPermissions);
|
||||
|
||||
if (!onlyGeneral)
|
||||
{
|
||||
@ -422,11 +446,11 @@ public class ActivityPermissions extends Activity
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case charging:
|
||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
||||
break;
|
||||
case headsetPlugged:
|
||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||
break;
|
||||
case nfcTag:
|
||||
addToArrayListUnique(Manifest.permission.NFC, requiredPermissions);
|
||||
@ -510,7 +534,8 @@ public class ActivityPermissions extends Activity
|
||||
case setAirplaneMode:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||
break;
|
||||
@ -523,7 +548,8 @@ public class ActivityPermissions extends Activity
|
||||
case setDataConnection:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||
@ -533,16 +559,25 @@ public class ActivityPermissions extends Activity
|
||||
break;
|
||||
case setUsbTethering:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case setBluetoothTethering:
|
||||
//addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
break;
|
||||
case setWifi:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case setWifiTethering:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
|
||||
/*
|
||||
@ -589,36 +624,36 @@ public class ActivityPermissions extends Activity
|
||||
break;
|
||||
case turnUsbTetheringOff:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case turnUsbTetheringOn:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case turnWifiOff:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case turnWifiOn:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case turnWifiTetheringOff:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case turnWifiTetheringOn:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||
break;
|
||||
case waitBeforeNextAction:
|
||||
break;
|
||||
case wakeupDevice:
|
||||
case playSound:
|
||||
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
|
||||
break;
|
||||
case turnScreenOnOrOff:
|
||||
if(action.getParameter1())
|
||||
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
|
||||
else
|
||||
addToArrayListUnique(Manifest.permission.BIND_DEVICE_ADMIN, requiredPermissions);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -658,7 +693,7 @@ public class ActivityPermissions extends Activity
|
||||
{
|
||||
for (Action action : rule.getActionSet())
|
||||
{
|
||||
if(action.equals(actionType))
|
||||
if(action.getAction().equals(actionType))
|
||||
addToArrayListUnique(rule.getName(), returnList);
|
||||
}
|
||||
}
|
||||
@ -685,26 +720,16 @@ public class ActivityPermissions extends Activity
|
||||
case Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE:
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
|
||||
break;
|
||||
case permissionNameGoogleActivityDetection:
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
|
||||
break;
|
||||
case Manifest.permission.ACTIVITY_RECOGNITION:
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
|
||||
break;
|
||||
case Manifest.permission.ACCESS_COARSE_LOCATION:
|
||||
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
|
||||
usingElements.add(getResources().getString(R.string.manageLocations));
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;
|
||||
case Manifest.permission.ACCESS_FINE_LOCATION:
|
||||
usingElements.add(getResources().getString(R.string.manageLocations));
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||
@ -761,14 +786,6 @@ public class ActivityPermissions extends Activity
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.wifiConnection))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;
|
||||
/*case "android.permission.BATTERY_STATS":
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.batteryLevel))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.charging))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;*/
|
||||
case Manifest.permission.BLUETOOTH_ADMIN:
|
||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
@ -832,6 +849,17 @@ public class ActivityPermissions extends Activity
|
||||
case Manifest.permission.FOREGROUND_SERVICE:
|
||||
usingElements.add(getResources().getString(R.string.startAutomationAsService));
|
||||
break;
|
||||
case Manifest.permission.READ_EXTERNAL_STORAGE:
|
||||
for(String ruleName : getRulesUsing(Action.Action_Enum.playSound))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;
|
||||
case Manifest.permission.BIND_DEVICE_ADMIN:
|
||||
for(String ruleName : getRulesUsing(Action.Action_Enum.turnScreenOnOrOff))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;
|
||||
case Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS:
|
||||
usingElements.add(getResources().getString(R.string.recommendedForBetterReliability));
|
||||
break;
|
||||
}
|
||||
|
||||
return usingElements;
|
||||
@ -859,20 +887,30 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
{
|
||||
if (requestCode == requestCodeForPermissionsBackgroundLocation)
|
||||
if (requestCode == requestCodeForPermissionsDeviceAdmin)
|
||||
{
|
||||
NotificationManager mNotificationManager = (NotificationManager) ActivityPermissions.this.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if (mNotificationManager.isNotificationPolicyAccessGranted())
|
||||
requestPermissions(cachedPermissionsToRequest, true);
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
{
|
||||
if (requestCode == requestCodeForPermissionsBackgroundLocation)
|
||||
{
|
||||
if (havePermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION, ActivityPermissions.this))
|
||||
requestPermissions(cachedPermissionsToRequest, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (requestCode == requestCodeForPermissionsNotifications)
|
||||
if(havePermission(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, ActivityPermissions.this))
|
||||
requestPermissions(cachedPermissionsToRequest, true);
|
||||
|
||||
if (requestCode == requestCodeForPermissionsBatteryOptimization)
|
||||
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
|
||||
requestPermissions(cachedPermissionsToRequest, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -923,12 +961,18 @@ public class ActivityPermissions extends Activity
|
||||
startActivityForResult(intent, requestCodeForPermissionsWriteSettings);
|
||||
return;
|
||||
}
|
||||
if (s.equalsIgnoreCase(Manifest.permission.BIND_DEVICE_ADMIN))
|
||||
{
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
requestDeviceAdmin();
|
||||
return;
|
||||
}
|
||||
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_NOTIFICATION_POLICY))
|
||||
{
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
||||
// intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
||||
return;
|
||||
}
|
||||
@ -936,19 +980,39 @@ public class ActivityPermissions extends Activity
|
||||
{
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
|
||||
startActivityForResult(intent, requestCodeForPermissionsNotifications);
|
||||
return;
|
||||
}
|
||||
// else if (s.equalsIgnoreCase(permissionNameLocationBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
// {
|
||||
// requiredPermissions.remove(s);
|
||||
// cachedPermissionsToRequest = requiredPermissions;
|
||||
// Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
// intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
// startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation);
|
||||
// return;
|
||||
// }
|
||||
else if(s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))
|
||||
{
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
String packageName = getApplicationContext().getPackageName();
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
intent.setData(Uri.parse("package:" + packageName));
|
||||
startActivityForResult(intent, requestCodeForPermissionsBatteryOptimization);
|
||||
return;
|
||||
}
|
||||
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
{
|
||||
AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.readLocation), getResources().getString(R.string.pleaseGiveBgLocation), ActivityPermissions.this);
|
||||
dialog.setOnDismissListener(new DialogInterface.OnDismissListener()
|
||||
{
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog)
|
||||
{
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation);
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -968,8 +1032,6 @@ public class ActivityPermissions extends Activity
|
||||
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
|
||||
{
|
||||
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
|
||||
&&
|
||||
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
||||
)
|
||||
{
|
||||
requiredPermissions.remove(Manifest.permission.SEND_SMS);
|
||||
@ -986,7 +1048,7 @@ public class ActivityPermissions extends Activity
|
||||
|
||||
Miscellaneous.logEvent("i", "Permissions", "Requesting permissions: " + permissions, 2);
|
||||
|
||||
// Toast.makeText(ActivityPermissions.this, "Requesting permissions. Amount: " + String.valueOf(requiredPermissions.size()), Toast.LENGTH_LONG).show();
|
||||
if(requiredPermissions.size() > 0)
|
||||
requestPermissions(requiredPermissions.toArray(new String[requiredPermissions.size()]), requestCodeForPermissions);
|
||||
}
|
||||
else
|
||||
@ -1005,17 +1067,11 @@ public class ActivityPermissions extends Activity
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "onRequestPermissionsResult()", "onRequestPermissionsResult()", 3);
|
||||
// Toast.makeText(ActivityPermissions.this, "onRequestPermissionsResult()", Toast.LENGTH_LONG).show();
|
||||
|
||||
// ArrayList<String> disabledFeatures = new ArrayList<String>();
|
||||
ArrayList<String> deniedPermissions = new ArrayList<String>();
|
||||
|
||||
if (requestCode == requestCodeForPermissions)
|
||||
{
|
||||
/*ArrayList<String> affectedGeneralList = new ArrayList<String>();
|
||||
ArrayList<String> affectedTriggersList = new ArrayList<String>();
|
||||
ArrayList<String> affectedActionList = new ArrayList<String>();*/
|
||||
|
||||
for (int i=0; i < grantResults.length; i++)
|
||||
{
|
||||
if(permissions[i].equalsIgnoreCase(Manifest.permission.WRITE_EXTERNAL_STORAGE) && grantResults[i] == PackageManager.PERMISSION_GRANTED)
|
||||
@ -1075,8 +1131,8 @@ public class ActivityPermissions extends Activity
|
||||
if(deniedPermissions.size() > 0)
|
||||
{
|
||||
/*
|
||||
The user denied certain permissions. With the exception of write-storage we need to live with that
|
||||
and simply disable features while keeping the notification alive. The user may dismiss it anyway.
|
||||
The user denied certain permissions. We need to live with that and simply disable
|
||||
features while keeping the notification alive. The user may dismiss it anyway.
|
||||
*/
|
||||
|
||||
Miscellaneous.logEvent("w", "Denied permissions", getResources().getString(R.string.theFollowingPermissionsHaveBeenDenied) + Miscellaneous.explode(", ", deniedPermissions), 3);
|
||||
@ -1155,10 +1211,6 @@ public class ActivityPermissions extends Activity
|
||||
private void setHaveAllPermissions()
|
||||
{
|
||||
setResult(RESULT_OK);
|
||||
// All permissions have been granted.
|
||||
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.cancel(notificationIdPermissions);
|
||||
ActivityMainScreen.updateMainScreen();
|
||||
|
||||
try
|
||||
{
|
||||
@ -1169,6 +1221,14 @@ public class ActivityPermissions extends Activity
|
||||
// Activity may not have been loaded, yet.
|
||||
}
|
||||
|
||||
// All permissions have been granted.
|
||||
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.cancel(notificationIdPermissions);
|
||||
if(AutomationService.getInstance() != null)
|
||||
AutomationService.getInstance().cancelNotification();
|
||||
|
||||
ActivityMainScreen.updateMainScreen();
|
||||
|
||||
this.finish();
|
||||
}
|
||||
|
||||
@ -1297,10 +1357,7 @@ public class ActivityPermissions extends Activity
|
||||
mapActionPermissions.put("setWifiTethering", Manifest.permission.WRITE_SETTINGS);
|
||||
mapActionPermissions.put("setWifiTethering", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||
mapActionPermissions.put("setWifiTethering", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||
// mapActionPermissions.put("speakText", Manifest.permission.ACCESS_NOTIFICATION_POLICY);
|
||||
// mapActionPermissions.put("startOtherActivity", "");
|
||||
mapActionPermissions.put("triggerUrl", Manifest.permission.INTERNET);
|
||||
// Hier müßte ein Hinweis kommen, daß nur die Variablen verwendet werden können, für die es Rechte gibt.
|
||||
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH_ADMIN);
|
||||
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH);
|
||||
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||
@ -1325,213 +1382,11 @@ public class ActivityPermissions extends Activity
|
||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.WRITE_SETTINGS);
|
||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||
mapActionPermissions.put("playSound", Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
// mapActionPermissions.put("waitBeforeNextAction", "");
|
||||
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
|
||||
}
|
||||
|
||||
/*
|
||||
<string name="android.permission.SEND_SMS"></string>
|
||||
<string name="android.permission.SEND_SMS_NO_CONFIRMATION"></string>
|
||||
<string name="android.permission.RECEIVE_SMS"></string>
|
||||
<string name="android.permission.RECEIVE_MMS"></string>
|
||||
<string name="android.permission.RECEIVE_EMERGENCY_BROADCAST"></string>
|
||||
<string name="android.permission.READ_CELL_BROADCASTS"></string>
|
||||
<string name="android.permission.READ_SMS"></string>
|
||||
<string name="android.permission.WRITE_SMS"></string>
|
||||
<string name="android.permission.RECEIVE_WAP_PUSH"></string>
|
||||
<string name="android.permission.READ_CONTACTS"></string>
|
||||
<string name="android.permission.WRITE_CONTACTS"></string>
|
||||
<string name="android.permission.BIND_DIRECTORY_SEARCH"></string>
|
||||
<string name="android.permission.READ_CALL_LOG"></string>
|
||||
<string name="android.permission.WRITE_CALL_LOG"></string>
|
||||
<string name="android.permission.READ_SOCIAL_STREAM"></string>
|
||||
<string name="android.permission.WRITE_SOCIAL_STREAM"></string>
|
||||
<string name="android.permission.READ_PROFILE"></string>
|
||||
<string name="android.permission.WRITE_PROFILE"></string>
|
||||
<string name="android.permission.READ_CALENDAR"></string>
|
||||
<string name="android.permission.WRITE_CALENDAR"></string>
|
||||
<string name="android.permission.READ_USER_DICTIONARY"></string>
|
||||
<string name="android.permission.WRITE_USER_DICTIONARY"></string>
|
||||
<string name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"></string>
|
||||
<string name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"></string>
|
||||
<string name="com.android.alarm.permission.SET_ALARM"></string>
|
||||
<string name="com.android.voicemail.permission.ADD_VOICEMAIL"></string>
|
||||
<string name="android.permission.ACCESS_FINE_LOCATION"></string>
|
||||
<string name="android.permission.ACCESS_COARSE_LOCATION"></string>
|
||||
<string name="android.permission.ACCESS_MOCK_LOCATION"></string>
|
||||
<string name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></string>
|
||||
<string name="android.permission.INSTALL_LOCATION_PROVIDER"></string>
|
||||
<string name="android.permission.INTERNET"></string>
|
||||
<string name="android.permission.ACCESS_NETWORK_STATE"></string>
|
||||
<string name="android.permission.ACCESS_WIFI_STATE"></string>
|
||||
<string name="android.permission.CHANGE_WIFI_STATE"></string>
|
||||
<string name="android.permission.ACCESS_WIMAX_STATE"></string>
|
||||
<string name="android.permission.CHANGE_WIMAX_STATE"></string>
|
||||
<string name="android.permission.BLUETOOTH"></string>
|
||||
<string name="android.permission.BLUETOOTH_ADMIN"></string>
|
||||
<string name="android.permission.BLUETOOTH_STACK"></string>
|
||||
<string name="android.permission.NFC"></string>
|
||||
<string name="android.permission.CONNECTIVITY_INTERNAL"></string>
|
||||
<string name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"></string>
|
||||
<string name="android.permission.GET_ACCOUNTS"></string>
|
||||
<string name="android.permission.AUTHENTICATE_ACCOUNTS"></string>
|
||||
<string name="android.permission.USE_CREDENTIALS"></string>
|
||||
<string name="android.permission.MANAGE_ACCOUNTS"></string>
|
||||
<string name="android.permission.ACCOUNT_MANAGER"></string>
|
||||
<string name="android.permission.CHANGE_WIFI_MULTICAST_STATE"></string>
|
||||
<string name="android.permission.VIBRATE"></string>
|
||||
<string name="android.permission.FLASHLIGHT"></string>
|
||||
<string name="android.permission.WAKE_LOCK"></string>
|
||||
<string name="android.permission.MODIFY_AUDIO_SETTINGS"></string>
|
||||
<string name="android.permission.MANAGE_USB"></string>
|
||||
<string name="android.permission.ACCESS_MTP"></string>
|
||||
<string name="android.permission.HARDWARE_TEST"></string>
|
||||
<string name="android.permission.NET_ADMIN"></string>
|
||||
<string name="android.permission.REMOTE_AUDIO_PLAYBACK"></string>
|
||||
<string name="android.permission.RECORD_AUDIO"></string>
|
||||
<string name="android.permission.CAMERA"></string>
|
||||
<string name="android.permission.PROCESS_OUTGOING_CALLS"></string>
|
||||
<string name="android.permission.MODIFY_PHONE_STATE"></string>
|
||||
<string name="android.permission.READ_PHONE_STATE"></string>
|
||||
<string name="android.permission.READ_PRIVILEGED_PHONE_STATE"></string>
|
||||
<string name="android.permission.CALL_PHONE"></string>
|
||||
<string name="android.permission.USE_SIP"></string>
|
||||
<string name="android.permission.READ_EXTERNAL_STORAGE"></string>
|
||||
<string name="android.permission.WRITE_EXTERNAL_STORAGE"></string>
|
||||
<string name="android.permission.WRITE_MEDIA_STORAGE"></string>
|
||||
<string name="android.permission.DISABLE_KEYGUARD"></string>
|
||||
<string name="android.permission.GET_TASKS"></string>
|
||||
<string name="android.permission.INTERACT_ACROSS_USERS"></string>
|
||||
<string name="android.permission.INTERACT_ACROSS_USERS_FULL"></string>
|
||||
<string name="android.permission.MANAGE_USERS"></string>
|
||||
<string name="android.permission.GET_DETAILED_TASKS"></string>
|
||||
<string name="android.permission.REORDER_TASKS"></string>
|
||||
<string name="android.permission.REMOVE_TASKS"></string>
|
||||
<string name="android.permission.START_ANY_ACTIVITY"></string>
|
||||
<string name="android.permission.RESTART_PACKAGES"></string>
|
||||
<string name="android.permission.KILL_BACKGROUND_PROCESSES"></string>
|
||||
<string name="android.permission.SYSTEM_ALERT_WINDOW"></string>
|
||||
<string name="android.permission.SET_WALLPAPER"></string>
|
||||
<string name="android.permission.SET_WALLPAPER_HINTS"></string>
|
||||
<string name="android.permission.SET_TIME"></string>
|
||||
<string name="android.permission.SET_TIME_ZONE"></string>
|
||||
<string name="android.permission.EXPAND_STATUS_BAR"></string>
|
||||
<string name="android.permission.READ_SYNC_SETTINGS"></string>
|
||||
<string name="android.permission.WRITE_SYNC_SETTINGS"></string>
|
||||
<string name="android.permission.READ_SYNC_STATS"></string>
|
||||
<string name="android.permission.SET_SCREEN_COMPATIBILITY"></string>
|
||||
<string name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE"></string>
|
||||
<string name="android.permission.CHANGE_CONFIGURATION"></string>
|
||||
<string name="android.permission.WRITE_SETTINGS"></string>
|
||||
<string name="android.permission.WRITE_GSERVICES"></string>
|
||||
<string name="android.permission.SET_SCREEN_COMPATIBILITY"></string>
|
||||
<string name="android.permission.CHANGE_CONFIGURATION"></string>
|
||||
<string name="android.permission.FORCE_STOP_PACKAGES"></string>
|
||||
<string name="android.permission.RETRIEVE_WINDOW_CONTENT"></string>
|
||||
<string name="android.permission.SET_ANIMATION_SCALE"></string>
|
||||
<string name="android.permission.PERSISTENT_ACTIVITY"></string>
|
||||
<string name="android.permission.GET_PACKAGE_SIZE"></string>
|
||||
<string name="android.permission.SET_PREFERRED_APPLICATIONS"></string>
|
||||
<string name="android.permission.RECEIVE_BOOT_COMPLETED"></string>
|
||||
<string name="android.permission.BROADCAST_STICKY"></string>
|
||||
<string name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></string>
|
||||
<string name="android.permission.MOUNT_FORMAT_FILESYSTEMS"></string>
|
||||
<string name="android.permission.ASEC_ACCESS"></string>
|
||||
<string name="android.permission.ASEC_CREATE"></string>
|
||||
<string name="android.permission.ASEC_DESTROY"></string>
|
||||
<string name="android.permission.ASEC_MOUNT_UNMOUNT"></string>
|
||||
<string name="android.permission.ASEC_RENAME"></string>
|
||||
<string name="android.permission.WRITE_APN_SETTINGS"></string>
|
||||
<string name="android.permission.SUBSCRIBED_FEEDS_READ"></string>
|
||||
<string name="android.permission.SUBSCRIBED_FEEDS_WRITE"></string>
|
||||
<string name="android.permission.CHANGE_NETWORK_STATE"></string>
|
||||
<string name="android.permission.CLEAR_APP_CACHE"></string>
|
||||
<string name="android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK"></string>
|
||||
<string name="android.permission.WRITE_SECURE_SETTINGS"></string>
|
||||
<string name="android.permission.DUMP"></string>
|
||||
<string name="android.permission.READ_LOGS"></string>
|
||||
<string name="android.permission.SET_DEBUG_APP"></string>
|
||||
<string name="android.permission.SET_PROCESS_LIMIT"></string>
|
||||
<string name="android.permission.SET_ALWAYS_FINISH"></string>
|
||||
<string name="android.permission.SIGNAL_PERSISTENT_PROCESSES"></string>
|
||||
<string name="android.permission.DIAGNOSTIC"></string>
|
||||
<string name="android.permission.STATUS_BAR"></string>
|
||||
<string name="android.permission.STATUS_BAR_SERVICE"></string>
|
||||
<string name="android.permission.FORCE_BACK"></string>
|
||||
<string name="android.permission.UPDATE_DEVICE_STATS"></string>
|
||||
<string name="android.permission.INTERNAL_SYSTEM_WINDOW"></string>
|
||||
<string name="android.permission.MANAGE_APP_TOKENS"></string>
|
||||
<string name="android.permission.FREEZE_SCREEN"></string>
|
||||
<string name="android.permission.INJECT_EVENTS"></string>
|
||||
<string name="android.permission.FILTER_EVENTS"></string>
|
||||
<string name="android.permission.RETRIEVE_WINDOW_INFO"></string>
|
||||
<string name="android.permission.TEMPORARY_ENABLE_ACCESSIBILITY"></string>
|
||||
<string name="android.permission.MAGNIFY_DISPLAY"></string>
|
||||
<string name="android.permission.SET_ACTIVITY_WATCHER"></string>
|
||||
<string name="android.permission.SHUTDOWN"></string>
|
||||
<string name="android.permission.STOP_APP_SWITCHES"></string>
|
||||
<string name="android.permission.READ_INPUT_STATE"></string>
|
||||
<string name="android.permission.BIND_INPUT_METHOD"></string>
|
||||
<string name="android.permission.BIND_ACCESSIBILITY_SERVICE"></string>
|
||||
<string name="android.permission.BIND_TEXT_SERVICE"></string>
|
||||
<string name="android.permission.BIND_VPN_SERVICE"></string>
|
||||
<string name="android.permission.BIND_WALLPAPER"></string>
|
||||
<string name="android.permission.BIND_DEVICE_ADMIN"></string>
|
||||
<string name="android.permission.SET_ORIENTATION"></string>
|
||||
<string name="android.permission.SET_POINTER_SPEED"></string>
|
||||
<string name="android.permission.SET_KEYBOARD_LAYOUT"></string>
|
||||
<string name="android.permission.INSTALL_PACKAGES"></string>
|
||||
<string name="android.permission.CLEAR_APP_USER_DATA"></string>
|
||||
<string name="android.permission.DELETE_CACHE_FILES"></string>
|
||||
<string name="android.permission.DELETE_PACKAGES"></string>
|
||||
<string name="android.permission.MOVE_PACKAGE"></string>
|
||||
<string name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"></string>
|
||||
<string name="android.permission.GRANT_REVOKE_PERMISSIONS"></string>
|
||||
<string name="android.permission.ACCESS_SURFACE_FLINGER"></string>
|
||||
<string name="android.permission.READ_FRAME_BUFFER"></string>
|
||||
<string name="android.permission.CONFIGURE_WIFI_DISPLAY"></string>
|
||||
<string name="android.permission.CONTROL_WIFI_DISPLAY"></string>
|
||||
<string name="android.permission.BRICK"></string>
|
||||
<string name="android.permission.REBOOT"></string>
|
||||
<string name="android.permission.DEVICE_POWER"></string>
|
||||
<string name="android.permission.NET_TUNNELING"></string>
|
||||
<string name="android.permission.FACTORY_TEST"></string>
|
||||
<string name="android.permission.BROADCAST_PACKAGE_REMOVED"></string>
|
||||
<string name="android.permission.BROADCAST_SMS"></string>
|
||||
<string name="android.permission.BROADCAST_WAP_PUSH"></string>
|
||||
<string name="android.permission.MASTER_CLEAR"></string>
|
||||
<string name="android.permission.CALL_PRIVILEGED"></string>
|
||||
<string name="android.permission.PERFORM_CDMA_PROVISIONING"></string>
|
||||
<string name="android.permission.CONTROL_LOCATION_UPDATES"></string>
|
||||
<string name="android.permission.ACCESS_CHECKIN_PROPERTIES"></string>
|
||||
<string name="android.permission.PACKAGE_USAGE_STATS"></string>
|
||||
<string name="android.permission.BATTERY_STATS"></string>
|
||||
<string name="android.permission.BACKUP"></string>
|
||||
<string name="android.permission.CONFIRM_FULL_BACKUP"></string>
|
||||
<string name="android.permission.BIND_REMOTEVIEWS"></string>
|
||||
<string name="android.permission.BIND_APPWIDGET"></string>
|
||||
<string name="android.permission.BIND_KEYGUARD_APPWIDGET"></string>
|
||||
<string name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS"></string>
|
||||
<string name="android.permission.CHANGE_BACKGROUND_DATA_SETTING"></string>
|
||||
<string name="android.permission.GLOBAL_SEARCH"></string>
|
||||
<string name="android.permission.GLOBAL_SEARCH_CONTROL"></string>
|
||||
<string name="android.permission.SET_WALLPAPER_COMPONENT"></string>
|
||||
<string name="android.permission.READ_DREAM_STATE"></string>
|
||||
<string name="android.permission.WRITE_DREAM_STATE"></string>
|
||||
<string name="android.permission.ACCESS_CACHE_FILESYSTEM"></string>
|
||||
<string name="android.permission.COPY_PROTECTED_DATA"></string>
|
||||
<string name="android.permission.CRYPT_KEEPER"></string>
|
||||
<string name="android.permission.READ_NETWORK_USAGE_HISTORY"></string>
|
||||
<string name="android.permission.MANAGE_NETWORK_POLICY"></string>
|
||||
<string name="android.permission.MODIFY_NETWORK_ACCOUNTING"></string>
|
||||
<string name="android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE"></string>
|
||||
<string name="android.permission.PACKAGE_VERIFICATION_AGENT"></string>
|
||||
<string name="android.permission.BIND_PACKAGE_VERIFIER"></string>
|
||||
<string name="android.permission.SERIAL_PORT"></string>
|
||||
<string name="android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY"></string>
|
||||
<string name="android.permission.UPDATE_LOCK"></string>
|
||||
*/
|
||||
|
||||
public static boolean isPermissionDeclaratedInManifest(Context context, String permission)
|
||||
{
|
||||
PackageManager pm = context.getPackageManager();
|
||||
@ -1550,12 +1405,11 @@ public class ActivityPermissions extends Activity
|
||||
ArrayList<String> requestedPermissionsArrayList = new ArrayList<String>();
|
||||
requestedPermissionsArrayList.addAll(requestedPermissionsList);
|
||||
return (requestedPermissionsArrayList.contains(permission));
|
||||
// Log.i(ExConsts.TAG, ""+requestedPermissionsArrayList);
|
||||
}
|
||||
}
|
||||
catch (PackageManager.NameNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Miscellaneous.logEvent("w", "ActivityPermissions", Log.getStackTraceString(e), 2);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
@ -9,11 +10,18 @@ import com.jens.automation2.R.layout;
|
||||
public class ActivitySettings extends PreferenceActivity
|
||||
{
|
||||
ListPreference lpStartScreenOptionsValues;
|
||||
CheckBoxPreference chkPrefUpdateCheck;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(layout.settings);
|
||||
addPreferencesFromResource(layout.activity_settings);
|
||||
|
||||
if(BuildConfig.FLAVOR.equals("apkFlavor"))
|
||||
{
|
||||
chkPrefUpdateCheck = (CheckBoxPreference) findPreference("automaticUpdateCheck");
|
||||
chkPrefUpdateCheck.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ public class ActivityVolumeTest extends Activity
|
||||
instance = this;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_volume_test);
|
||||
setContentView(R.layout.activity_volume_calibration);
|
||||
|
||||
tvCurrentVolume = (TextView)findViewById(R.id.tvCurrentVolume);
|
||||
etReferenceValue = (EditText)findViewById(R.id.etReferenceValue);
|
||||
sbReferenceValue = (SeekBar)findViewById(R.id.sbReferenceValue);
|
||||
tvVolumeTestExplanation = (TextView)findViewById(R.id.tvVolumeTestExplanation);
|
||||
tvVolumeTestExplanation = (TextView)findViewById(R.id.tvVolumeCalibrationExplanation);
|
||||
|
||||
tvVolumeTestExplanation.setText(String.format(getResources().getString(R.string.volumeTesterExplanation), String.valueOf(volumeRefreshInterval)));
|
||||
tvVolumeTestExplanation.setText(String.format(getResources().getString(R.string.volumeCalibrationExplanation), String.valueOf(volumeRefreshInterval)));
|
||||
|
||||
etReferenceValue.setText(String.valueOf(Settings.referenceValueForNoiseLevelMeasurements));
|
||||
|
||||
|
65
app/src/main/java/com/jens/automation2/AsyncTasks.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class AsyncTasks
|
||||
{
|
||||
public static class AsyncTaskUpdateCheck extends AsyncTask<Context, Void, Boolean>
|
||||
{
|
||||
public static boolean checkRunning = false;
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Context... contexts)
|
||||
{
|
||||
if(checkRunning)
|
||||
return false;
|
||||
else
|
||||
checkRunning = true;
|
||||
|
||||
try
|
||||
{
|
||||
String result = Miscellaneous.downloadURL("https://server47.de/automation/?action=getLatestVersionCode", null, null).trim();
|
||||
int latestVersion = Integer.parseInt(result);
|
||||
|
||||
// At this point the update check itself has already been successful.
|
||||
|
||||
Settings.lastUpdateCheck = Calendar.getInstance().getTimeInMillis();
|
||||
Settings.writeSettings(contexts[0]);
|
||||
|
||||
if (latestVersion > BuildConfig.VERSION_CODE)
|
||||
{
|
||||
// There's a new update
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Error checking for update", Log.getStackTraceString(e), 3);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result)
|
||||
{
|
||||
try
|
||||
{
|
||||
ActivityMainScreen.getActivityMainScreenInstance().processUpdateCheckResult(result);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "NewsDownload", "There was a problem displaying the update check result, probably ActivityMainScreen isn't currently shown: " + Log.getStackTraceString(e), 2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "NewsDownload", "There was a problem displaying the update check result: " + Log.getStackTraceString(e), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||
import com.jens.automation2.location.LocationProvider;
|
||||
@ -197,7 +198,8 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
if (checkStartupRequirements(this, startAtBoot))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.logServiceStarting), 1);
|
||||
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.logServiceStarting) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
|
||||
Miscellaneous.logEvent("i", "Service", ActivityMaintenance.getSystemInfo(), 1);
|
||||
|
||||
startUpRoutine();
|
||||
|
||||
@ -211,7 +213,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
ActivityMainScreen.updateMainScreen();
|
||||
|
||||
this.isRunning = true;
|
||||
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.serviceStarted) + " " + String.format(this.getResources().getString(R.string.version), BuildConfig.VERSION_NAME + "(Build " + BuildConfig.VERSION_CODE + ")"), 1);
|
||||
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.serviceStarted) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
|
||||
Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show();
|
||||
// ********** Test area **********
|
||||
// Miscellaneous.logEvent("i", "setNetworkType", "bin hier.", 3);
|
||||
@ -258,6 +260,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
case reloadSettings:
|
||||
Settings.readFromPersistentStorage(this);
|
||||
applySettingsAndRules();
|
||||
if(myLocationProvider != null)
|
||||
myLocationProvider.applySettingsAndRules();
|
||||
break;
|
||||
case updateNotification:
|
||||
@ -271,16 +274,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
public void applySettingsAndRules()
|
||||
{
|
||||
if (Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate)
|
||||
{
|
||||
if (ttsEngine == null)
|
||||
ttsEngine = new TextToSpeech(this, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ttsEngine != null)
|
||||
ttsEngine.shutdown();
|
||||
}
|
||||
checkForTtsEngine();
|
||||
|
||||
startLocationProvider();
|
||||
ReceiverCoordinator.startAllReceivers();
|
||||
@ -303,7 +297,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
public void checkForTtsEngine()
|
||||
{
|
||||
if (Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate | Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
|
||||
if (Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate || Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
|
||||
{
|
||||
if (ttsEngine == null)
|
||||
ttsEngine = new TextToSpeech(this, this);
|
||||
@ -332,7 +326,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
protected void startLocationProvider()
|
||||
{
|
||||
if(ActivityPermissions.havePermission("android.permission.ACCESS_COARSE_LOCATION", AutomationService.this))
|
||||
if(ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.this))
|
||||
myLocationProvider = new LocationProvider(this); //autostart with this (only) constructor
|
||||
}
|
||||
|
||||
@ -342,19 +336,22 @@ public class AutomationService extends Service implements OnInitListener
|
||||
{
|
||||
boolean displayNotification = false;
|
||||
|
||||
String rule = "";
|
||||
|
||||
outerLoop:
|
||||
for(Rule r : Rule.getRuleCollection())
|
||||
{
|
||||
if(r.isRuleActive())
|
||||
{
|
||||
if(!r.haveEnoughPermissions())
|
||||
// for (String permission : ActivityPermissions.getPermissionsForRule(r))
|
||||
{
|
||||
// if (!ActivityPermissions.havePermission(permission, AutomationService.this))
|
||||
{
|
||||
// r.setRuleActive(false);
|
||||
// r.change(AutomationService.this);
|
||||
if(!displayNotification)
|
||||
{
|
||||
displayNotification = true;
|
||||
rule = r.getName();
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,18 +359,16 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
if(displayNotification)
|
||||
{
|
||||
// Toast.makeText(Miscellaneous.getAnyContext(), "Require more permissions.", Toast.LENGTH_LONG).show();
|
||||
// Update notification or show new one that notifiies of the lack or permissions.
|
||||
|
||||
Intent intent = new Intent(AutomationService.this, ActivityPermissions.class);
|
||||
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
|
||||
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Features disabled because of rule " + rule, 5);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(1010, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
|
||||
}
|
||||
// else
|
||||
// Toast.makeText(Miscellaneous.getAnyContext(), "Have all required permissions.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,6 +385,9 @@ public class AutomationService extends Service implements OnInitListener
|
||||
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
|
||||
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
|
||||
// Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), ActivityPermissions.notificationIdPermissions, pi);
|
||||
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(3300, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi);
|
||||
else
|
||||
@ -398,6 +396,11 @@ public class AutomationService extends Service implements OnInitListener
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelNotification()
|
||||
{
|
||||
NotificationManagerCompat.from(AutomationService.this).cancelAll();
|
||||
}
|
||||
|
||||
protected void checkForMissingBackgroundLocationPermission()
|
||||
{
|
||||
if(Miscellaneous.googleToBlameForLocation(true))
|
||||
@ -405,29 +408,14 @@ public class AutomationService extends Service implements OnInitListener
|
||||
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
|
||||
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
}
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
|
||||
|
||||
/*
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
{
|
||||
if (BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
|
||||
{
|
||||
if (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest))
|
||||
{
|
||||
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
|
||||
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void startAutomationService(Context context, boolean startAtBoot)
|
||||
{
|
||||
@ -447,7 +435,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
private void stopRoutine()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Service", "Stopping service...", 3);
|
||||
// Log.i("STOP", "Stopping");
|
||||
try
|
||||
{
|
||||
myLocationProvider.stopLocationService();
|
||||
@ -476,7 +463,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
builder.setWhen(System.currentTimeMillis());
|
||||
builder.setContentIntent(myPendingIntent);
|
||||
|
||||
// Notification defaultNotification = new Notification();
|
||||
Notification defaultNotification = builder.build();
|
||||
|
||||
defaultNotification.icon = R.drawable.ic_launcher;
|
||||
@ -494,31 +480,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
// defaultNotification.ledOffMS = 1500;
|
||||
|
||||
return builder;
|
||||
|
||||
/*NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
NotificationCompat.Builder builder;
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance());
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
builder.setCategory(Notification.CATEGORY_EVENT);
|
||||
|
||||
builder.setWhen(System.currentTimeMillis());
|
||||
|
||||
builder.setContentTitle("Automation");
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
// builder.setContentText(textToDisplay);
|
||||
// builder.setSmallIcon(icon);
|
||||
// builder.setContentIntent(pendingIntent);
|
||||
// builder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
NotificationChannel channel = new NotificationChannel("notify_001", "Channel human readable title", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
mNotificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
return builder;*/
|
||||
}
|
||||
|
||||
protected static NotificationCompat.Builder createDefaultNotificationBuilder()
|
||||
@ -568,8 +529,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
if(instance != null)
|
||||
{
|
||||
// if(Settings.showIconWhenServiceIsRunning)
|
||||
// {
|
||||
Miscellaneous.logEvent("i", "Notification", "Request to update notification.", 4);
|
||||
|
||||
String bodyText="";
|
||||
@ -615,18 +574,15 @@ public class AutomationService extends Service implements OnInitListener
|
||||
}
|
||||
|
||||
String textToDisplay = bodyText + " " + lastRuleString;
|
||||
// if(Build.VERSION.SDK_INT < 11)
|
||||
// {
|
||||
// myNotification.setLatestEventInfo(instance, "Automation", textToDisplay, myPendingIntent);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
if(notificationBuilder == null)
|
||||
notificationBuilder = createDefaultNotificationBuilder();
|
||||
|
||||
notificationBuilder.setContentText(textToDisplay);
|
||||
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
|
||||
myNotification = notificationBuilder.build();
|
||||
myNotification.defaults = 0;
|
||||
// }
|
||||
|
||||
// NotificationManager notificationManager = (NotificationManager) instance.getSystemService(NOTIFICATION_SERVICE);
|
||||
// hide the notification after its selected
|
||||
@ -635,9 +591,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
// notificationManager.notify(notificationId, myNotification);
|
||||
|
||||
instance.startForeground(notificationId, myNotification);
|
||||
// }
|
||||
// else
|
||||
// instance.startForeground(notificationId, null); // do not show icon in task bar
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,18 +614,18 @@ public class AutomationService extends Service implements OnInitListener
|
||||
**/
|
||||
public void speak(String text, boolean force)
|
||||
{
|
||||
if(text.length() > 0 && (force | Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate))
|
||||
if(text.length() > 0 && (force || Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate))
|
||||
{
|
||||
AudioManager myAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
|
||||
int mode = myAudioManager.getRingerMode();
|
||||
|
||||
if(
|
||||
(mode == AudioManager.RINGER_MODE_NORMAL && Settings.useTextToSpeechOnNormal)
|
||||
|
|
||||
||
|
||||
(mode == AudioManager.RINGER_MODE_VIBRATE && Settings.useTextToSpeechOnVibrate)
|
||||
|
|
||||
||
|
||||
(mode == AudioManager.RINGER_MODE_SILENT && Settings.useTextToSpeechOnSilent)
|
||||
|
|
||||
||
|
||||
force
|
||||
)
|
||||
{
|
||||
@ -702,12 +655,12 @@ public class AutomationService extends Service implements OnInitListener
|
||||
{}
|
||||
}
|
||||
}
|
||||
Miscellaneous.logEvent("i", "TextToSpeech", "Speaking " + text + " in language " + ttsEngine.getLanguage().toLanguageTag(), 3);
|
||||
this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "TextToSpeech", Log.getStackTraceString(e), 3);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -720,31 +673,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
// boolean isActivityFound = false;
|
||||
// ActivityManager activityManager = (ActivityManager)context.getSystemService (Context.ACTIVITY_SERVICE);
|
||||
// List<RunningTaskInfo> activitys = activityManager.getRunningTasks(Integer.MAX_VALUE);
|
||||
// isActivityFound = false;
|
||||
// for (int i = 0; i < activitys.size(); i++)
|
||||
// {
|
||||
// if (activitys.get(i).topActivity.toString().equalsIgnoreCase("ComponentInfo{com.jens.automation/com.jens.automation.ActivityMainScreen}"))
|
||||
// {
|
||||
// isActivityFound = true;
|
||||
// }
|
||||
// }
|
||||
// Miscellaneous.logEvent("i", "ActivityMainScreen", "Activity running status: " + String.valueOf(isActivityFound), 5);
|
||||
// return isActivityFound;
|
||||
|
||||
// ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
// List<RunningTaskInfo> tasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
|
||||
//
|
||||
// for (RunningTaskInfo task : tasks)
|
||||
// {
|
||||
// if (context.getPackageName().equalsIgnoreCase(task.baseActivity.getPackageName()))
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
}
|
||||
|
||||
public static boolean isMyServiceRunning(Context context)
|
||||
@ -756,7 +684,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
{
|
||||
if(AutomationService.class.getName().equals(service.service.getClassName()))
|
||||
{
|
||||
// return AutomationService.getInstance() != null && AutomationService.getInstance().isRunning;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -765,7 +692,6 @@ public class AutomationService extends Service implements OnInitListener
|
||||
{
|
||||
if(Log.getStackTraceString(e).contains("activate")) // Means that a poi has been activated/deactivated. Service is running.
|
||||
return true;
|
||||
// return AutomationService.getInstance() != null && AutomationService.getInstance().isRunning;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
22
app/src/main/java/com/jens/automation2/DeviceAdmin.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.admin.DeviceAdminReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class DeviceAdmin extends DeviceAdminReceiver
|
||||
{
|
||||
@Override
|
||||
public void onEnabled (Context context , Intent intent)
|
||||
{
|
||||
super.onEnabled(context , intent) ;
|
||||
Miscellaneous.logEvent("i", "DeviceAdmin", "Got permission BIND_DEVICE_ADMIN.", 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled (Context context , Intent intent)
|
||||
{
|
||||
super.onDisabled(context , intent) ;
|
||||
Miscellaneous.logEvent("i", "DeviceAdmin", "Permission BIND_DEVICE_ADMIN taken.", 3);
|
||||
}
|
||||
}
|
@ -14,7 +14,10 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@ -75,6 +78,8 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.sql.Time;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -121,15 +126,6 @@ public class Miscellaneous extends Service
|
||||
if(url.toLowerCase().contains("https"))
|
||||
{
|
||||
connection = (HttpsURLConnection) urlObject.openConnection();
|
||||
|
||||
// if(Settings.httpAcceptAllCertificates)
|
||||
// {
|
||||
// SSLContext sc = SSLContext.getInstance("TLS");
|
||||
// sc.init(null, getInsecureTrustManager(), new java.security.SecureRandom());
|
||||
// HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
// Miscellaneous.disableSSLCertificateChecking();
|
||||
// HttpsURLConnection.setDefaultHostnameVerifier(getInsecureHostnameVerifier());
|
||||
// }
|
||||
}
|
||||
else
|
||||
connection = (HttpURLConnection) urlObject.openConnection();
|
||||
@ -220,6 +216,14 @@ public class Miscellaneous extends Service
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int boolToInt(boolean input)
|
||||
{
|
||||
if(input)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0)
|
||||
{
|
||||
@ -456,6 +460,14 @@ public class Miscellaneous extends Service
|
||||
|
||||
public static boolean compare(String direction, String needle, String haystack)
|
||||
{
|
||||
// If only one of needle or haystack is null
|
||||
if(
|
||||
(needle == null && haystack != null)
|
||||
||
|
||||
(needle != null && haystack == null)
|
||||
)
|
||||
return false;
|
||||
|
||||
switch(direction)
|
||||
{
|
||||
case Trigger.directionEquals:
|
||||
@ -541,6 +553,22 @@ public class Miscellaneous extends Service
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isDarkModeEnabled(Context context)
|
||||
{
|
||||
int mode = context.getResources().getConfiguration().uiMode;
|
||||
switch(mode)
|
||||
{
|
||||
case 33:
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
return true;
|
||||
case 17:
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static String replaceVariablesInText(String source, Context context) throws Exception
|
||||
{
|
||||
@ -608,8 +636,11 @@ public class Miscellaneous extends Service
|
||||
if(notificationTitle != null && notificationTitle.length() > 0)
|
||||
source = source.replace("[notificationTitle]", notificationTitle);
|
||||
else
|
||||
{
|
||||
source = source.replace("notificationTitle unknown", notificationTitle);
|
||||
Miscellaneous.logEvent("w", "Variable replacement", "notificationTitle was empty.", 3);
|
||||
}
|
||||
}
|
||||
|
||||
if(source.contains("[notificationText]"))
|
||||
{
|
||||
@ -618,8 +649,11 @@ public class Miscellaneous extends Service
|
||||
if(notificationText != null && notificationText.length() > 0)
|
||||
source = source.replace("[notificationText]", notificationText);
|
||||
else
|
||||
{
|
||||
source = source.replace("notificationText unknown", notificationText);
|
||||
Miscellaneous.logEvent("w", "Variable replacement", "notificationText was empty.", 3);
|
||||
}
|
||||
}
|
||||
|
||||
// Miscellaneous.logEvent("i", "URL after replace", source);
|
||||
|
||||
@ -666,6 +700,24 @@ public class Miscellaneous extends Service
|
||||
return alertDialog.create();
|
||||
}
|
||||
|
||||
private boolean haveNetworkConnection()
|
||||
{
|
||||
boolean haveConnectedWifi = false;
|
||||
boolean haveConnectedMobile = false;
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
|
||||
for (NetworkInfo ni : netInfo) {
|
||||
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
|
||||
if (ni.isConnected())
|
||||
haveConnectedWifi = true;
|
||||
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
|
||||
if (ni.isConnected())
|
||||
haveConnectedMobile = true;
|
||||
}
|
||||
return haveConnectedWifi || haveConnectedMobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the device is rooted.
|
||||
*
|
||||
@ -673,9 +725,13 @@ public class Miscellaneous extends Service
|
||||
*/
|
||||
public static boolean isPhoneRooted()
|
||||
{
|
||||
// if(true)
|
||||
// return true;
|
||||
|
||||
// get from build info
|
||||
String buildTags = Build.TAGS;
|
||||
if (buildTags != null && buildTags.contains("test-keys")) {
|
||||
if (buildTags != null && buildTags.contains("test-keys"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -882,6 +938,7 @@ public class Miscellaneous extends Service
|
||||
dismissableNotificationBuilder.setContentText(textToDisplay);
|
||||
dismissableNotificationBuilder.setContentIntent(pendingIntent);
|
||||
dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
dismissableNotificationBuilder.setAutoCancel(true);
|
||||
|
||||
Notification dismissableNotification = dismissableNotificationBuilder.build();
|
||||
|
||||
@ -983,6 +1040,7 @@ public class Miscellaneous extends Service
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
builder.setCategory(Notification.CATEGORY_SERVICE);
|
||||
|
||||
builder.setAutoCancel(true);
|
||||
builder.setWhen(System.currentTimeMillis());
|
||||
builder.setContentIntent(myPendingIntent);
|
||||
|
||||
@ -1015,6 +1073,23 @@ public class Miscellaneous extends Service
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String explode(String glue, String[] inputArray)
|
||||
{
|
||||
if(inputArray != null)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String s : inputArray)
|
||||
builder.append(s + glue);
|
||||
|
||||
if (builder.length() > 0)
|
||||
builder.delete(builder.length() - glue.length(), builder.length());
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public static boolean isGooglePlayInstalled(Context context)
|
||||
{
|
||||
// return false;
|
||||
@ -1102,11 +1177,11 @@ public class Miscellaneous extends Service
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Miscellaneous.logEvent("w", "runMethodReflective", Log.getStackTraceString(e),5 );
|
||||
}
|
||||
catch (InvocationTargetException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Miscellaneous.logEvent("w", "runMethodReflective", Log.getStackTraceString(e),5 );
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1501,4 +1576,21 @@ public class Miscellaneous extends Service
|
||||
else*/
|
||||
return PhoneNumberUtils.compare(number1, number2);
|
||||
}
|
||||
|
||||
public static String formatDate(Date input)
|
||||
{
|
||||
DateFormat sdf = null;
|
||||
SimpleDateFormat fallBackFormatter = new SimpleDateFormat(Settings.dateFormat);
|
||||
|
||||
if(sdf == null && Settings.dateFormat != null)
|
||||
sdf = new SimpleDateFormat(Settings.dateFormat);
|
||||
|
||||
String formattedDate;
|
||||
if(sdf != null)
|
||||
formattedDate = sdf.format(input);
|
||||
else
|
||||
formattedDate = fallBackFormatter.format(input);
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||
public class News
|
||||
{
|
||||
Calendar publishDate;
|
||||
String applicablePlattform;
|
||||
String applicablePlatform;
|
||||
Map<String,NewsTranslation> translations = new HashMap<>();
|
||||
|
||||
public static class NewsTranslation
|
||||
@ -76,7 +76,7 @@ public class News
|
||||
if(oldFilePath.exists())
|
||||
oldFilePath.delete();
|
||||
|
||||
if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == -1 || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.newsDisplayForXDays * 24 * 60 * 60 * 1000))
|
||||
if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == Settings.default_lastNewsPolltime || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.newsDisplayForXDays * 24 * 60 * 60 * 1000))
|
||||
{
|
||||
String newsUrl = "https://server47.de/automation/appNews.php";
|
||||
newsContent = Miscellaneous.downloadURL(newsUrl, null, null);
|
||||
@ -151,9 +151,9 @@ public class News
|
||||
String publishDateString = neEl.getElementsByTagName("publishDate").item(0).getTextContent();
|
||||
newsEntry.setPublishDate(Miscellaneous.calendarFromLong(Long.parseLong(publishDateString) * 1000));
|
||||
|
||||
newsEntry.setApplicablePlattform(neEl.getElementsByTagName("applicablePlattforms").item(0).getTextContent());
|
||||
newsEntry.setApplicablePlatform(neEl.getElementsByTagName("applicablePlattforms").item(0).getTextContent());
|
||||
|
||||
if(newsEntry.getApplicablePlattform().equalsIgnoreCase("all") || newsEntry.getApplicablePlattform().equalsIgnoreCase(BuildConfig.FLAVOR))
|
||||
if(newsEntry.getApplicablePlatform().equalsIgnoreCase("all") || newsEntry.getApplicablePlatform().equalsIgnoreCase(BuildConfig.FLAVOR))
|
||||
returnList.add(newsEntry);
|
||||
}
|
||||
}
|
||||
@ -199,14 +199,14 @@ public class News
|
||||
this.publishDate = publishDate;
|
||||
}
|
||||
|
||||
public String getApplicablePlattform()
|
||||
public String getApplicablePlatform()
|
||||
{
|
||||
return applicablePlattform;
|
||||
return applicablePlatform;
|
||||
}
|
||||
|
||||
public void setApplicablePlattform(String applicablePlattform)
|
||||
public void setApplicablePlatform(String applicablePlatform)
|
||||
{
|
||||
this.applicablePlattform = applicablePlattform;
|
||||
this.applicablePlatform = applicablePlatform;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -253,7 +253,8 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
|
||||
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, true);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
|
||||
if(ruleCandidates.size()==0)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
||||
@ -264,7 +265,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(parentService) && ruleCandidates.get(i).haveEnoughPermissions())
|
||||
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(parentService))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies for entering POI " + this.getName() + ".", 2);
|
||||
ruleCandidates.get(i).activate(parentService, false);
|
||||
@ -272,10 +273,14 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
}
|
||||
}
|
||||
|
||||
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Done checking POI rules.", 2);
|
||||
|
||||
|
||||
parentService.updateNotification();
|
||||
ActivityMainScreen.updateMainScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public void deactivate(AutomationService parentService)
|
||||
{
|
||||
if(this.isActivated())
|
||||
@ -286,7 +291,8 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
|
||||
Miscellaneous.logEvent("i", "POI", "Left POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, false);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
|
||||
if(ruleCandidates.size()==0)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
||||
@ -296,7 +302,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " found in " + ruleCandidates.size() + " rule(s).", 2);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(parentService))
|
||||
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(parentService))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies for leaving POI " + this.getName() + ".", 2);
|
||||
ruleCandidates.get(i).activate(parentService, false);
|
||||
@ -490,11 +496,19 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
{
|
||||
AutomationService service = AutomationService.getInstance();
|
||||
if (service != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
service.applySettingsAndRules();
|
||||
//Easiest way to check for changes in location, reset the last known location.
|
||||
service.getLocationProvider().setCurrentLocation(service.getLocationProvider().getCurrentLocation(), true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// Just log the event. This should not cause an interruption in the program flow.
|
||||
Miscellaneous.logEvent("e", "save POI", "Error when trying to apply settings and rules: " + Log.getStackTraceString(e), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -530,14 +544,18 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
PointOfInterest.writePoisToFile();
|
||||
|
||||
AutomationService service = AutomationService.getInstance();
|
||||
if(service != null)
|
||||
|
||||
try
|
||||
{
|
||||
service.applySettingsAndRules();
|
||||
|
||||
//Easiest way to check for changes in location, reset the last known location.
|
||||
service.getLocationProvider().setCurrentLocation(service.getLocationProvider().getCurrentLocation(), true);
|
||||
}
|
||||
|
||||
catch(Exception e)
|
||||
{
|
||||
// Just log the event. This should not cause an interruption in the program flow.
|
||||
Miscellaneous.logEvent("e", "save POI", "Error when trying to apply settings and rules: " + Log.getStackTraceString(e), 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -793,6 +811,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
||||
{
|
||||
String text = String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.overlapBetweenPois), otherPoi.getName(), String.valueOf(overlap));
|
||||
Miscellaneous.logEvent("w", "POI", text, 2);
|
||||
// Miscellaneous.messageBox("POI", text, Miscellaneous.getAnyContext()).show();
|
||||
Toast.makeText(Miscellaneous.getAnyContext(), text, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@ -13,10 +15,12 @@ import com.jens.automation2.Action.Action_Enum;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Profile implements Comparable<Profile>
|
||||
{
|
||||
protected static ArrayList<Profile> profileCollection = new ArrayList<Profile>();
|
||||
protected static List<Profile> profileCollection = new ArrayList<Profile>();
|
||||
protected static List<Profile> profileActivationHistory = new ArrayList<>();
|
||||
|
||||
protected String name;
|
||||
protected String oldName;
|
||||
@ -24,6 +28,9 @@ public class Profile implements Comparable<Profile>
|
||||
protected boolean changeSoundMode;
|
||||
protected int soundMode;
|
||||
|
||||
protected boolean changeDndMode;
|
||||
protected int dndMode;
|
||||
|
||||
boolean changeVolumeMusicVideoGameMedia;
|
||||
protected int volumeMusic;
|
||||
|
||||
@ -81,6 +88,26 @@ public class Profile implements Comparable<Profile>
|
||||
return soundMode;
|
||||
}
|
||||
|
||||
public boolean getChangeDndMode()
|
||||
{
|
||||
return changeDndMode;
|
||||
}
|
||||
|
||||
public void setChangeDndMode(boolean changeDndMode)
|
||||
{
|
||||
this.changeDndMode = changeDndMode;
|
||||
}
|
||||
|
||||
public int getDndMode()
|
||||
{
|
||||
return dndMode;
|
||||
}
|
||||
|
||||
public void setDndMode(int dndMode)
|
||||
{
|
||||
this.dndMode = dndMode;
|
||||
}
|
||||
|
||||
public void setChangeVolumeMusicVideoGameMedia(boolean changeVolumeMusicVideoGameMedia)
|
||||
{
|
||||
this.changeVolumeMusicVideoGameMedia = changeVolumeMusicVideoGameMedia;
|
||||
@ -243,7 +270,7 @@ public class Profile implements Comparable<Profile>
|
||||
return hapticFeedback;
|
||||
}
|
||||
|
||||
public static ArrayList<Profile> getProfileCollection()
|
||||
public static List<Profile> getProfileCollection()
|
||||
{
|
||||
return profileCollection;
|
||||
}
|
||||
@ -265,17 +292,11 @@ public class Profile implements Comparable<Profile>
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean delete(AutomationService myAutomationService)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean applyRingTone(File ringtoneFile, int ringtoneType, Context context)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Profile", "Request to set ringtone to " + ringtoneFile.getAbsolutePath(), 3);
|
||||
|
||||
if(!ringtoneFile.exists() | !ringtoneFile.canRead())
|
||||
if(!ringtoneFile.exists() || !ringtoneFile.canRead())
|
||||
{
|
||||
String message = "Ringtone file does not exist or cannot read it: " + ringtoneFile.getAbsolutePath();
|
||||
Miscellaneous.logEvent("i", "Profile", message, 3);
|
||||
@ -366,11 +387,23 @@ public class Profile implements Comparable<Profile>
|
||||
}
|
||||
|
||||
// Check if rules reference this profile
|
||||
ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByProfile(this);
|
||||
ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByActionProfile(this);
|
||||
if(rulesThatReferenceMe.size() > 0)
|
||||
{
|
||||
for(Rule oneRule : rulesThatReferenceMe)
|
||||
{
|
||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||
{
|
||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
|
||||
{
|
||||
String[] parts = oneTrigger.getTriggerParameter2().split(Trigger.triggerParameter2Split);
|
||||
parts[0] = this.name;
|
||||
|
||||
oneTrigger.setTriggerParameter2(Miscellaneous.explode(Trigger.triggerParameter2Split, parts));
|
||||
// We don't need to save the file. This will happen anyway in PointOfInterest.writePoisToFile() below.
|
||||
}
|
||||
}
|
||||
|
||||
for(Action oneAction : oneRule.getActionSet())
|
||||
{
|
||||
if(oneAction.getAction() == Action_Enum.changeSoundProfile)
|
||||
@ -399,18 +432,49 @@ public class Profile implements Comparable<Profile>
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean delete()
|
||||
public Rule isInUseByRules()
|
||||
{
|
||||
for(int i = 0; i< Profile.getProfileCollection().size(); i++)
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
|
||||
{
|
||||
if(Profile.getProfileCollection().get(i).getName().equals(this.getName()))
|
||||
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
|
||||
{
|
||||
Profile.getProfileCollection().remove(0);
|
||||
|
||||
// write to file
|
||||
return XmlFileInterface.writeFile();
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
else if(Rule.isAnyRuleUsing(Action_Enum.changeSoundProfile))
|
||||
{
|
||||
for (Rule rule : Rule.findRuleCandidatesByActionProfile(this))
|
||||
{
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean delete(Context context)
|
||||
{
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
|
||||
{
|
||||
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
|
||||
{
|
||||
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(Rule.isAnyRuleUsing(Action_Enum.changeSoundProfile))
|
||||
{
|
||||
for (Rule rule : Rule.findRuleCandidatesByActionProfile(this))
|
||||
{
|
||||
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileCollection.remove(this);
|
||||
return XmlFileInterface.writeFile();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -439,6 +503,8 @@ public class Profile implements Comparable<Profile>
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Profile " + this.getName(), String.format(context.getResources().getString(R.string.profileActivate), this.getName()), 3);
|
||||
|
||||
profileActivationHistory.add(this);
|
||||
|
||||
AutomationService.getInstance().checkLockSoundChangesTimeElapsed();
|
||||
|
||||
if(AutomationService.getInstance().getLockSoundChangesEnd() == null)
|
||||
@ -450,6 +516,9 @@ public class Profile implements Comparable<Profile>
|
||||
if(changeSoundMode)
|
||||
Actions.setSound(context, soundMode);
|
||||
|
||||
if(changeDndMode)
|
||||
Actions.setDND(context, dndMode);
|
||||
|
||||
if(changeVolumeMusicVideoGameMedia)
|
||||
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
|
||||
|
||||
@ -464,10 +533,19 @@ public class Profile implements Comparable<Profile>
|
||||
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
||||
|
||||
if(changeVibrateWhenRinging)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vibrateWhenRinging)
|
||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
||||
else
|
||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
if(changeNotificationRingtone)
|
||||
if(notificationRingtone != null)
|
||||
@ -498,6 +576,20 @@ public class Profile implements Comparable<Profile>
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Profile " + this.getName(), context.getResources().getString(R.string.errorActivatingProfile) + " " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "Checking for applicable rule after profile " + this.getName() + " has been activated.", 2);
|
||||
List<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.profileActive);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies after " + this.getName() + " has been activated.", 2);
|
||||
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
}
|
||||
Miscellaneous.logEvent("i", "POI", "Done checking for applicable rule after profile " + this.getName() + " has been activated.", 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -505,6 +597,104 @@ public class Profile implements Comparable<Profile>
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areMySettingsCurrentlyActive(Context context)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Profile " + this.getName(), "Checking if profile's settings are currently active.", 3);
|
||||
|
||||
try
|
||||
{
|
||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if(changeSoundMode)
|
||||
{
|
||||
if(am.getRingerMode() != soundMode)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeDndMode && Build.VERSION.SDK_INT >= 23)
|
||||
{
|
||||
if(mNotificationManager.getCurrentInterruptionFilter() != dndMode)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeVolumeMusicVideoGameMedia)
|
||||
{
|
||||
if(am.getStreamVolume(AudioManager.STREAM_MUSIC) != volumeMusic)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeVolumeNotifications)
|
||||
{
|
||||
if(am.getStreamVolume(AudioManager.STREAM_NOTIFICATION) != volumeNotifications)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeVolumeAlarms)
|
||||
{
|
||||
if(am.getStreamVolume(AudioManager.STREAM_ALARM) != volumeAlarms)
|
||||
return false;
|
||||
}
|
||||
|
||||
// if(changeIncomingCallsRingtone)
|
||||
// {
|
||||
// if (incomingCallsRingtone != null)
|
||||
// {
|
||||
// applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
||||
// }
|
||||
// }
|
||||
|
||||
if(changeVibrateWhenRinging)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), "vibrate_when_ringing");
|
||||
if(currentSetting != Miscellaneous.boolToInt(vibrateWhenRinging))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int currentSetting = am.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
|
||||
if(currentSetting != Miscellaneous.boolToInt(vibrateWhenRinging))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if(changeNotificationRingtone)
|
||||
// if(notificationRingtone != null)
|
||||
// applyRingTone(notificationRingtone, RingtoneManager.TYPE_NOTIFICATION, context);
|
||||
|
||||
if(changeScreenLockUnlockSound)
|
||||
{
|
||||
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), "lockscreen_sounds_enabled");
|
||||
if(currentSetting != Miscellaneous.boolToInt(screenLockUnlockSound))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeAudibleSelection)
|
||||
{
|
||||
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.SOUND_EFFECTS_ENABLED);
|
||||
if(currentSetting != Miscellaneous.boolToInt(audibleSelection))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(changeHapticFeedback)
|
||||
{
|
||||
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED);
|
||||
if(currentSetting != Miscellaneous.boolToInt(hapticFeedback))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "Profile " + this.getName(), "Error while checking if profile settings are currently active. " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
|
||||
Miscellaneous.logEvent("i", "Profile " + this.getName(), "This profile's settings are currently active.", 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
@ -5,11 +5,12 @@ import android.util.Log;
|
||||
|
||||
import com.jens.automation2.location.CellLocationChangedReceiver;
|
||||
import com.jens.automation2.location.WifiBroadcastReceiver;
|
||||
import com.jens.automation2.receivers.AlarmListener;
|
||||
import com.jens.automation2.receivers.DateTimeListener;
|
||||
import com.jens.automation2.receivers.AutomationListenerInterface;
|
||||
import com.jens.automation2.receivers.BatteryReceiver;
|
||||
import com.jens.automation2.receivers.BluetoothReceiver;
|
||||
import com.jens.automation2.receivers.ConnectivityReceiver;
|
||||
import com.jens.automation2.receivers.DeviceOrientationListener;
|
||||
import com.jens.automation2.receivers.HeadphoneJackListener;
|
||||
import com.jens.automation2.receivers.NoiseListener;
|
||||
import com.jens.automation2.receivers.PhoneStatusListener;
|
||||
@ -42,10 +43,11 @@ public class ReceiverCoordinator
|
||||
Class adClass = Class.forName("ActivityDetectionReceiver");
|
||||
allImplementers = new Class[] {
|
||||
adClass,
|
||||
AlarmListener.class,
|
||||
DateTimeListener.class,
|
||||
BatteryReceiver.class,
|
||||
BluetoothReceiver.class,
|
||||
ConnectivityReceiver.class,
|
||||
DeviceOrientationListener.class,
|
||||
HeadphoneJackListener.class,
|
||||
//NfcReceiver.class,
|
||||
NoiseListener.class,
|
||||
@ -56,13 +58,12 @@ public class ReceiverCoordinator
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
|
||||
allImplementers = new Class[] {
|
||||
AlarmListener.class,
|
||||
DateTimeListener.class,
|
||||
BatteryReceiver.class,
|
||||
BluetoothReceiver.class,
|
||||
ConnectivityReceiver.class,
|
||||
DeviceOrientationListener.class,
|
||||
HeadphoneJackListener.class,
|
||||
//NfcReceiver.class,
|
||||
NoiseListener.class,
|
||||
@ -144,18 +145,18 @@ public class ReceiverCoordinator
|
||||
ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance());
|
||||
|
||||
// startCellLocationChangedReceiver
|
||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
|
||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
|
||||
{
|
||||
if(!Miscellaneous.googleToBlameForLocation(true))
|
||||
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
||||
}
|
||||
|
||||
// startBatteryReceiver
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
|
||||
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
|
||||
|
||||
// startAlarmListener
|
||||
AlarmListener.startAlarmListener(AutomationService.getInstance());
|
||||
DateTimeListener.startAlarmListener(AutomationService.getInstance());
|
||||
TimeZoneListener.startTimeZoneListener(AutomationService.getInstance());
|
||||
|
||||
// startNoiseListener
|
||||
@ -166,15 +167,15 @@ public class ReceiverCoordinator
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.process_started_stopped))
|
||||
ProcessListener.startProcessListener(AutomationService.getInstance());
|
||||
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
|
||||
DeviceOrientationListener.getInstance().startListener(AutomationService.getInstance());
|
||||
|
||||
try
|
||||
{
|
||||
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
|
||||
//startActivityDetectionReceiver
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
|
||||
{
|
||||
Miscellaneous.runMethodReflective(activityDetectionClassPath, "startActivityDetectionReceiver", null);
|
||||
// ActivityDetectionReceiver.startActivityDetectionReceiver();
|
||||
}
|
||||
}
|
||||
catch(ClassNotFoundException e)
|
||||
{
|
||||
@ -199,15 +200,15 @@ public class ReceiverCoordinator
|
||||
WifiBroadcastReceiver.stopWifiReceiver();
|
||||
BatteryReceiver.stopBatteryReceiver();
|
||||
TimeZoneListener.stopTimeZoneListener();
|
||||
AlarmListener.stopAlarmListener(AutomationService.getInstance());
|
||||
DateTimeListener.stopAlarmListener(AutomationService.getInstance());
|
||||
NoiseListener.stopNoiseListener();
|
||||
ProcessListener.stopProcessListener(AutomationService.getInstance());
|
||||
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
|
||||
|
||||
try
|
||||
{
|
||||
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
|
||||
// ActivityDetectionReceiver.stopActivityDetectionReceiver();
|
||||
}
|
||||
catch(ClassNotFoundException e)
|
||||
{
|
||||
@ -216,6 +217,7 @@ public class ReceiverCoordinator
|
||||
|
||||
BluetoothReceiver.stopBluetoothReceiver();
|
||||
HeadphoneJackListener.getInstance().stopListener(AutomationService.getInstance());
|
||||
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
@ -271,9 +273,12 @@ public class ReceiverCoordinator
|
||||
ProcessListener.stopProcessListener(AutomationService.getInstance());
|
||||
}
|
||||
|
||||
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
|
||||
{
|
||||
if (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
|
||||
{
|
||||
Object runResult = Miscellaneous.runMethodReflective(activityDetectionClassPath, "isActivityDetectionReceiverRunning", null);;
|
||||
Object runResult = Miscellaneous.runMethodReflective(activityDetectionClassPath, "isActivityDetectionReceiverRunning", null);
|
||||
|
||||
if (runResult instanceof Boolean)
|
||||
{
|
||||
boolean isRunning = (Boolean) runResult;
|
||||
@ -309,6 +314,7 @@ public class ReceiverCoordinator
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
||||
{
|
||||
@ -346,6 +352,24 @@ public class ReceiverCoordinator
|
||||
}
|
||||
}
|
||||
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
|
||||
{
|
||||
if(!DeviceOrientationListener.getInstance().isListenerRunning())
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DevicePositionListener", "Starting DevicePositionListener because used in a new/changed rule.", 4);
|
||||
// if(DevicePositionListener.getInstance().haveAllPermission())
|
||||
DeviceOrientationListener.getInstance().startListener(AutomationService.getInstance());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DeviceOrientationListener.getInstance().isListenerRunning())
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DevicePositionListener", "Shutting down DevicePositionListener because not used in any rule.", 4);
|
||||
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
AutomationService.updateNotification();
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public class Settings implements SharedPreferences
|
||||
public final static int lockSoundChangesInterval = 15;
|
||||
public static final int newsPollEveryXDays = 3;
|
||||
public static final int newsDisplayForXDays = 3;
|
||||
public static final int updateCheckFrequencyDays = 7;
|
||||
public static final String folderName = "Automation";
|
||||
public static final String zipFileName = "automation.zip";
|
||||
|
||||
@ -55,16 +56,21 @@ public class Settings implements SharedPreferences
|
||||
public static boolean rememberLastActivePoi;
|
||||
public static int locationRingBufferSize;
|
||||
public static long timeBetweenProcessMonitorings;
|
||||
public static long acceptDeviceOrientationSignalEveryX_MilliSeconds;
|
||||
public static int activityDetectionFrequency;
|
||||
public static int activityDetectionRequiredProbability;
|
||||
public static boolean privacyLocationing;
|
||||
public static int startScreen;
|
||||
public static int tabsPlacement;
|
||||
public static boolean executeRulesAndProfilesWithSingleClick;
|
||||
public static boolean displayNewsOnMainScreen;
|
||||
public static boolean automaticUpdateCheck;
|
||||
|
||||
public static boolean lockSoundChanges;
|
||||
public static boolean noticeAndroid9MicrophoneShown;
|
||||
public static boolean noticeAndroid10WifiShown;
|
||||
public static long lastNewsPolltime;
|
||||
public static long lastUpdateCheck;
|
||||
|
||||
public static ArrayList<String> whatHasBeenDone;
|
||||
|
||||
@ -108,14 +114,18 @@ public class Settings implements SharedPreferences
|
||||
protected static final boolean default_rememberLastActivePoi = true;
|
||||
protected static final int default_locationRingBufferSize=3;
|
||||
protected static final long default_timeBetweenProcessMonitorings = 60;
|
||||
protected static final long default_acceptDevicePositionSignalEveryX_MilliSeconds = 1000;
|
||||
protected static final int default_activityDetectionFrequency = 60;
|
||||
protected static final int default_activityDetectionRequiredProbability = 75;
|
||||
protected static final boolean default_privacyLocationing = false;
|
||||
protected static final int default_startScreen = 0;
|
||||
protected static final int default_tabsPlacement = 0;
|
||||
protected static final boolean default_executeRulesAndProfilesWithSingleClick = false;
|
||||
protected static final boolean default_displayNewsOnMainScreen = false;
|
||||
protected static final boolean default_automaticUpdateCheck = false;
|
||||
protected static final boolean default_lockSoundChanges = false;
|
||||
protected static final long default_lastNewsPolltime = -1;
|
||||
protected static final long default_lastUpdateCheck = -1;
|
||||
|
||||
@Override
|
||||
public boolean contains(String arg0)
|
||||
@ -228,6 +238,7 @@ public class Settings implements SharedPreferences
|
||||
lengthOfNoiseLevelMeasurements = Long.parseLong(prefs.getString("lengthOfNoiseLevelMeasurements", String.valueOf(default_lengthOfNoiseLevelMeasurements)));
|
||||
referenceValueForNoiseLevelMeasurements = Long.parseLong(prefs.getString("referenceValueForNoiseLevelMeasurements", String.valueOf(default_referenceValueForNoiseLevelMeasurements)));
|
||||
timeBetweenProcessMonitorings = Long.parseLong(prefs.getString("timeBetweenProcessMonitorings", String.valueOf(default_timeBetweenProcessMonitorings)));
|
||||
acceptDeviceOrientationSignalEveryX_MilliSeconds = Long.parseLong(prefs.getString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(default_acceptDevicePositionSignalEveryX_MilliSeconds)));
|
||||
|
||||
httpAcceptAllCertificates = prefs.getBoolean("httpAcceptAllCertificates", default_httpAcceptAllCertificates);
|
||||
httpAttempts = Integer.parseInt(prefs.getString("httpAttempts", String.valueOf(default_httpAttempts)));
|
||||
@ -247,8 +258,10 @@ public class Settings implements SharedPreferences
|
||||
|
||||
privacyLocationing = prefs.getBoolean("privacyLocationing", default_privacyLocationing);
|
||||
startScreen = Integer.parseInt(prefs.getString("startScreen", String.valueOf(default_startScreen)));
|
||||
tabsPlacement = Integer.parseInt(prefs.getString("tabsPlacement", String.valueOf(default_tabsPlacement)));
|
||||
|
||||
executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
|
||||
automaticUpdateCheck = prefs.getBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
|
||||
displayNewsOnMainScreen = prefs.getBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
|
||||
|
||||
lockSoundChanges = prefs.getBoolean("lockSoundChanges", default_lockSoundChanges);
|
||||
@ -256,6 +269,7 @@ public class Settings implements SharedPreferences
|
||||
noticeAndroid10WifiShown = prefs.getBoolean("noticeAndroid10WifiShown", false);
|
||||
|
||||
lastNewsPolltime = prefs.getLong("lastNewsPolltime", default_lastNewsPolltime);
|
||||
lastUpdateCheck = prefs.getLong("lastUpdateCheck", default_lastUpdateCheck);
|
||||
|
||||
String whbdString = prefs.getString("whatHasBeenDone", "");
|
||||
if(whbdString != null && whbdString.length() > 0)
|
||||
@ -420,6 +434,9 @@ public class Settings implements SharedPreferences
|
||||
if(!prefs.contains("timeBetweenProcessMonitorings") | force)
|
||||
editor.putString("timeBetweenProcessMonitorings", String.valueOf(default_timeBetweenProcessMonitorings));
|
||||
|
||||
if(!prefs.contains("acceptDevicePositionSignalEveryX_MilliSeconds") | force)
|
||||
editor.putString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(default_acceptDevicePositionSignalEveryX_MilliSeconds));
|
||||
|
||||
if(!prefs.contains("activityDetectionFrequency") | force)
|
||||
editor.putString("activityDetectionFrequency", String.valueOf(default_activityDetectionFrequency));
|
||||
|
||||
@ -432,9 +449,15 @@ public class Settings implements SharedPreferences
|
||||
if(!prefs.contains("startScreen") | force)
|
||||
editor.putString("startScreen", String.valueOf(default_startScreen));
|
||||
|
||||
if(!prefs.contains("tabsPlacement") | force)
|
||||
editor.putString("tabsPlacement", String.valueOf(default_tabsPlacement));
|
||||
|
||||
if(!prefs.contains("executeRulesAndProfilesWithSingleClick") | force)
|
||||
editor.putBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
|
||||
|
||||
if(!prefs.contains("automaticUpdateCheck") | force)
|
||||
editor.putBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
|
||||
|
||||
if(!prefs.contains("displayNewsOnMainScreen") | force)
|
||||
editor.putBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
|
||||
|
||||
@ -447,6 +470,9 @@ public class Settings implements SharedPreferences
|
||||
if(!prefs.contains("lastNewsPolltime") | force)
|
||||
editor.putLong("lastNewsPolltime", default_lastNewsPolltime);
|
||||
|
||||
if(!prefs.contains("lastUpdateCheck") | force)
|
||||
editor.putLong("lastUpdateCheck", default_lastUpdateCheck);
|
||||
|
||||
if(!prefs.contains("whatHasBeenDone") | force)
|
||||
editor.putString("whatHasBeenDone", "");
|
||||
|
||||
@ -506,11 +532,14 @@ public class Settings implements SharedPreferences
|
||||
editor.putString("httpAttemptGap", String.valueOf(httpAttemptGap));
|
||||
editor.putString("locationRingBufferSize", String.valueOf(locationRingBufferSize));
|
||||
editor.putString("timeBetweenProcessMonitorings", String.valueOf(timeBetweenProcessMonitorings));
|
||||
editor.putString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(acceptDeviceOrientationSignalEveryX_MilliSeconds));
|
||||
editor.putString("activityDetectionFrequency", String.valueOf(activityDetectionFrequency));
|
||||
editor.putString("activityDetectionRequiredProbability", String.valueOf(activityDetectionRequiredProbability));
|
||||
editor.putBoolean("privacyLocationing", privacyLocationing);
|
||||
editor.putString("startScreen", String.valueOf(startScreen));
|
||||
editor.putString("tabsPlacement", String.valueOf(tabsPlacement));
|
||||
editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick);
|
||||
editor.putBoolean("automaticUpdateCheck", automaticUpdateCheck);
|
||||
editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen);
|
||||
|
||||
editor.putBoolean("lockSoundChanges", lockSoundChanges);
|
||||
@ -518,6 +547,7 @@ public class Settings implements SharedPreferences
|
||||
editor.putBoolean("noticeAndroid10WifiShown", noticeAndroid10WifiShown);
|
||||
|
||||
editor.putLong("lastNewsPolltime", lastNewsPolltime);
|
||||
editor.putLong("lastUpdateCheck", lastUpdateCheck);
|
||||
|
||||
editor.putString("whatHasBeenDone", Miscellaneous.explode(";", whatHasBeenDone));
|
||||
|
||||
|
@ -6,8 +6,11 @@ import java.util.ArrayList;
|
||||
public class TimeFrame
|
||||
{
|
||||
// Defines a timeframe
|
||||
private Time triggerTimeStart;
|
||||
private Time triggerTimeStop;
|
||||
protected Time triggerTimeStart;
|
||||
protected Time triggerTimeStop;
|
||||
protected long repetition;
|
||||
|
||||
protected final static String separator = "/";
|
||||
|
||||
private ArrayList<Integer> dayList = new ArrayList<Integer>();
|
||||
public ArrayList<Integer> getDayList()
|
||||
@ -31,7 +34,6 @@ public class TimeFrame
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Time getTriggerTimeStart()
|
||||
{
|
||||
return triggerTimeStart;
|
||||
@ -40,6 +42,7 @@ public class TimeFrame
|
||||
{
|
||||
this.triggerTimeStart = triggerTimeStart;
|
||||
}
|
||||
|
||||
public Time getTriggerTimeStop()
|
||||
{
|
||||
return triggerTimeStop;
|
||||
@ -49,27 +52,44 @@ public class TimeFrame
|
||||
this.triggerTimeStop = triggerTimeStop;
|
||||
}
|
||||
|
||||
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2)
|
||||
public long getRepetition()
|
||||
{
|
||||
return repetition;
|
||||
}
|
||||
|
||||
public void setRepetition(long repetition)
|
||||
{
|
||||
this.repetition = repetition;
|
||||
}
|
||||
|
||||
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2, long repetition)
|
||||
{
|
||||
this.setTriggerTimeStart(timeStart);
|
||||
this.setTriggerTimeStop(timeEnd);
|
||||
this.setDayList(dayList2);
|
||||
this.setRepetition(repetition);
|
||||
}
|
||||
TimeFrame (String fileContent)
|
||||
|
||||
public TimeFrame (String fileContent)
|
||||
{
|
||||
String[] dateArray = fileContent.split("/"); // example: timestart/timestop/days[int]
|
||||
String[] dateArray = fileContent.split(separator); // example: timestart/timestop/days[int]/repetition
|
||||
this.setTriggerTimeStart(Time.valueOf(dateArray[0]));
|
||||
this.setTriggerTimeStop(Time.valueOf(dateArray[1]));
|
||||
this.setDayListFromString(dateArray[2]);
|
||||
if(dateArray.length > 3) // may not exist in old config files
|
||||
this.setRepetition(Long.parseLong(dateArray[3]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String returnString = this.getTriggerTimeStart().toString() + "/" + this.getTriggerTimeStop().toString() + "/";
|
||||
String returnString = this.getTriggerTimeStart().toString() + separator + this.getTriggerTimeStop().toString() + separator;
|
||||
|
||||
for(Integer oneDay : this.getDayList())
|
||||
returnString += String.valueOf(oneDay);
|
||||
|
||||
returnString += separator + String.valueOf(repetition);
|
||||
|
||||
return returnString;
|
||||
}
|
||||
}
|
@ -170,9 +170,9 @@ public class XmlFileInterface
|
||||
serializer.startTag(null, "changeVibrateWhenRinging");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVibrateWhenRinging()));
|
||||
serializer.endTag(null, "changeVibrateWhenRinging");//
|
||||
serializer.startTag(null, "changeVibrateWhenRinging");
|
||||
serializer.startTag(null, "vibrateWhenRinging");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVibrateWhenRinging()));
|
||||
serializer.endTag(null, "changeVibrateWhenRinging");
|
||||
serializer.endTag(null, "vibrateWhenRinging");
|
||||
|
||||
serializer.startTag(null, "changeNotificationRingtone");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeNotificationRingtone()));
|
||||
@ -206,12 +206,18 @@ public class XmlFileInterface
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getHapticFeedback()));
|
||||
serializer.endTag(null, "hapticFeedback");
|
||||
|
||||
serializer.startTag(null, "changeDndMode");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeDndMode()));
|
||||
serializer.endTag(null, "changeDndMode");//
|
||||
serializer.startTag(null, "dndMode");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getDndMode()));
|
||||
serializer.endTag(null, "dndMode");
|
||||
|
||||
serializer.endTag(null, "Profile");
|
||||
}
|
||||
serializer.endTag(null, "ProfileCollection");
|
||||
|
||||
|
||||
|
||||
serializer.startTag(null, "RuleCollection");
|
||||
for(int i=0; i<Rule.getRuleCollection().size(); i++)
|
||||
{
|
||||
@ -607,6 +613,10 @@ public class XmlFileInterface
|
||||
newProfile.setChangeSoundMode(Boolean.parseBoolean(readTag(parser, "changeSoundMode")));
|
||||
else if (name.equals("soundMode"))
|
||||
newProfile.setSoundMode(Integer.parseInt(readTag(parser, "soundMode")));
|
||||
else if (name.equals("changeDndMode"))
|
||||
newProfile.setChangeDndMode(Boolean.parseBoolean(readTag(parser, "changeDndMode")));
|
||||
else if (name.equals("dndMode"))
|
||||
newProfile.setDndMode(Integer.parseInt(readTag(parser, "dndMode")));
|
||||
else if (name.equals("changeVolumeMusicVideoGameMedia"))
|
||||
newProfile.setChangeVolumeMusicVideoGameMedia(Boolean.parseBoolean(readTag(parser, "changeVolumeMusicVideoGameMedia")));
|
||||
else if (name.equals("volumeMusic"))
|
||||
@ -641,6 +651,8 @@ public class XmlFileInterface
|
||||
else
|
||||
newProfile.setNotificationRingtone(null);
|
||||
}
|
||||
else if (name.equals("vibrateWhenRinging"))
|
||||
newProfile.setVibrateWhenRinging(Boolean.parseBoolean(readTag(parser, "vibrateWhenRinging")));
|
||||
else if (name.equals("changeAudibleSelection"))
|
||||
newProfile.setChangeAudibleSelection(Boolean.parseBoolean(readTag(parser, "changeAudibleSelection")));
|
||||
else if (name.equals("audibleSelection"))
|
||||
@ -752,6 +764,8 @@ public class XmlFileInterface
|
||||
try
|
||||
{
|
||||
newRule.setTriggerSet(readTriggerCollection(parser));
|
||||
for(Trigger t : newRule.getTriggerSet())
|
||||
t.setParentRule(newRule);
|
||||
}
|
||||
catch (XmlPullParserException e)
|
||||
{
|
||||
@ -767,6 +781,8 @@ public class XmlFileInterface
|
||||
try
|
||||
{
|
||||
newRule.setActionSet(readActionCollection(parser));
|
||||
for(Action a : newRule.getActionSet())
|
||||
a.setParentRule(newRule);
|
||||
}
|
||||
catch (XmlPullParserException e)
|
||||
{
|
||||
@ -802,9 +818,17 @@ public class XmlFileInterface
|
||||
String name = parser.getName();
|
||||
// Starts by looking for the entry tag
|
||||
if (name.equals("Trigger"))
|
||||
{
|
||||
try
|
||||
{
|
||||
triggerCollection.add(readTrigger(parser));
|
||||
}
|
||||
catch (IllegalArgumentException | NullPointerException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown trigger found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
|
||||
Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skip(parser);
|
||||
@ -814,7 +838,6 @@ public class XmlFileInterface
|
||||
return (triggerCollection);
|
||||
}
|
||||
|
||||
|
||||
private static Trigger readTrigger(XmlPullParser parser) throws IOException, XmlPullParserException
|
||||
{
|
||||
|
||||
@ -866,7 +889,7 @@ public class XmlFileInterface
|
||||
{
|
||||
String triggerEventString = readTag(parser, "TriggerEvent");
|
||||
|
||||
if(triggerEventString.equals("process_started_stopped") | triggerEventString.equals("process_running"))
|
||||
if(triggerEventString.equals("process_started_stopped") || triggerEventString.equals("process_running"))
|
||||
newTrigger.setTriggerType(Trigger_Enum.process_started_stopped);
|
||||
else
|
||||
newTrigger.setTriggerType(Trigger_Enum.valueOf(triggerEventString));
|
||||
@ -916,7 +939,6 @@ public class XmlFileInterface
|
||||
}
|
||||
else if(newTrigger.getTriggerType() == Trigger_Enum.wifiConnection)
|
||||
{
|
||||
// newTrigger.setWifiName(triggerParameter2);
|
||||
newTrigger.setTriggerParameter2(triggerParameter2);
|
||||
}
|
||||
else if(newTrigger.getTriggerType() == Trigger_Enum.process_started_stopped)
|
||||
@ -1038,9 +1060,17 @@ public class XmlFileInterface
|
||||
String name = parser.getName();
|
||||
// Starts by looking for the entry tag
|
||||
if (name.equals("Action"))
|
||||
{
|
||||
try
|
||||
{
|
||||
actionCollection.add(readAction(parser));
|
||||
}
|
||||
catch (IllegalArgumentException | NullPointerException e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown action found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
|
||||
Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skip(parser);
|
||||
@ -1049,7 +1079,6 @@ public class XmlFileInterface
|
||||
return (actionCollection);
|
||||
}
|
||||
|
||||
|
||||
private static Action readAction(XmlPullParser parser) throws IOException, XmlPullParserException
|
||||
{
|
||||
/* FILE EXAMPE:
|
||||
@ -1123,6 +1152,13 @@ public class XmlFileInterface
|
||||
newAction.setAction(Action_Enum.enableScreenRotation);
|
||||
else if(actionNameString.equals("disableScreenRotation"))
|
||||
newAction.setAction(Action_Enum.disableScreenRotation);
|
||||
else if(actionNameString.equals("disableScreenRotation"))
|
||||
newAction.setAction(Action_Enum.disableScreenRotation);
|
||||
else if(actionNameString.equals("wakeupDevice"))
|
||||
{
|
||||
newAction.setAction(Action_Enum.turnScreenOnOrOff);
|
||||
newAction.setParameter1(true);
|
||||
}
|
||||
// *** deprecated
|
||||
|
||||
else
|
||||
@ -1190,6 +1226,18 @@ public class XmlFileInterface
|
||||
newAction.setAction(Action_Enum.setDisplayRotation);
|
||||
newAction.setParameter1(false);
|
||||
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
|
||||
}
|
||||
else if(newAction.getAction().equals(Action_Enum.disableScreenRotation))
|
||||
{
|
||||
newAction.setAction(Action_Enum.setDisplayRotation);
|
||||
newAction.setParameter1(false);
|
||||
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
|
||||
}
|
||||
else if(newAction.getAction().equals(Action_Enum.turnScreenOnOrOff) && newAction.getParameter1())
|
||||
{
|
||||
/*
|
||||
If param1 == true we will keep it because this action used to be of type wakeUpDevice.
|
||||
*/
|
||||
}
|
||||
else
|
||||
// exclusion for deprecated types
|
||||
@ -1212,6 +1260,13 @@ public class XmlFileInterface
|
||||
{
|
||||
newAction.setParameter2(tag);
|
||||
}
|
||||
/*
|
||||
androidx.security.crypto.MasterKey.Builder
|
||||
|
||||
MasterKey mainKey = new MasterKey.Builder(context)
|
||||
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
||||
.build();
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if(newAction.getAction().equals(Action_Enum.startOtherActivity)) // separator has been changed, convert in old files
|
||||
@ -1263,9 +1318,6 @@ public class XmlFileInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Miscellaneous.logEvent("i", "New Rule from file", newPoi.name + "/" + String.valueOf(newPoi.radius) + "/" + String.valueOf(newPoi.location.getLatitude()) + "/" + String.valueOf(newPoi.location.getLongitude()) + "/" + String.valueOf(newPoi.changeWifiState) + "/" + String.valueOf(newPoi.desiredWifiState) + "/" + String.valueOf(newPoi.changeCameraState) + "/" + String.valueOf(newPoi.desiredCameraState) + "/" + String.valueOf(newPoi.changeSoundSetting) + "/" + String.valueOf(newPoi.desiredSoundSetting));
|
||||
|
||||
return newAction;
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,21 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCellLocationChangedReceiverPossible()
|
||||
{
|
||||
if(telephonyManager == null)
|
||||
telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
if(
|
||||
ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance())
|
||||
||
|
||||
telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY
|
||||
)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public Location getLocation(String accuracy)
|
||||
{
|
||||
Criteria crit = new Criteria();
|
||||
@ -137,7 +152,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
String myProviderName;
|
||||
|
||||
// If privacy mode or no data connection available
|
||||
if(Settings.privacyLocationing | !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
||||
if(Settings.privacyLocationing || !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "CellLocation", Miscellaneous.getAnyContext().getResources().getString(R.string.enforcingGps), 4);
|
||||
myProviderName = LocationManager.GPS_PROVIDER;
|
||||
@ -175,6 +190,9 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myLocationManager == null)
|
||||
myLocationManager = (LocationManager) AutomationService.getInstance().getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
if(!myLocationManager.isProviderEnabled(myProviderName))
|
||||
{
|
||||
if(myProviderName.equals(LocationManager.NETWORK_PROVIDER))
|
||||
@ -226,13 +244,11 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
return currentLocation;
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentLocation(Location currentLocation)
|
||||
{
|
||||
this.currentLocation = currentLocation;
|
||||
}
|
||||
|
||||
|
||||
public class MyLocationListener implements LocationListener
|
||||
{
|
||||
@Override
|
||||
@ -327,7 +343,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
{
|
||||
if(!cellLocationListenerActive)
|
||||
{
|
||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()))
|
||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY)
|
||||
{
|
||||
if(WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
|
||||
{
|
||||
@ -356,7 +372,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
Miscellaneous.logEvent("w", "cellReceiver", "Wanted to activate CellLocationChangedReceiver, but Wifi-Receiver says not to.", 4);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active.", 4);
|
||||
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active or SIM_STATE is not ready.", 4);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
@ -410,4 +426,3 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
||||
ActivityPermissions.havePermission("android.permission.ACCESS_WIFI_STATE", Miscellaneous.getAnyContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.jens.automation2.ActivityMainScreen;
|
||||
@ -26,13 +27,9 @@ import java.util.Calendar;
|
||||
|
||||
public class LocationProvider
|
||||
{
|
||||
|
||||
protected static boolean passiveLocationListenerActive = false;
|
||||
|
||||
protected static LocationListener passiveLocationListener;
|
||||
|
||||
protected static LocationProvider locationProviderInstance = null;
|
||||
|
||||
protected AutomationService parentService;
|
||||
public AutomationService getParentService()
|
||||
{
|
||||
@ -108,6 +105,8 @@ public class LocationProvider
|
||||
}
|
||||
|
||||
public void setCurrentLocation(Location newLocation, boolean skipVerification)
|
||||
{
|
||||
if(newLocation != null)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Location", "Setting location.", 4);
|
||||
|
||||
@ -144,8 +143,33 @@ public class LocationProvider
|
||||
}
|
||||
else
|
||||
{
|
||||
speedCalculation:
|
||||
if (locationList.size() >= 2)
|
||||
{
|
||||
while (locationList.size() > 2)
|
||||
{
|
||||
// Remove all entries except for the last 2
|
||||
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
|
||||
locationList.remove(0);
|
||||
}
|
||||
|
||||
/*
|
||||
The two most recent locations in the list must have a usable accuracy.
|
||||
*/
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if
|
||||
(
|
||||
(locationList.get(i).getProvider().equals(LocationManager.GPS_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyGps)
|
||||
||
|
||||
(locationList.get(i).getProvider().equals(LocationManager.NETWORK_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyNetwork)
|
||||
)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Speed", "Not using 2 most recent locations for speed calculation because at least one does not have a satisfactory accuracy: " + locationList.get(i).toString(), 4);
|
||||
break speedCalculation;
|
||||
}
|
||||
}
|
||||
|
||||
Miscellaneous.logEvent("i", "Speed", "Trying to calculate speed based on the last locations.", 4);
|
||||
|
||||
double currentSpeed;
|
||||
@ -174,24 +198,16 @@ public class LocationProvider
|
||||
setSpeed(currentSpeed);
|
||||
|
||||
// execute matching rules containing speed
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesBySpeed();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.speed);
|
||||
for (Rule oneRule : ruleCandidates)
|
||||
{
|
||||
if (oneRule.applies(this.getParentService()))
|
||||
if(oneRule.getsGreenLight(this.getParentService()))
|
||||
oneRule.activate(getParentService(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "Speed", "Last two locations are too far apart in terms of time. Cannot use them for speed calculation.", 4);
|
||||
|
||||
|
||||
while (locationList.size() > 2)
|
||||
{
|
||||
// Remove all entries except for the last 2
|
||||
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
|
||||
locationList.remove(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -210,6 +226,9 @@ public class LocationProvider
|
||||
if (AutomationService.isMainActivityRunning(parentService))
|
||||
ActivityMainScreen.updateMainScreen();
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("w", "Location", "New location given is null. Ignoring.", 5);
|
||||
}
|
||||
|
||||
public void startLocationService()
|
||||
{
|
||||
@ -227,14 +246,38 @@ public class LocationProvider
|
||||
|
||||
if(Settings.positioningEngine == 0)
|
||||
{
|
||||
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
||||
{
|
||||
// TelephonyManager telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
// startCellLocationChangedReceiver
|
||||
if (!ConnectivityReceiver.isAirplaneMode(this.parentService) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed)))
|
||||
if (CellLocationChangedReceiver.isCellLocationChangedReceiverPossible())
|
||||
{
|
||||
if (WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
|
||||
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Reasons why we may end up here:
|
||||
- Airplane mode is active
|
||||
- No phone module present (pure wifi device)
|
||||
- No SIM card is inserted or it's not unlocked
|
||||
|
||||
We'd have to try GPS now to get an initial position.
|
||||
For permanent use there is no way we could know when it
|
||||
would make sense to check the position again.
|
||||
*/
|
||||
|
||||
// Trigger a one-time-position-search
|
||||
Location loc = CellLocationChangedReceiver.getInstance().getLocation("fine");
|
||||
LocationProvider.getInstance().setCurrentLocation(loc, true);
|
||||
}
|
||||
|
||||
// startPassiveLocationListener
|
||||
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
||||
startPassiveLocationListener();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest))
|
||||
@ -489,18 +532,10 @@ public class LocationProvider
|
||||
{
|
||||
// time is up, no cell location updates since x minutes, start accelerometer
|
||||
String text = "Timer triggered. Based on the last location and speed we may be at a POI. Forcing location update in case CellLocationChangedReceiver didn\'t fire.";
|
||||
// Miscellaneous.logEvent("i", "AccelerometerHandler", text, 5);
|
||||
// CellLocationChangedReceiver.stopCellLocationChangedReceiver();
|
||||
// startAccelerometerReceiver();
|
||||
|
||||
Location currentLocation = CellLocationChangedReceiver.getInstance().getLocation("coarse");
|
||||
AutomationService.getInstance().getLocationProvider().setCurrentLocation(currentLocation, false);
|
||||
}
|
||||
/*else if(msg.what == 0)
|
||||
{
|
||||
String text = "Abort command received, deactivating SpeedReceiver";
|
||||
Miscellaneous.logEvent("i", "SpeedHandler", text, 4);
|
||||
stopAccelerometerReceiver();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import com.jens.automation2.PointOfInterest;
|
||||
import com.jens.automation2.R;
|
||||
import com.jens.automation2.Rule;
|
||||
import com.jens.automation2.Settings;
|
||||
import com.jens.automation2.Trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -144,10 +145,10 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
|
||||
|
||||
public static void findRules(AutomationService automationServiceInstance)
|
||||
{
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByWifiConnection();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.wifiConnection);
|
||||
for(Rule oneRule : ruleCandidates)
|
||||
{
|
||||
if(oneRule.applies(automationServiceInstance))
|
||||
if(oneRule.getsGreenLight(automationServiceInstance))
|
||||
oneRule.activate(automationServiceInstance, false);
|
||||
}
|
||||
}
|
||||
|
@ -1,301 +0,0 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.jens.automation2.AutomationService;
|
||||
import com.jens.automation2.Miscellaneous;
|
||||
import com.jens.automation2.Rule;
|
||||
import com.jens.automation2.Trigger;
|
||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class AlarmListener extends BroadcastReceiver implements AutomationListenerInterface
|
||||
{
|
||||
private static AutomationService automationServiceRef;
|
||||
private static AlarmManager centralAlarmManagerInstance;
|
||||
// private static Intent alarmIntent;
|
||||
// private static PendingIntent alarmPendingIntent;
|
||||
private static boolean alarmListenerActive=false;
|
||||
private static ArrayList<Long> alarmCandidates = new ArrayList<Long>();
|
||||
|
||||
private static ArrayList<Integer> requestCodeList = new ArrayList<Integer>();
|
||||
|
||||
public static void startAlarmListener(final AutomationService automationServiceRef)
|
||||
{
|
||||
AlarmListener.startAlarmListenerInternal(automationServiceRef);
|
||||
}
|
||||
public static void stopAlarmListener(Context context)
|
||||
{
|
||||
AlarmListener.stopAlarmListenerInternal();
|
||||
}
|
||||
|
||||
public static boolean isAlarmListenerActive()
|
||||
{
|
||||
return alarmListenerActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
|
||||
Date now = new Date();
|
||||
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
|
||||
Time passTime = Time.valueOf(timeString);
|
||||
|
||||
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
|
||||
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
|
||||
{
|
||||
if(allRulesWithNowInTimeFrame.get(i).applies(context))
|
||||
allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
setAlarms();
|
||||
}
|
||||
|
||||
public static void setAlarms()
|
||||
{
|
||||
alarmCandidates.clear();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
|
||||
clearAlarms();
|
||||
|
||||
int i=0;
|
||||
|
||||
// // get a Calendar object with current time
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// // add 5 minutes to the calendar object
|
||||
// cal.add(Calendar.SECOND, 10);
|
||||
// String calSetWorkingCopyString2 = null;
|
||||
// SimpleDateFormat sdf2 = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
// if (cal != null)
|
||||
// {
|
||||
// calSetWorkingCopyString2 = sdf2.format(cal.getTime());
|
||||
// }
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
|
||||
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
|
||||
// requestCodeList.add(0);
|
||||
|
||||
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
|
||||
allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
|
||||
for(Rule oneRule : allRulesWithTimeFrames)
|
||||
{
|
||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||
{
|
||||
if(oneTrigger.getTriggerType() == Trigger_Enum.timeFrame)
|
||||
{
|
||||
Calendar calNow, calSet;
|
||||
Time setTime;
|
||||
|
||||
if(oneTrigger.getTriggerParameter())
|
||||
setTime = oneTrigger.getTimeFrame().getTriggerTimeStart();
|
||||
else
|
||||
setTime = oneTrigger.getTimeFrame().getTriggerTimeStop();
|
||||
|
||||
calNow = Calendar.getInstance();
|
||||
calSet = (Calendar) calNow.clone();
|
||||
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
|
||||
calSet.set(Calendar.MINUTE, setTime.getMinutes());
|
||||
calSet.set(Calendar.SECOND, 0);
|
||||
calSet.set(Calendar.MILLISECOND, 0);
|
||||
// At this point calSet would be a scheduling candidate. It's just the day the might not be right, yet.
|
||||
|
||||
long milliSecondsInAWeek = 1000 * 60 * 60 * 24 * 7;
|
||||
|
||||
for(int dayOfWeek : oneTrigger.getTimeFrame().getDayList())
|
||||
{
|
||||
Calendar calSetWorkingCopy = (Calendar) calSet.clone();
|
||||
|
||||
// calSetWorkingCopy.set(Calendar.HOUR_OF_DAY, setTime.getHours());
|
||||
// calSetWorkingCopy.set(Calendar.MINUTE, setTime.getMinutes());
|
||||
// calSetWorkingCopy.set(Calendar.SECOND, 0);
|
||||
// calSetWorkingCopy.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
int diff = dayOfWeek - calNow.get(Calendar.DAY_OF_WEEK);
|
||||
// Log.i("AlarmManager", "Today: " + String.valueOf(calNow.get(Calendar.DAY_OF_WEEK)) + " / Sched.Day: " + String.valueOf(dayOfWeek) + " Difference to target day is: " + String.valueOf(diff));
|
||||
if(diff == 0) //if we're talking about the current day, is the time still in the future?
|
||||
{
|
||||
if(calSetWorkingCopy.getTime().getHours() < calNow.getTime().getHours())
|
||||
{
|
||||
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getHours(" + String.valueOf(calSetWorkingCopy.getTime().getHours()) + ") < calNow.getTime().getHours(" + String.valueOf(calNow.getTime().getHours()) + ")");
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
|
||||
}
|
||||
else if(calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours())
|
||||
{
|
||||
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours()");
|
||||
if(calSetWorkingCopy.getTime().getMinutes() <= calNow.getTime().getMinutes())
|
||||
{
|
||||
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getMinutes() < calNow.getTime().getMinutes()");
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(diff < 0)
|
||||
{
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Adding " + String.valueOf(diff+7) + " on top of " + String.valueOf(calSetWorkingCopy.get(Calendar.DAY_OF_WEEK)));
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff+7); // it's a past weekday, schedule for next week
|
||||
}
|
||||
else
|
||||
{
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Adding " + String.valueOf(diff) + " on top of " + String.valueOf(calSetWorkingCopy.get(Calendar.DAY_OF_WEEK)));
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff); // it's a future weekday, schedule for that day
|
||||
}
|
||||
|
||||
i++;
|
||||
i=(int)System.currentTimeMillis();
|
||||
String calSetWorkingCopyString = sdf.format(calSetWorkingCopy.getTime()) + " RequestCode: " + String.valueOf(i);
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of rule: " + oneRule.getName() + " beginning at " + calSetWorkingCopyString);
|
||||
|
||||
alarmCandidates.add(calSetWorkingCopy.getTimeInMillis());
|
||||
// Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// alarmIntent.setData(Uri.parse("myalarms://" + i));
|
||||
// PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, i, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, calSetWorkingCopy.getTimeInMillis(), milliSecondsInAWeek, alarmPendingIntent);
|
||||
// requestCodeList.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // get a Calendar object with current time
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.add(Calendar.SECOND, 10);
|
||||
// String calSetWorkingCopyString2 = sdf.format(cal.getTime());
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
|
||||
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
|
||||
// requestCodeList.add(0);
|
||||
|
||||
scheduleNextAlarm();
|
||||
}
|
||||
|
||||
private static void scheduleNextAlarm()
|
||||
{
|
||||
Long currentTime = System.currentTimeMillis();
|
||||
Long scheduleCandidate = null;
|
||||
|
||||
if(alarmCandidates.size() == 0)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "No alarms to be scheduled.", 3);
|
||||
return;
|
||||
}
|
||||
else if(alarmCandidates.size() == 1)
|
||||
{
|
||||
// only one alarm, schedule that
|
||||
scheduleCandidate = alarmCandidates.get(0);
|
||||
}
|
||||
else if(alarmCandidates.size() > 1)
|
||||
{
|
||||
scheduleCandidate = alarmCandidates.get(0);
|
||||
|
||||
for(long alarmCandidate : alarmCandidates)
|
||||
{
|
||||
if(Math.abs(currentTime - alarmCandidate) < Math.abs(currentTime - scheduleCandidate))
|
||||
scheduleCandidate = alarmCandidate;
|
||||
}
|
||||
}
|
||||
|
||||
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate, alarmPendingIntent);
|
||||
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(scheduleCandidate);
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "Chose " + sdf.format(calendar.getTime()) + " as next scheduled alarm.", 4);
|
||||
|
||||
}
|
||||
|
||||
public static void clearAlarms()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
|
||||
for(int requestCode : requestCodeList)
|
||||
{
|
||||
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
|
||||
centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
||||
}
|
||||
requestCodeList.clear();
|
||||
}
|
||||
|
||||
private static void startAlarmListenerInternal(AutomationService givenAutomationServiceRef)
|
||||
{
|
||||
if(!alarmListenerActive)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
|
||||
AlarmListener.automationServiceRef = givenAutomationServiceRef;
|
||||
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
|
||||
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
|
||||
alarmListenerActive = true;
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
|
||||
AlarmListener.setAlarms();
|
||||
|
||||
// // get a Calendar object with current time
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// // add 5 minutes to the calendar object
|
||||
// cal.add(Calendar.SECOND, 10);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Request to start AlarmListener. But it's already active.", 5);
|
||||
}
|
||||
|
||||
private static void stopAlarmListenerInternal()
|
||||
{
|
||||
if(alarmListenerActive)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4);
|
||||
clearAlarms();
|
||||
// centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
||||
alarmListenerActive = false;
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Request to stop AlarmListener. But it's not running.", 5);
|
||||
}
|
||||
public static void reloadAlarms()
|
||||
{
|
||||
AlarmListener.setAlarms();
|
||||
}
|
||||
@Override
|
||||
public void startListener(AutomationService automationService)
|
||||
{
|
||||
AlarmListener.startAlarmListener(automationService);
|
||||
}
|
||||
@Override
|
||||
public void stopListener(AutomationService automationService)
|
||||
{
|
||||
AlarmListener.stopAlarmListener(automationService);
|
||||
}
|
||||
|
||||
public static boolean haveAllPermission()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListenerRunning()
|
||||
{
|
||||
return isAlarmListenerActive();
|
||||
}
|
||||
@Override
|
||||
public Trigger_Enum[] getMonitoredTrigger()
|
||||
{
|
||||
return new Trigger_Enum[] { Trigger_Enum.timeFrame };
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -26,6 +27,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
private static IntentFilter batteryIntentFilter = null;
|
||||
private static Intent batteryStatus = null;
|
||||
private static BroadcastReceiver batteryInfoReceiverInstance = null;
|
||||
|
||||
public static void startBatteryReceiver(final AutomationService automationServiceRef)
|
||||
{
|
||||
if(!batteryReceiverActive)
|
||||
@ -78,11 +80,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
return batteryLevel;
|
||||
}
|
||||
|
||||
private static int deviceIsCharging = 0; //0=unknown, 1=no, 2=yes
|
||||
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
|
||||
|
||||
public static int getDeviceIsCharging()
|
||||
public static int getCurrentChargingState()
|
||||
{
|
||||
return deviceIsCharging;
|
||||
return currentChargingState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -145,31 +147,6 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
this.actionDischarging(context);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
// else if(intent.getAction().equals(Intent.ACTION_POWER_CONNECTED))
|
||||
// {
|
||||
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.");
|
||||
// deviceIsCharging = 2;
|
||||
// //activate rule(s)
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
||||
// for(int i=0; i<ruleCandidates.size(); i++)
|
||||
// {
|
||||
// if(ruleCandidates.get(i).applies(context))
|
||||
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
|
||||
// }
|
||||
// }
|
||||
// else if(intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED))
|
||||
// {
|
||||
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.");
|
||||
// deviceIsCharging = 1;
|
||||
// //activate rule(s)
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
||||
// for(int i=0; i<ruleCandidates.size(); i++)
|
||||
// {
|
||||
// if(ruleCandidates.get(i).applies(context))
|
||||
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
@ -180,7 +157,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
|
||||
public static int isDeviceCharging(Context context)
|
||||
{
|
||||
switch(deviceIsCharging)
|
||||
switch(currentChargingState)
|
||||
{
|
||||
case 0:
|
||||
Miscellaneous.logEvent("w", "ChargingInfo", "Status of device charging was requested. Information isn't available, yet.", 4);
|
||||
@ -188,25 +165,26 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
case 1:
|
||||
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is discharging.", 3);
|
||||
break;
|
||||
case 2:
|
||||
case BatteryManager.BATTERY_STATUS_CHARGING:
|
||||
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is charging.", 3);
|
||||
break;
|
||||
}
|
||||
|
||||
return deviceIsCharging;
|
||||
return currentChargingState;
|
||||
}
|
||||
|
||||
private void actionCharging(Context context)
|
||||
{
|
||||
if(deviceIsCharging != 2) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
if(currentChargingState != BatteryManager.BATTERY_STATUS_CHARGING) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
{
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.", 3);
|
||||
deviceIsCharging = 2;
|
||||
currentChargingState = BatteryManager.BATTERY_STATUS_CHARGING;
|
||||
//activate rule(s)
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(context))
|
||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
@ -216,25 +194,26 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
{
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery level has changed.", 3);
|
||||
//activate rule(s)
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBatteryLevel();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.batteryLevel);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(context))
|
||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void actionDischarging(Context context)
|
||||
{
|
||||
if(deviceIsCharging != 1) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
if(currentChargingState != BatteryManager.BATTERY_STATUS_UNKNOWN) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
{
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.", 3);
|
||||
deviceIsCharging = 1;
|
||||
currentChargingState = BatteryManager.BATTERY_STATUS_UNKNOWN;
|
||||
//activate rule(s)
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(context))
|
||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
@ -254,10 +233,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Connected to computer.", 3);
|
||||
Toast.makeText(context, "Connected to computer.", Toast.LENGTH_LONG).show();
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
|
||||
for(Rule oneRule : ruleCandidates)
|
||||
{
|
||||
if(oneRule.applies(context))
|
||||
if(oneRule.getsGreenLight(context))
|
||||
oneRule.activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
@ -275,10 +255,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Disconnected from computer.", 3);
|
||||
Toast.makeText(context, "Disconnected from computer.", Toast.LENGTH_LONG).show();
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
|
||||
for(Rule oneRule : ruleCandidates)
|
||||
{
|
||||
if(oneRule.applies(context))
|
||||
if(oneRule.getsGreenLight(context))
|
||||
oneRule.activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
@ -296,8 +277,8 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
||||
|
||||
public static boolean haveAllPermission()
|
||||
{
|
||||
return ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext()) &&
|
||||
ActivityPermissions.havePermission("android.permission.BATTERY_STATS", Miscellaneous.getAnyContext());
|
||||
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext()) &&
|
||||
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,10 +124,10 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
|
||||
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDeviceInRange), bluetoothDevice.getName()), 3);
|
||||
}
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBluetoothConnection();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.bluetoothConnection);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(AutomationService.getInstance()))
|
||||
if(ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
|
||||
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
}
|
||||
|
@ -138,10 +138,11 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
|
||||
boolean isAirplaneMode = isAirplaneMode(context);
|
||||
automationServiceRef.getLocationProvider().handleAirplaneMode(isAirplaneMode);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.airplaneMode);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(automationServiceRef))
|
||||
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
@ -171,10 +172,11 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
|
||||
|
||||
automationServiceRef.getLocationProvider().handleRoaming(isRoaming);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.roaming);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(automationServiceRef))
|
||||
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,433 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.jens.automation2.AutomationService;
|
||||
import com.jens.automation2.Miscellaneous;
|
||||
import com.jens.automation2.Rule;
|
||||
import com.jens.automation2.TimeFrame;
|
||||
import com.jens.automation2.Trigger;
|
||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateTimeListener extends BroadcastReceiver implements AutomationListenerInterface
|
||||
{
|
||||
private static AutomationService automationServiceRef;
|
||||
private static AlarmManager centralAlarmManagerInstance;
|
||||
// private static Intent alarmIntent;
|
||||
// private static PendingIntent alarmPendingIntent;
|
||||
private static boolean alarmListenerActive=false;
|
||||
private static ArrayList<ScheduleElement> alarmCandidates = new ArrayList<>();
|
||||
|
||||
private static ArrayList<Integer> requestCodeList = new ArrayList<Integer>();
|
||||
|
||||
public static void startAlarmListener(final AutomationService automationServiceRef)
|
||||
{
|
||||
DateTimeListener.startAlarmListenerInternal(automationServiceRef);
|
||||
}
|
||||
public static void stopAlarmListener(Context context)
|
||||
{
|
||||
DateTimeListener.stopAlarmListenerInternal();
|
||||
}
|
||||
|
||||
public static boolean isAlarmListenerActive()
|
||||
{
|
||||
return alarmListenerActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
|
||||
Date now = new Date();
|
||||
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
|
||||
Time passTime = Time.valueOf(timeString);
|
||||
|
||||
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
|
||||
// ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
|
||||
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
|
||||
{
|
||||
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
|
||||
allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
setAlarms();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
public static void setAlarms()
|
||||
{
|
||||
alarmCandidates.clear();
|
||||
|
||||
Calendar calNow = Calendar.getInstance();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
|
||||
clearAlarms();
|
||||
|
||||
int i=0;
|
||||
|
||||
// // get a Calendar object with current time
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// // add 5 minutes to the calendar object
|
||||
// cal.add(Calendar.SECOND, 10);
|
||||
// String calSetWorkingCopyString2 = null;
|
||||
// SimpleDateFormat sdf2 = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
// if (cal != null)
|
||||
// {
|
||||
// calSetWorkingCopyString2 = sdf2.format(cal.getTime());
|
||||
// }
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
|
||||
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
|
||||
// requestCodeList.add(0);
|
||||
|
||||
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
|
||||
allRulesWithTimeFrames = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
|
||||
// allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
|
||||
/*
|
||||
* Take care of regular executions, no repetitions in between.
|
||||
*/
|
||||
Miscellaneous.logEvent("i", "DateTimeListener", "Checking rules for single run alarm candidates.", 5);
|
||||
for(Rule oneRule : allRulesWithTimeFrames)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.getName() + " for single run alarm candidates.", 5);
|
||||
if(oneRule.isRuleActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking trigger " + oneTrigger.toString() + " for single run alarm candidates.", 5);
|
||||
|
||||
if(oneTrigger.getTriggerType().equals(Trigger_Enum.timeFrame))
|
||||
{
|
||||
TimeFrame tf = new TimeFrame(oneTrigger.getTriggerParameter2());
|
||||
|
||||
Calendar calSet;
|
||||
Time setTime;
|
||||
|
||||
if(oneTrigger.getTriggerParameter())
|
||||
setTime = tf.getTriggerTimeStart();
|
||||
else
|
||||
setTime = tf.getTriggerTimeStop();
|
||||
|
||||
calSet = (Calendar) calNow.clone();
|
||||
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
|
||||
calSet.set(Calendar.MINUTE, setTime.getMinutes());
|
||||
calSet.set(Calendar.SECOND, 0);
|
||||
calSet.set(Calendar.MILLISECOND, 0);
|
||||
// At this point calSet would be a scheduling candidate. It's just the day that might not be right, yet.
|
||||
|
||||
for(int dayOfWeek : tf.getDayList())
|
||||
{
|
||||
Calendar calSetWorkingCopy = (Calendar) calSet.clone();
|
||||
|
||||
int diff = dayOfWeek - calNow.get(Calendar.DAY_OF_WEEK);
|
||||
if(diff == 0) // We're talking about the current weekday, but is the time still in the future?
|
||||
{
|
||||
if(calSetWorkingCopy.getTime().getHours() < calNow.getTime().getHours())
|
||||
{
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
|
||||
}
|
||||
else if(calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours())
|
||||
{
|
||||
if(calSetWorkingCopy.getTime().getMinutes() <= calNow.getTime().getMinutes())
|
||||
{
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(diff < 0)
|
||||
{
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff+7); // it's a past weekday, schedule for next week
|
||||
}
|
||||
else
|
||||
{
|
||||
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff); // it's a future weekday, schedule for that day
|
||||
}
|
||||
|
||||
i++;
|
||||
i=(int)System.currentTimeMillis();
|
||||
sdf.format(calSetWorkingCopy.getTime());
|
||||
String.valueOf(i);
|
||||
|
||||
alarmCandidates.add(new ScheduleElement(calSetWorkingCopy, "Rule " + oneRule.getName() + ", trigger " + oneTrigger.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "DateTimeListener","Error checking anything for rule " + oneRule.toString() + " needs to be added to candicates list: " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Only take care of repeated executions.
|
||||
*/
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking rules for repeated run alarm candidates.", 5);
|
||||
for(Rule oneRule : allRulesWithTimeFrames)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.getName() + " for repeated run alarm candidates.", 5);
|
||||
if(oneRule.isRuleActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.toString() , 5);
|
||||
|
||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking trigger " + oneTrigger.toString() + " for repeated run alarm candidates.", 5);
|
||||
if(oneTrigger.getTriggerType().equals(Trigger_Enum.timeFrame))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule trigger " + oneTrigger.toString() , 5);
|
||||
|
||||
/*
|
||||
* Check for next repeated execution:
|
||||
*
|
||||
* Check if the rule currently applies....
|
||||
*
|
||||
* If no -> do nothing
|
||||
* If yes -> Take starting time and calculate the next repeated execution
|
||||
* 1. Take starting time
|
||||
* 2. Take current time
|
||||
* 3. Calculate difference, but include check to see if we're after that time,
|
||||
* be it start or end of the timeframe.
|
||||
* 4. Take div result +1 and add this on top of starting time
|
||||
* 5. Is this next possible execution still inside timeframe? Also consider timeframes spanning over midnight
|
||||
*/
|
||||
Calendar calSet;
|
||||
Time setTime;
|
||||
TimeFrame tf = new TimeFrame(oneTrigger.getTriggerParameter2());
|
||||
|
||||
if(tf.getRepetition() > 0)
|
||||
{
|
||||
if(oneTrigger.applies(calNow, Miscellaneous.getAnyContext()))
|
||||
{
|
||||
Calendar calSchedule = getNextRepeatedExecutionAfter(oneTrigger, calNow);
|
||||
|
||||
alarmCandidates.add(new ScheduleElement(calSchedule, "Rule " + oneRule.getName() + ", trigger " + oneTrigger.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "DateTimeListener","Error checking anything for rule " + oneRule.toString() + " needs to be added to candicates list: " + Log.getStackTraceString(e), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scheduleNextAlarm();
|
||||
}
|
||||
|
||||
private static void scheduleNextAlarm()
|
||||
{
|
||||
Long currentTime = System.currentTimeMillis();
|
||||
ScheduleElement scheduleCandidate = null;
|
||||
|
||||
if(alarmCandidates.size() == 0)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "No alarms to be scheduled.", 3);
|
||||
return;
|
||||
}
|
||||
else if(alarmCandidates.size() == 1)
|
||||
{
|
||||
// only one alarm, schedule that
|
||||
scheduleCandidate = alarmCandidates.get(0);
|
||||
}
|
||||
else if(alarmCandidates.size() > 1)
|
||||
{
|
||||
scheduleCandidate = alarmCandidates.get(0);
|
||||
|
||||
for(ScheduleElement alarmCandidate : alarmCandidates)
|
||||
{
|
||||
if(Math.abs(currentTime - alarmCandidate.time.getTimeInMillis()) < Math.abs(currentTime - scheduleCandidate.time.getTimeInMillis()))
|
||||
scheduleCandidate = alarmCandidate;
|
||||
}
|
||||
}
|
||||
|
||||
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
|
||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate.time.getTimeInMillis(), alarmPendingIntent);
|
||||
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(scheduleCandidate.time.getTimeInMillis());
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "Chose " + sdf.format(calendar.getTime()) + " as next scheduled alarm.", 4);
|
||||
}
|
||||
|
||||
public static void clearAlarms()
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
|
||||
for(int requestCode : requestCodeList)
|
||||
{
|
||||
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
|
||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
|
||||
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
|
||||
centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
||||
}
|
||||
requestCodeList.clear();
|
||||
}
|
||||
|
||||
private static void startAlarmListenerInternal(AutomationService givenAutomationServiceRef)
|
||||
{
|
||||
if(!alarmListenerActive)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
|
||||
DateTimeListener.automationServiceRef = givenAutomationServiceRef;
|
||||
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
|
||||
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
|
||||
alarmListenerActive = true;
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
|
||||
DateTimeListener.setAlarms();
|
||||
|
||||
// // get a Calendar object with current time
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// // add 5 minutes to the calendar object
|
||||
// cal.add(Calendar.SECOND, 10);
|
||||
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent);
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Request to start AlarmListener. But it's already active.", 5);
|
||||
}
|
||||
|
||||
private static void stopAlarmListenerInternal()
|
||||
{
|
||||
if(alarmListenerActive)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4);
|
||||
clearAlarms();
|
||||
// centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
||||
alarmListenerActive = false;
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "AlarmListener", "Request to stop AlarmListener. But it's not running.", 5);
|
||||
}
|
||||
public static void reloadAlarms()
|
||||
{
|
||||
DateTimeListener.setAlarms();
|
||||
}
|
||||
@Override
|
||||
public void startListener(AutomationService automationService)
|
||||
{
|
||||
DateTimeListener.startAlarmListener(automationService);
|
||||
}
|
||||
@Override
|
||||
public void stopListener(AutomationService automationService)
|
||||
{
|
||||
DateTimeListener.stopAlarmListener(automationService);
|
||||
}
|
||||
|
||||
public static boolean haveAllPermission()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListenerRunning()
|
||||
{
|
||||
return isAlarmListenerActive();
|
||||
}
|
||||
@Override
|
||||
public Trigger_Enum[] getMonitoredTrigger()
|
||||
{
|
||||
return new Trigger_Enum[] { Trigger_Enum.timeFrame };
|
||||
}
|
||||
|
||||
static class ScheduleElement implements Comparable<ScheduleElement>
|
||||
{
|
||||
Calendar time;
|
||||
String reason;
|
||||
|
||||
public ScheduleElement(Calendar timestamp, String reason)
|
||||
{
|
||||
super();
|
||||
this.time = timestamp;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ScheduleElement o)
|
||||
{
|
||||
if(time.getTimeInMillis() == o.time.getTimeInMillis())
|
||||
return 0;
|
||||
if(time.getTimeInMillis() < o.time.getTimeInMillis())
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Miscellaneous.formatDate(time.getTime()) + ", reason : " + reason;
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public static Calendar getNextRepeatedExecutionAfter(Trigger trigger, Calendar now)
|
||||
{
|
||||
Calendar calSet;
|
||||
Time setTime;
|
||||
TimeFrame tf = new TimeFrame(trigger.getTriggerParameter2());
|
||||
|
||||
if(tf.getRepetition() > 0)
|
||||
{
|
||||
if(trigger.getTriggerParameter())
|
||||
setTime = tf.getTriggerTimeStart();
|
||||
else
|
||||
setTime = tf.getTriggerTimeStop();
|
||||
|
||||
calSet = (Calendar) now.clone();
|
||||
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
|
||||
calSet.set(Calendar.MINUTE, setTime.getMinutes());
|
||||
calSet.set(Calendar.SECOND, 0);
|
||||
calSet.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
// if(this.applies(null))
|
||||
// {
|
||||
// If the starting time is a day ahead remove 1 day.
|
||||
if(calSet.getTimeInMillis() > now.getTimeInMillis())
|
||||
calSet.add(Calendar.DAY_OF_MONTH, -1);
|
||||
|
||||
long differenceInSeconds = Math.abs(now.getTimeInMillis() - calSet.getTimeInMillis()) / 1000;
|
||||
long nextExecutionMultiplier = Math.floorDiv(differenceInSeconds, tf.getRepetition()) + 1;
|
||||
long nextScheduleTimestamp = (calSet.getTimeInMillis() / 1000) + (nextExecutionMultiplier * tf.getRepetition());
|
||||
Calendar calSchedule = Calendar.getInstance();
|
||||
calSchedule.setTimeInMillis(nextScheduleTimestamp * 1000);
|
||||
|
||||
/*
|
||||
* Das war mal aktiviert. Allerdings: Die ganze Funktion liefert zurück, wenn die Regel NOCH nicht
|
||||
* zutrifft, aber wir z.B. gleich den zeitlichen Bereich betreten.
|
||||
*/
|
||||
// if(trigger.checkDateTime(calSchedule.getTime(), false))
|
||||
// {
|
||||
return calSchedule;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("i", "DateTimeListener", "Trigger " + trigger.toString() + " is not executed repeatedly.", 5);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import static android.content.Context.SENSOR_SERVICE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
|
||||
import com.jens.automation2.ActivityManageTriggerDeviceOrientation;
|
||||
import com.jens.automation2.AutomationService;
|
||||
import com.jens.automation2.Miscellaneous;
|
||||
import com.jens.automation2.Rule;
|
||||
import com.jens.automation2.Settings;
|
||||
import com.jens.automation2.Trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class DeviceOrientationListener implements SensorEventListener, AutomationListenerInterface
|
||||
{
|
||||
// https://developer.android.com/guide/topics/sensors/sensors_position#java
|
||||
|
||||
ActivityManageTriggerDeviceOrientation activityManageTriggerDeviceOrientationInstance = null;
|
||||
|
||||
//the Sensor Manager
|
||||
private SensorManager sManager;
|
||||
static DeviceOrientationListener instance = null;
|
||||
boolean isRunning = false;
|
||||
|
||||
Calendar now = null;
|
||||
static Calendar lastTimeSignalArrived = null;
|
||||
static int sensorValueCounter = 0;
|
||||
|
||||
// Gravity rotational data
|
||||
private float gravity[];
|
||||
// Magnetic rotational data
|
||||
private float magnetic[]; //for magnetic rotational data
|
||||
private float accels[] = new float[3];
|
||||
private float mags[] = new float[3];
|
||||
private float[] values = new float[3];
|
||||
|
||||
// azimuth, pitch and roll
|
||||
private float azimuth;
|
||||
private float pitch;
|
||||
private float roll;
|
||||
|
||||
boolean applies = false;
|
||||
boolean flipped = false;
|
||||
boolean toggable = false;
|
||||
|
||||
|
||||
public static DeviceOrientationListener getInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new DeviceOrientationListener();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public float getAzimuth()
|
||||
{
|
||||
return azimuth;
|
||||
}
|
||||
|
||||
public float getPitch()
|
||||
{
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public float getRoll()
|
||||
{
|
||||
return roll;
|
||||
}
|
||||
|
||||
public void startSensorFromConfigActivity(Context context, ActivityManageTriggerDeviceOrientation activityManageTriggerDeviceOrientationInstance)
|
||||
{
|
||||
this.activityManageTriggerDeviceOrientationInstance = activityManageTriggerDeviceOrientationInstance;
|
||||
|
||||
if(!isRunning)
|
||||
{
|
||||
sManager = (SensorManager) context.getSystemService(SENSOR_SERVICE);
|
||||
|
||||
/*
|
||||
register the sensor listener to listen to the gyroscope sensor, use the
|
||||
callbacks defined in this class, and gather the sensor information as quick
|
||||
as possible
|
||||
*/
|
||||
|
||||
isRunning = true;
|
||||
|
||||
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
|
||||
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSensorFromConfigActivity()
|
||||
{
|
||||
activityManageTriggerDeviceOrientationInstance = null;
|
||||
|
||||
if(isRunning)
|
||||
{
|
||||
if(!Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
|
||||
{
|
||||
//unregister the sensor listener
|
||||
sManager.unregisterListener(this);
|
||||
isRunning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor arg0, int arg1)
|
||||
{
|
||||
//Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event)
|
||||
{
|
||||
switch (event.sensor.getType())
|
||||
{
|
||||
case Sensor.TYPE_MAGNETIC_FIELD:
|
||||
mags = event.values.clone();
|
||||
break;
|
||||
case Sensor.TYPE_ACCELEROMETER:
|
||||
accels = event.values.clone();
|
||||
break;
|
||||
}
|
||||
|
||||
if (mags != null && accels != null)
|
||||
{
|
||||
gravity = new float[9];
|
||||
magnetic = new float[9];
|
||||
SensorManager.getRotationMatrix(gravity, magnetic, accels, mags);
|
||||
float[] outGravity = new float[9];
|
||||
SensorManager.remapCoordinateSystem(gravity, SensorManager.AXIS_X, SensorManager.AXIS_Z, outGravity);
|
||||
SensorManager.getOrientation(outGravity, values);
|
||||
|
||||
azimuth = values[0] * 57.2957795f;
|
||||
pitch = values[1] * 57.2957795f;
|
||||
roll = values[2] * 57.2957795f;
|
||||
mags = null;
|
||||
accels = null;
|
||||
}
|
||||
|
||||
//else it will output the Roll, Pitch and Yawn values
|
||||
if(activityManageTriggerDeviceOrientationInstance != null)
|
||||
activityManageTriggerDeviceOrientationInstance.updateFields(azimuth, pitch, roll);
|
||||
|
||||
/*
|
||||
For some reason the first 3 values after starting the listener
|
||||
are crap.
|
||||
*/
|
||||
if(sensorValueCounter > 3)
|
||||
{
|
||||
now = Calendar.getInstance();
|
||||
if (lastTimeSignalArrived == null || now.getTimeInMillis() >= lastTimeSignalArrived.getTimeInMillis() + Settings.acceptDeviceOrientationSignalEveryX_MilliSeconds)
|
||||
{
|
||||
lastTimeSignalArrived = now;
|
||||
|
||||
Miscellaneous.logEvent("i", "DeviceOrientation", "Got device orientation update: azimuth: " + String.valueOf(azimuth) + ", pitch: " + String.valueOf(pitch) + ", roll: " + String.valueOf(pitch), 4);
|
||||
|
||||
if (AutomationService.isMyServiceRunning(Miscellaneous.getAnyContext()))
|
||||
{
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.deviceOrientation);
|
||||
for (int i = 0; i < ruleCandidates.size(); i++)
|
||||
{
|
||||
if (ruleCandidates.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
|
||||
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
sensorValueCounter++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startListener(AutomationService automationService)
|
||||
{
|
||||
if(!isRunning)
|
||||
{
|
||||
sManager = (SensorManager) Miscellaneous.getAnyContext().getSystemService(SENSOR_SERVICE);
|
||||
|
||||
/*
|
||||
register the sensor listener to listen to the gyroscope sensor, use the
|
||||
callbacks defined in this class, and gather the sensor information as quick
|
||||
as possible
|
||||
*/
|
||||
|
||||
isRunning = true;
|
||||
|
||||
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
|
||||
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopListener(AutomationService automationService)
|
||||
{
|
||||
this.activityManageTriggerDeviceOrientationInstance = null;
|
||||
|
||||
if(isRunning)
|
||||
{
|
||||
//unregister the sensor listener
|
||||
sManager.unregisterListener(this);
|
||||
isRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListenerRunning()
|
||||
{
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Trigger.Trigger_Enum[] getMonitoredTrigger()
|
||||
{
|
||||
return new Trigger.Trigger_Enum[] { Trigger.Trigger_Enum.deviceOrientation};
|
||||
}
|
||||
|
||||
/*
|
||||
Azimuth (degrees of rotation about the -z axis).
|
||||
This is the angle between the device's current compass direction and magnetic north. If the top edge of the
|
||||
device faces magnetic north, the azimuth is 0 degrees; if the top edge faces south, the azimuth is 180 degrees.
|
||||
Similarly, if the top edge faces east, the azimuth is 90 degrees, and if the top edge faces west, the azimuth is 270 degrees.
|
||||
|
||||
Pitch (degrees of rotation about the x axis).
|
||||
This is the angle between a plane parallel to the device's screen and a plane parallel to the ground. If you hold the device
|
||||
parallel to the ground with the bottom edge closest to you and tilt the top edge of the device toward the ground, the pitch
|
||||
angle becomes positive. Tilting in the opposite direction— moving the top edge of the device away from the ground—causes
|
||||
the pitch angle to become negative. The range of values is -180 degrees to 180 degrees.
|
||||
|
||||
Roll (degrees of rotation about the y axis).
|
||||
This is the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.
|
||||
If you hold the device parallel to the ground with the bottom edge closest to you and tilt the left edge of the
|
||||
device toward the ground, the roll angle becomes positive. Tilting in the opposite direction—moving the right
|
||||
edge of the device toward the ground— causes the roll angle to become negative. The range of values is -90 degrees
|
||||
to 90 degrees.
|
||||
|
||||
Computes the device's orientation based on the rotation matrix.
|
||||
When it returns, the array values are as follows:
|
||||
values[0]: Azimuth, angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole. When facing north, this angle is 0, when facing south, this angle is π. Likewise, when facing east, this angle is π/2, and when facing west, this angle is -π/2. The range of values is -π to π.
|
||||
values[1]: Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground. Assuming that the bottom edge of the device faces the user and that the screen is face-up, tilting the top edge of the device toward the ground creates a positive pitch angle. The range of values is -π to π.
|
||||
values[2]: Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground. Assuming that the bottom edge of the device faces the user and that the screen is face-up, tilting the left edge of the device toward the ground creates a positive roll angle. The range of values is -π/2 to π/2.
|
||||
Applying these three rotations in the azimuth, pitch, roll order transforms an identity matrix to the rotation matrix passed into this method. Also, note that all three orientation angles are expressed in radians.
|
||||
*/
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -74,10 +75,11 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
|
||||
Miscellaneous.logEvent("i", "HeadphoneJackListener", "Headset " + name + " plugged in.", 4);
|
||||
}
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.headsetPlugged);
|
||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(context))
|
||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
}
|
||||
@ -133,7 +135,7 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
|
||||
|
||||
public static boolean haveAllPermission()
|
||||
{
|
||||
return ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext());
|
||||
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext());
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ import com.jens.automation2.AutomationService;
|
||||
import com.jens.automation2.Miscellaneous;
|
||||
import com.jens.automation2.R;
|
||||
import com.jens.automation2.Rule;
|
||||
import com.jens.automation2.Trigger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@ -171,10 +172,10 @@ public class NfcReceiver
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidatesByNfc();
|
||||
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidates(Trigger.Trigger_Enum.nfcTag);
|
||||
for(int i=0; i<allRulesWithNfcTags.size(); i++)
|
||||
{
|
||||
if(allRulesWithNfcTags.get(i).applies(asInstance))
|
||||
if(allRulesWithNfcTags.get(i).getsGreenLight(asInstance))
|
||||
allRulesWithNfcTags.get(i).activate(asInstance, false);
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ public class NoiseListener implements AutomationListenerInterface
|
||||
noiseLevelDb = msg.getData().getLong("noiseLevelDb");
|
||||
|
||||
// execute matching rules containing noise
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByNoiseLevel();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.noiseLevel);
|
||||
for(Rule oneRule : ruleCandidates)
|
||||
{
|
||||
if(oneRule.applies(automationService))
|
||||
if(oneRule.getsGreenLight(automationService))
|
||||
oneRule.activate(automationService, false);
|
||||
}
|
||||
}
|
||||
|
@ -89,19 +89,12 @@ public class NotificationListener extends NotificationListenerService
|
||||
lastNotification.title = title;
|
||||
lastNotification.text = text;
|
||||
|
||||
// if(lastResponseToNotification == null || lastResponseToNotification.getTimeInMillis() < lastNotification.publishTime.getTimeInMillis())
|
||||
// {
|
||||
// lastResponseToNotification = Calendar.getInstance();
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.notification);
|
||||
for (int i = 0; i < ruleCandidates.size(); i++)
|
||||
{
|
||||
if (ruleCandidates.get(i).applies(NotificationListener.this))
|
||||
if(ruleCandidates.get(i).getsGreenLight(NotificationListener.this))
|
||||
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// Miscellaneous.logEvent("e", "NotificationCheck", "Ignoring notification as it is old.", 5);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -14,14 +14,6 @@ public class PackageReplacedReceiver extends BroadcastReceiver
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
// Toast.makeText(context, "package replaced", Toast.LENGTH_LONG).show();
|
||||
// int intentUid = intent.getExtras().getInt("android.intent.extra.UID"); // userid of the application that has just been updated
|
||||
// int myUid = android.os.Process.myUid(); // userid of this application
|
||||
//
|
||||
// boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false);
|
||||
|
||||
// if(intentUid == myUid)
|
||||
// {
|
||||
Settings.readFromPersistentStorage(context);
|
||||
|
||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.applicationHasBeenUpdated), context.getResources().getString(R.string.applicationHasBeenUpdated), 2);
|
||||
@ -34,9 +26,6 @@ public class PackageReplacedReceiver extends BroadcastReceiver
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Service", context.getResources().getString(R.string.logNotStartingServiceAfterAppUpdate), 2);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// Miscellaneous.logEvent("i", "Service", "Some other app has been updated.", 5);
|
||||
}
|
||||
|
||||
private static boolean hasServiceBeenRunning()
|
||||
|
@ -109,12 +109,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
||||
break;
|
||||
}
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
AutomationService asInstance = AutomationService.getInstance();
|
||||
if(asInstance != null)
|
||||
if(ruleCandidates.get(i).applies(asInstance))
|
||||
if(ruleCandidates.get(i).getsGreenLight(asInstance))
|
||||
ruleCandidates.get(i).activate(asInstance, false);
|
||||
}
|
||||
}
|
||||
@ -141,12 +141,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
||||
break;
|
||||
}
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionIncoming);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||
for (int i = 0; i < ruleCandidates.size(); i++)
|
||||
{
|
||||
AutomationService asInstance = AutomationService.getInstance();
|
||||
if (asInstance != null)
|
||||
if (ruleCandidates.get(i).applies(asInstance))
|
||||
if (ruleCandidates.get(i).getsGreenLight(asInstance))
|
||||
ruleCandidates.get(i).activate(asInstance, false);
|
||||
}
|
||||
}
|
||||
@ -168,22 +168,18 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
||||
*/
|
||||
setLastPhoneDirection(2);
|
||||
|
||||
// TelephonyManager tm = (TelephonyManager)context.getSystemService(Service.TELEPHONY_SERVICE);
|
||||
// int newState = tm.getCallState();
|
||||
// setCurrentState(newState);
|
||||
|
||||
setCurrentState(TelephonyManager.CALL_STATE_RINGING);
|
||||
|
||||
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
|
||||
setLastPhoneNumber(phoneNumber);
|
||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), getLastPhoneNumber()), 4);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
AutomationService asInstance = AutomationService.getInstance();
|
||||
if(asInstance != null)
|
||||
if(ruleCandidates.get(i).applies(asInstance))
|
||||
if(ruleCandidates.get(i).getsGreenLight(asInstance))
|
||||
ruleCandidates.get(i).activate(asInstance, false);
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,6 @@ public class ProcessListener implements AutomationListenerInterface
|
||||
@Override
|
||||
public void handleMessage(Message msg)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.processMonitoring), automationService.getResources().getString(R.string.messageReceivedStatingProcessMonitoringIsComplete), 5);
|
||||
// This will take care of results delivered by the actual monitoring instance
|
||||
|
||||
@ -59,18 +57,13 @@ public class ProcessListener implements AutomationListenerInterface
|
||||
for(String entry : getRecentlyStoppedApps())
|
||||
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStopped), entry, 3);
|
||||
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByProcess();
|
||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.process_started_stopped);
|
||||
for(int i=0; i<ruleCandidates.size(); i++)
|
||||
{
|
||||
if(ruleCandidates.get(i).applies(automationService))
|
||||
if(ruleCandidates.get(i).getsGreenLight(automationService))
|
||||
ruleCandidates.get(i).activate(automationService, false);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// catch(Exception e)
|
||||
// {
|
||||
// Miscellaneous.logEvent("e", "Noise level", "Error in workHandler->handleMessage(): " + e.getMessage());
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,12 +77,12 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
|
||||
if(action.equals(Intent.ACTION_TIMEZONE_CHANGED))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "TimeZoneListener", "Device timezone changed. Reloading alarms.", 3);
|
||||
AlarmListener.reloadAlarms();
|
||||
DateTimeListener.reloadAlarms();
|
||||
}
|
||||
else if(action.equals(Intent.ACTION_TIME_CHANGED))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 4);
|
||||
AlarmListener.reloadAlarms();
|
||||
DateTimeListener.reloadAlarms();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
app/src/main/res/drawable-hdpi/smartphone.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable-hdpi/vibrate.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable/arrow_azimuth.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable/arrow_pitch.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable/arrow_roll.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
@ -97,6 +97,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppVersion"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</ScrollView>
|
@ -27,7 +27,7 @@
|
||||
<EditText
|
||||
android:id="@+id/etSelectedSoundFile"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
@ -2,13 +2,20 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="10dp" >
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/smsDialogNotice"
|
||||
android:textColor="#ea131b"
|
||||
android:layout_marginBottom="@dimen/default_margin" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bImportNumberFromContacts"
|
||||
android:drawableLeft="@drawable/contacts"
|
@ -2,17 +2,24 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="10dp" >
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/urlToTriggerExplanation"
|
||||
android:layout_marginBottom="@dimen/default_margin"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRuleTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/urlToTrigger" />
|
||||
|
||||
<EditText
|
47
app/src/main/res/layout/activity_manage_action_vibrate.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_span="2"
|
||||
android:textSize="25dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:text="@string/vibrate" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/VibrateExplanation" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etVibratePattern"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="@dimen/default_margin"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bTestVibratePattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:text="@string/test" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSaveVibratePattern"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
@ -4,6 +4,15 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/default_margin">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_span="2"
|
||||
android:textSize="25dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:text="@string/setScreenBrightness" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkAutoBrightness"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -57,7 +57,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" />
|
||||
android:inputType="numberSigned" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" />
|
||||
android:inputType="numberSigned" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -45,6 +45,19 @@
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/general"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxChangeSoundMode"
|
||||
android:layout_width="wrap_content"
|
||||
@ -63,13 +76,54 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:text="@string/silentTriggersDnd" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dnd"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxChangeDnd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/change" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerDndMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:text="@string/dndRemarks" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/volumes"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_marginLeft="40dp" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxChangeVolumeMusicVideoGameMedia"
|
||||
@ -122,6 +176,19 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tones"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxChangeIncomingCallsRingtone"
|
||||
android:layout_width="wrap_content"
|
||||
@ -200,6 +267,19 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/miscellaneous"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBoxChangeAudibleSelection"
|
||||
android:layout_width="wrap_content"
|
||||
@ -240,6 +320,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSaveProfile"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save" />
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/default_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -9,7 +10,6 @@
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -92,7 +92,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSaveBluetoothTrigger"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save" />
|
||||
|
@ -0,0 +1,269 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/deviceOrientationExplanation"
|
||||
android:layout_marginBottom="@dimen/default_margin" />
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<ImageView
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:src="@drawable/arrow_azimuth"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationAzimuth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentAzimuth"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<ImageView
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:src="@drawable/arrow_pitch"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationPitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentOrientationPitch"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<ImageView
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:src="@drawable/arrow_roll"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationRoll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentRoll"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bApplyPositionValues"
|
||||
android:text="@string/apply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="@dimen/default_margin" />
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:shrinkColumns="0"
|
||||
android:stretchColumns="1">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:text=""
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientation"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/tolerance"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/wouldCurrentlyApply"
|
||||
android:singleLine="false"
|
||||
android:maxLines="2"
|
||||
android:lines="2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationAzimuth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/default_margin" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredAzimuth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:enabled="false"
|
||||
android:inputType="number" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredAzimuthTolerance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:inputType="number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesAzimuth"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationPitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/default_margin" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredPitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:enabled="false"
|
||||
android:inputType="number" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredPitchTolerance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:inputType="number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesPitch"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:text="@string/orientationRoll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/default_margin" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredRoll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:enabled="false"
|
||||
android:inputType="number" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDesiredRollTolerance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="50dp"
|
||||
android:inputType="number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppliesRoll"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/unknown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkDevicePositionApplies"
|
||||
android:checked="true"
|
||||
android:text="@string/mustApply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/explanationDeviceOrientationDirection" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSavePositionValues"
|
||||
android:text="@string/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/default_margin" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</ScrollView>
|
@ -3,7 +3,8 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,10 +2,9 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp" >
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_margin="@dimen/default_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
@ -25,7 +24,9 @@
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:shrinkColumns="1"
|
||||
android:stretchColumns="1">
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
@ -44,6 +45,18 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/automationNotificationsIgnored" />
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
@ -54,13 +67,13 @@
|
||||
android:text="@string/application" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginHorizontal="@dimen/default_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/etActivityOrActionPath"
|
||||
android:layout_marginHorizontal="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/anyApp"
|
||||
@ -68,6 +81,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSelectApp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/selectApplication" />
|
||||
@ -76,6 +90,13 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
@ -105,6 +126,13 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
|
@ -172,6 +172,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/bTriggerPhoneCallImportFromContacts"
|
||||
android:drawableLeft="@drawable/contacts"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
100
app/src/main/res/layout/activity_manage_trigger_profile.xml
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/default_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:shrinkColumns="1"
|
||||
android:stretchColumns="1" >
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:text="@string/profile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerProfiles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<View
|
||||
android:layout_span="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:text="@string/needsToBeActive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkProfileActive"
|
||||
android:checked="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<View
|
||||
android:layout_span="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:text="@string/checkSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkProfileCheckSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_span="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profileTriggerCheckSettings" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSaveTriggerProfile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:text="@string/save" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
@ -3,7 +3,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="30"
|
||||
android:layout_margin="10dp" >
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -120,8 +120,37 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sunday" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:background="#aa000000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkRepeat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/repeatEveryXseconds" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etRepeatEvery"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:minWidth="75dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:inputType="numberSigned" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSaveTimeFrame"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save" />
|
||||
|
@ -52,10 +52,23 @@
|
||||
android:entries="@array/startScreenOptions"
|
||||
android:entryValues="@array/startScreenOptionsValues" />
|
||||
|
||||
<ListPreference
|
||||
android:key="tabsPlacement"
|
||||
android:title="@string/tabsPlacement"
|
||||
android:summary="@string/tabsPlacementSummary"
|
||||
android:entries="@array/tabsPlacementOptions"
|
||||
android:entryValues="@array/tabsPlacementOptionsValues" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="executeRulesAndProfilesWithSingleClick"
|
||||
android:title="@string/executeRulesAndProfilesWithSingleClickTitle" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="automaticUpdateCheck"
|
||||
android:enabled="false"
|
||||
android:title="@string/automaticUpdateCheck"
|
||||
android:summary="@string/automaticUpdateCheckSummary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="displayNewsOnMainScreen"
|
||||
android:title="@string/displayNewsOnMainScreen"
|
||||
@ -250,6 +263,18 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:summary="@string/deviceOrientationSettings"
|
||||
android:title="@string/deviceOrientationSettings">
|
||||
|
||||
<EditTextPreference
|
||||
android:key="acceptDevicePositionSignalEveryX_MilliSeconds"
|
||||
android:summary="@string/deviceOrientationTimeAcceptIntervalSummary"
|
||||
android:title="@string/deviceOrientationTimeAcceptIntervalTitle"
|
||||
android:inputType="number"></EditTextPreference>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:summary="@string/activityDetection"
|
||||
android:title="@string/activityDetection">
|
@ -3,13 +3,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="10dp" >
|
||||
android:layout_margin="@dimen/default_margin" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvVolumeTestExplanation"
|
||||
android:id="@+id/tvVolumeCalibrationExplanation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/volumeTesterExplanation"
|
||||
android:text="@string/volumeCalibrationExplanation"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
<TableLayout
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCurrentVolume"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0dB"
|
||||
@ -45,6 +46,7 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etReferenceValue"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
@ -333,6 +333,14 @@
|
||||
android:layout_gravity="top"
|
||||
android:text="@string/settings" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bDonate"
|
||||
android:visibility="gone"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:text="@string/donate" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
</LinearLayout>
|
||||
</TabHost>
|
27
app/src/main/res/layout/main_tab_layout_tabs_at_bottom.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</TabHost>
|
27
app/src/main/res/layout/main_tab_layout_tabs_at_top.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</TabHost>
|
@ -2,7 +2,7 @@
|
||||
<resources>
|
||||
<string name="ruleActivate">Aktiviere Regel %1$s</string>
|
||||
<string name="profileActivate">Aktiviere Profil %1$s</string>
|
||||
<string name="ruleActivateToggle">Aktiviere Regel %1$s im Umschaltmodus</string>
|
||||
<string name="ruleActivateToggle">Aktiviere Regel %1$s im Umkehrmodus</string>
|
||||
<string name="addPoi">Ort hinzufügen</string>
|
||||
<string name="addRule">Regel hinzufügen</string>
|
||||
<string name="poiList">Orts-Liste:</string>
|
||||
@ -14,8 +14,7 @@
|
||||
<string name="serviceStarted">Automations-Dienst gestarted.</string>
|
||||
<string name="version">Version %1$s.</string>
|
||||
<string name="distanceBetween">Der Abstand zwischen GPS- und Mobilfunk-Position beträgt %1$d m. Dies +1 sollte der minimale Radius sein.</string>
|
||||
<string name="comparing">Sowohl Netzwerk- als auch GPS Position sind bekannt. Vergleiche...</string>
|
||||
<string name="positioningWindowNotice">Falls Sie in einem Gebäude sind wird empfohlen das Gerät in die Nähe eines Fensters zu bringen bis eine Position ermittelt werden konnte. Andernfalls kann es sehr lange dauern oder es funktioniert gar nicht.</string>
|
||||
<string name="positioningWindowNotice">Falls Sie in einem Gebäude sind, wird empfohlen das Gerät in die Nähe eines Fensters zu bringen bis eine Position ermittelt werden konnte. Andernfalls kann es sehr lange dauern oder es funktioniert gar nicht.</string>
|
||||
<string name="gettingPosition">Position wird ermittelt. Bitte warten...</string>
|
||||
<string name="yes">Ja</string>
|
||||
<string name="no">Nein</string>
|
||||
@ -64,7 +63,7 @@
|
||||
<string name="deactivating">Deaktiviere</string>
|
||||
<string name="bluetoothFailed">Änderung des Bluetooth Status fehlgeschlagen. Verfügt dieses Gerät über Bluetooth?</string>
|
||||
<string name="urlTooShort">Die Adresse ist zu kurz. Sie muß aus mindestens 10 Buchstaben bestehen.</string>
|
||||
<string name="textTooShort">Der Text ist zu kurz. Er muß aus mindestens 10 Buchstaben bestehen.</string>
|
||||
<string name="enterPhoneNumberAndText">Geben Sie eine Telefonnummer und einen Text ein.</string>
|
||||
<string name="selectTypeOfTrigger">Welche Art von Auslöser</string>
|
||||
<string name="entering">betrete</string>
|
||||
<string name="leaving">verlasse</string>
|
||||
@ -117,8 +116,8 @@
|
||||
<string name="timeframes">Zeiträume</string>
|
||||
<string name="helpTextTimeFrame">Wenn Sie eine Regel mit einem Zeitraum erstellen, haben Sie zwei Möglichkeiten. Sie können wählen, ob der Auslöser besagt, daß der Zeitraum entweder verlassen ODER betreten wird. In jedem Fall wird die Regel nur einmal ausgelöst. Wenn eine Regel z.B. besagt \"betrete timeframe xyz\" und das Klingeltonprofil in Vibration ändert, bedeutet das NICHT, daß das Gerät hinterher automatisch wieder zum normalen Klingelprofil zurückschaltet. Wenn das erwünscht ist, muß eine weitere Regel mit einem Folgezeitraum erstellen werden.</string>
|
||||
<string name="helpTextSound">Auf dem Hauptbildschirm können Sie die Funktion Tonänderunugen sperren benutzen, um vorrübergehend regelbasierte Tonänderungen zu deaktivieren. Z.B. könnten Sie in einer Situation oder an einem Ort sein, wo Klingeltöne normalerweise in Ordnung sind, aber dieses eine Mal würde es stören. Die Funktion wird automatisch wieder deaktiviert nachdem die eingestellte Zeit abgelaufen ist. Klicken Sie den + Knopf, um die angezeigte Zeit zur Frist hinzuzufügen. Sobald es aktiv ist, können Sie es mit dem Schalter rechts wieder abschalten (und so regelbasierte Tonänderungen wieder ermöglichen).</string>
|
||||
<string name="toggableRules">Umkehrbare Regeln</string>
|
||||
<string name="helpTextToggable">Regeln haben eine Einstellung namens \"Umschaltbar\". Das bedeutet: Wurde eine Regel ausgeführt und anschließend treten dieselben Auslöser wieder ein, wird die Regel nochmal in umgekehrter Weise ausgeführt, wo es möglich ist. Gegenwärtig funktioniert das nur im Zusammenspiel mit NFC Tags. Wenn Sie einen Tag zwei Mal berühren und es eine umschaltbare Regel zu diesem Tag gibt, wird das Programm das Gegenteil von gegenwärtigen Zustand tun, z.B. WLAN ausschalten, wenn es gegenwärtig eingeschaltet ist.</string>
|
||||
<string name="toggableRules">Unschaltbare Regeln</string>
|
||||
<string name="helpTextToggable">Regeln haben eine Einstellung namens \"Umkehrbar\". Das bedeutet: Wurde eine Regel ausgeführt und anschließend treten dieselben Auslöser wieder ein, wird die Regel nochmal in umgekehrter Weise ausgeführt, wo es möglich ist. Gegenwärtig funktioniert das nur im Zusammenspiel mit NFC Tags. Wenn Sie einen Tag zwei Mal berühren und es eine umkehrbare Regel zu diesem Tag gibt, wird das Programm das Gegenteil von gegenwärtigen Zustand tun, z.B. WLAN ausschalten, wenn es gegenwärtig eingeschaltet ist.</string>
|
||||
<string name="helpTextProcessMonitoring">Wenn Sie eine Regel mit einer Prozess Überwachung erstellen, wird die Anwendung in regelmäßigen Abständen nach diesem Prozess schauen. Wie häufig können Sie in den Einstellungen festlegen. Das mag zwar in vielen Fällen langsam reagieren, aber eine permanente Überwachung würde zuviel Akkuleistung kosten. Und das Betriebssystem stellt dafür keinen Broadcast zur Verfügung.</string>
|
||||
<string name="helpTitleEnergySaving">Energiespareinstellungen</string>
|
||||
<string name="helpTextEnergySaving">Viele Gerätehersteller versuchen Energie zu sparen, indem die Hintergrundaktivitäten vieler Anwendungen eingeschränkt werden. Unglücklicherweise führt das häufig dazu, dass diese Anwendungen nicht mehr zufällig funktionieren; das gilt auch für Automation. Schauen Sie sich <a href="https://dontkillmyapp.com/">diese Seite</a> an, um herauszufinden, wie Sie Automation auf Ihrem Gerät von dieser Behandlung ausschließen können.</string>
|
||||
@ -175,21 +174,7 @@
|
||||
<string name="serviceNotRunning">Dienst läuft nicht.</string>
|
||||
<string name="general">Allgemein</string>
|
||||
<string name="generalText">Um dieses Programm zu benutzen, müssen Sie Regeln anlegen. Diese enthalten Auslöser (z.B. ob Sie ein bestimmtes Gebiet betreten oder eine bestimmte Zeitspanne beginnt). Nachdem Sie dies erledigt haben, klicken Sie auf den Ein/Aus Schalter auf dem Hauptbildschirm.</string>
|
||||
<string name="unknownActionSpecified">Unbekannte Aktion definiert.</string>
|
||||
<string name="errorChangingScreenRotation">Fehler beim Ändern der Bildschirmrotation</string>
|
||||
<string name="errorDeterminingWifiApState">Fehler bei der Statusprüfung des WLAN Routers</string>
|
||||
<string name="errorActivatingWifiAp">Fehler beim Aktivieren des WLAN Routers</string>
|
||||
<string name="failedToTriggerBluetooth">Fehler beim Ändern des Bluetooth Status. Hat dieses Gerät Bluetooth?</string>
|
||||
<string name="logAttemptingDownloadOf">Versuche Download von</string>
|
||||
<string name="logErrorGettingConnectionManagerService">Fehler beim Anbinden an den connectionManager Dienst. Ändere nichts am Usb-Router Status.</string>
|
||||
<string name="logErrorDeterminingCurrentUsbTetheringState">Fehler beim Aufrufen des gegenwärtigen USB-Router Status.</string>
|
||||
<string name="logDetectingTetherableUsbInterface">Überprüfe routingfähiges Interface.</string>
|
||||
<string name="logClearingBothLocationListeners">Stoppe beide LocationListener.</string>
|
||||
<string name="logStartingServiceAfterAppUpdate">Starte Dienst nach Programm Aktualisierung. Er lief vor der Aktualisierung schon.</string>
|
||||
<string name="logNotStartingServiceAfterAppUpdate">Starte Dienst nicht automatisch nach Programm Aktualisierung. Er lief davor nicht.</string>
|
||||
<string name="logStartingServiceAtPhoneBoot">Starte Dienst nach Neustart des Telefons.</string>
|
||||
<string name="logNotStartingServiceAtPhoneBoot">Starte Dienst nicht automatisch nach Neustart des Telefons.</string>
|
||||
<string name="applicationHasBeenUpdated">Die Anwendung wurde aktualisiert.</string>
|
||||
<string name="startServiceAfterAppUpdate">Dienst nach Anwendungsupdate automatisch wieder starten, wenn er vorher lief.</string>
|
||||
<string name="startServiceAfterAppUpdateShort">Starte Dienst nach Update</string>
|
||||
<string name="wifiConnection">WLAN Verbindung</string>
|
||||
@ -227,7 +212,7 @@
|
||||
<string name="anotherPoiByThatName">Es gibt bereits einen Ort mit diesem Namen.</string>
|
||||
<string name="anotherRuleByThatName">Es gibt bereits eine Regel mit diesem Namen.</string>
|
||||
<string name="startOtherActivity">Programm starten</string>
|
||||
<string name="selectApplication">Wählen Sie\neine Anwendung</string>
|
||||
<string name="selectApplication">Anwendung wählen</string>
|
||||
<string name="selectPackageOfApplication">Wählen Sie ein Paket der Anwendung</string>
|
||||
<string name="selectActivityToBeStarted">Wählen Sie die Activity des Pakets</string>
|
||||
<string name="errorStartingOtherActivity">Fehler beim Starten einer anderen Anwendung</string>
|
||||
@ -254,12 +239,10 @@
|
||||
<string name="moveDown">Herunterschieben</string>
|
||||
<string name="cantMoveUp">Das Objekt kann nicht weiter hochgeschoben werden.</string>
|
||||
<string name="cantMoveDown">Das Objekt kann nicht weiter heruntergeschoben werden.</string>
|
||||
<string name="ruleCheckOf">RuleCheck von %1$s</string>
|
||||
<string name="airplaneMode">Flugmodus</string>
|
||||
<string name="activate">Aktivieren</string>
|
||||
<string name="deactivate">Deaktivieren</string>
|
||||
<string name="airplaneModeSdk17Warning">Seit Android Version 4.2 funktioniert diese Funktion - wenn überhaupt - nur noch mit gerooteten Geräten.</string>
|
||||
<string name="triggerUrlReplacementPositionError">Laut Ihren Einstellungen sollte der aufzurufenden Adresse eine Position hinzugefügt werden. Leider ist der im Moment nicht möglich, daß noch keine Position bekannt ist.</string>
|
||||
<string name="addIntentValue">Parameter-Paar hinzufügen</string>
|
||||
<string name="parameterName">Parameter Name</string>
|
||||
<string name="parameterValue">Parameter Wert</string>
|
||||
@ -288,7 +271,7 @@
|
||||
<string name="with">mit</string>
|
||||
<string name="phoneNumber">Telefonnummer</string>
|
||||
<string name="enterPhoneNumber">Geben Sie eine Telefonnummer ein. Leer lassen für irgendeine Nummer.</string>
|
||||
<string name="phoneDirection">Wählen Sie die Gesprächsrichtung</string>
|
||||
<string name="phoneDirection">Wählen Sie die\nGesprächsrichtung</string>
|
||||
<string name="any">egal</string>
|
||||
<string name="incoming">eingehend</string>
|
||||
<string name="outgoing">ausgehend</string>
|
||||
@ -312,7 +295,6 @@
|
||||
<string name="nfcNoNdefIntentBut">Kein NFC NDEF intent, sondern</string>
|
||||
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC wird in dieser Android Version noch nicht unterstützt.</string>
|
||||
<string name="cantRunRule">Regeln können nicht ausgeführt werden.</string>
|
||||
<string name="cantDownloadTooFewRequestsInSettings">Kann nichts runterladen. Menge an erlaubten Versuchen ist in den Einstellungen auf weniger als 1 gesetzt.</string>
|
||||
<string name="nfcApplyTagToRule">Aktuellen Tag in Regel übernehmen</string>
|
||||
<string name="nfcTagReadSuccessfully">Tag erfolgreich gelesen.</string>
|
||||
<string name="nfcValueNotSuitable">Gepspeicherter Wert nicht geeignet.</string>
|
||||
@ -323,34 +305,28 @@
|
||||
<string name="currentId">Aktuelle Bezeichnung:</string>
|
||||
<string name="nfcTagDataNotUsable">Tag Daten nicht nutzbar, neu schreiben</string>
|
||||
<string name="nfcBringTagIntoRangeToRead">Bringen Sie einen Tag in Reichweite, um ihn zu lesen.</string>
|
||||
<string name="toggleRule">Umschaltregel</string>
|
||||
<string name="toggleRule">Umkehrregel</string>
|
||||
<string name="toggling">Schalte um</string>
|
||||
<string name="toggle">umzuschalten</string>
|
||||
<string name="overlapBetweenPois">Überschneidung mit Ort %1$s von %2$s Metern festgestellt. Reduzieren Sie den Radius um mindestens diesen Wert.</string>
|
||||
<string name="noOverLap">Keine Überschneidung mit anderen Orten festgestellt.</string>
|
||||
<string name="ruleToggable">Regel %1$s ist umkehrbar.</string>
|
||||
<string name="ruleNotToggable">Regel %1$s ist nicht umkehrbar.</string>
|
||||
<string name="none">keiner</string>
|
||||
<string name="anyLocation">irgendein Ort</string>
|
||||
<string name="invalidPoiName">Ungültiger Name für einen Ort.</string>
|
||||
<string name="eraseSettings">Einstellungen löschen</string>
|
||||
<string name="defaultSettings">Standard Einstellungen</string>
|
||||
<string name="areYouSure">Sind sie sicher?</string>
|
||||
<string name="poiCouldBeInRange">Mindestens Ort %1$s könnte im nahen Umkreis liegen, wenn nicht noch andere.</string>
|
||||
<string name="noPoiInRelevantRange">Kein Ort im näheren Umkreis.</string>
|
||||
<string name="activityDetection">Aktivitätserkennung</string>
|
||||
<string name="detectedActivity">Erkannte Tätigkeit:</string>
|
||||
<string name="detectedActivityInVehicle">In einem Fahrzeug (Auto/Bus)</string>
|
||||
<string name="detectedActivityOnBicycle">Auf dem Fahrrad</string>
|
||||
<string name="detectedActivityOnFoot">Zu Fuß</string>
|
||||
<string name="detectedActivityStill">Ruhe</string>
|
||||
<string name="detectedActivityUnknown">Unbekannt</string>
|
||||
<string name="detectedActivityUnknown">unbekannt</string>
|
||||
<string name="detectedActivityTilting">Kippen</string>
|
||||
<string name="detectedActivityWalking">Gehen</string>
|
||||
<string name="detectedActivityRunning">Laufen</string>
|
||||
<string name="detectedActivityInvalidStatus">Ungültige Tätigkeit</string>
|
||||
<string name="ruleDoesntApplyActivityGivenButTooLowProbability">Regel trifft nicht zu. Erkannte Tätigkeit %1$s gegebenem, aber mit zu niedriger Wahrscheinlichkeit (%2$s %%), gefordert %3$s %%.</string>
|
||||
<string name="ruleDoesntApplyActivityNotPresent">Regel trifft nicht zu. Geforderte Tätigkeit %1$s passiert gerade nicht.</string>
|
||||
<string name="selectTypeOfActivity">Art der Tätigkeit auswählen</string>
|
||||
<string name="triggerOnlyAvailableIfPlayServicesInstalled">Dieser Auslöser kann nur verwendet werden, wenn die Google Play Dienste installiert sind.</string>
|
||||
<string name="activityDetectionFrequencyTitle">Frequenz für Aktivitätserkennung [sek]</string>
|
||||
@ -361,7 +337,7 @@
|
||||
<string name="outgoingCallTo">Ausgehender Telefonanruf von %1$s.</string>
|
||||
<string name="actionSpeakText">Text sprechen</string>
|
||||
<string name="textToSpeak">Zu sprechender Text</string>
|
||||
<string name="toggleNotAllowed">Die Umschaltfunktion ist momentan nur für Regeln erlaubt, die NFC Tags als Auslöser haben. Für weitere Informationen lesen Sie die Hilfe.</string>
|
||||
<string name="toggleNotAllowed">Die Umkehrfunktion ist momentan nur für Regeln erlaubt, die NFC Tags als Auslöser haben. Für weitere Informationen lesen Sie die Hilfe.</string>
|
||||
<string name="errorReadingPoisAndRulesFromFile">Fehler beim Lesen von Orten und Regeln aus Datei.</string>
|
||||
<string name="noDataChangedReadingAnyway">Es scheint als wären keine Datenänderungen gespeichert worden. Allerdings könnten Änderungen im Speicher sein, die zurückgenommen werden müssen. Daher wird die Einstellungsdatei neu geladen.</string>
|
||||
<string name="bluetoothConnection">Bluetooth Verbindung</string>
|
||||
@ -370,8 +346,6 @@
|
||||
<string name="bluetoothDeviceInRange">Bluetooth Gerät %1$s in Reichweite.</string>
|
||||
<string name="bluetoothDeviceOutOfRange">Bluetooth Gerät %1$s außer Reichweite.</string>
|
||||
<string name="anyDevice">irgendeinem Gerät</string>
|
||||
<string name="ruleDoesntApplyNotTheCorrectDeviceName">Regel trifft nicht zu. Nicht der korrekte Bluetooth-Geräte-Name.</string>
|
||||
<string name="ruleDoesntApplyNotTheCorrectDeviceAddress">Regel trifft nicht zu. Nicht die korrekte Bluetooth-Geräte-Adresse.</string>
|
||||
<string name="noDevice">kein Gerät</string>
|
||||
<string name="selectDeviceFromList">Gerät aus Liste</string>
|
||||
<string name="connectionToDevice">Gerät verbunden</string>
|
||||
@ -380,32 +354,20 @@
|
||||
<string name="deviceOutOfRange">Gerät außer Reichweite</string>
|
||||
<string name="selectDeviceOption">Wählen Sie eine Geräteoption.</string>
|
||||
<string name="selectConnectionOption">Wählen Sie eine Verbindungsoption.</string>
|
||||
<string name="ruleDoesntApplyDeviceInRangeButShouldNotBe">Regel trifft nicht zu. Gerät ist in Reichweite, aber sollte nicht sein.</string>
|
||||
<string name="ruleDoesntApplyStateNotCorrect">Regel trifft nicht zu. Falscher Status.</string>
|
||||
<string name="triggerHeadsetPlugged">Headset Verbindung</string>
|
||||
<string name="actionPlayMusic">Musikplayer öffnen</string>
|
||||
<string name="headsetConnected">Headset (type: %1$s) verbunden</string>
|
||||
<string name="headsetConnected">Headset (Art: %1$s) verbunden</string>
|
||||
<string name="headsetDisconnected">Headset (type: %1$s) getrennt</string>
|
||||
<string name="headphoneSimple">Kopfhörer</string>
|
||||
<string name="headphoneMicrophone">Mikrofon</string>
|
||||
<string name="headphoneAny">Egal</string>
|
||||
<string name="headphoneSelectType">Kopfhörer Typ auswählen</string>
|
||||
<string name="ruleDoesntApplyWrongHeadphoneType">Regel trifft nicht zu. Falscher Kopfhörertyp.</string>
|
||||
<string name="ignoringActivityDetectionUpdateTooSoon">Ignoriere Aktivitätserkennungsupdate. Kam früher rein als %1$s Sekunden.</string>
|
||||
<string name="whatsThis">Was ist das?</string>
|
||||
<string name="atLeastRuleXisUsingY">Mindestens Regel \"%1$s\" nutzt einen Auslöser vom Typ \"%2$s\".</string>
|
||||
<string name="privacyLocationingTitle">Private Ortung verwenden</string>
|
||||
<string name="privacyLocationingSummary">Ortungsmethoden vermeiden, die Ihre Position dazu an einen Anbieter übermitteln, z.B. Google. Dies wird nur GPS verwenden und daher langsam sein oder nicht ausreichend zuverlässig funktionieren.</string>
|
||||
<string name="enforcingGps">Private Ortung aktiviert, erzwinge GPS Verwendung.</string>
|
||||
<string name="notEnforcingGps">Private Ortung nicht aktiviert, verwende reguläre Anbieterauswahl.</string>
|
||||
<string name="gpsMeasurement">GPS Messung</string>
|
||||
<string name="gpsMeasurementTimeout">GPS Messung aufgrund Timeout gestoppt.</string>
|
||||
<string name="cellMastChanged">Mobilfunkmast geändert: %1$s</string>
|
||||
<string name="noiseDetectionHint">Wenn Sie denken die Lautstärkeerkennung arbeitet nicht korrekt (abhängig von dem Wert, den Sie angeben), bedenken Sie bitte, daß jedes Telefon unterschiedlich ist. In den Einstellungen können Sie daher die \"Referenz für Lautstärkemessungen\" ändern. Für weitere Informationen siehe http://de.wikipedia.org/wiki/Schalldruckpegel. Sie können den Lautstärkentester vom Hauptbildschirm aus aufrufen, um Ihr Gerät zu kalibrieren.</string>
|
||||
<string name="hint">Hinweis</string>
|
||||
<string name="selectNoiseLevel">Lautstärkepegel auswählen</string>
|
||||
<string name="poiHasWifiStoppingCellLocationListener">Ort hat WLAN. Stoppe CellLocationListener.</string>
|
||||
<string name="poiHasNoWifiNotStoppingCellLocationListener">Ort hat kein WLAN. Stoppe CellLocationListener nicht.</string>
|
||||
<string name="showOnMap">Auf Karte zeigen</string>
|
||||
<string name="noMapsApplicationFound">Auf Ihrem Gerät konnte keine Kartenanwendung gefunden werden.</string>
|
||||
<string name="locationEngineNotActive">Positionsbestimmung nicht aktiv.</string>
|
||||
@ -427,7 +389,7 @@
|
||||
<string name="soundModeNormal">Normal</string>
|
||||
<string name="soundModeVibrate">Vibration</string>
|
||||
<string name="soundModeSilent">Stumm</string>
|
||||
<string name="enterAname">Enter a name!</string>
|
||||
<string name="enterAname">Enter a name.</string>
|
||||
<string name="noChangeSelectedProfileDoesntMakeSense">Keine Veränderungen ausgewählt. Profil macht so keinen Sinn.</string>
|
||||
<string name="noProfilesCreateOneFirst">Es existieren keine Profile. Erstellen Sie erst eins.</string>
|
||||
<string name="errorActivatingProfile">Fehler beim Aktivieren des Profils:</string>
|
||||
@ -448,13 +410,9 @@
|
||||
<string name="noProfileChangeSoundLocked">Profil wird nicht aktiviert. Zuletzt aktiviertes Profil ist gesperrt worden.</string>
|
||||
<string name="currentVolume">Momentane Lautstärke</string>
|
||||
<string name="enterValidReferenceValue">Geben Sie einen gültigen Referenzwert ein.</string>
|
||||
<string name="volumeTest">Lautstärkentest</string>
|
||||
<string name="volumeTesterExplanation">Um einen dB Wert für die Lautstärkemessung zu berechnen müssen Sie einen sogenannten physikalischen Referenzwert angeben. Bitte lesen Sie bei Wikipedia nach, um mehr zu erfahren. Dieser Wert wird höchstwahrscheinlich für jedes Smartphone oder Tablet anders sein, deshalb diese Testanwendung. Verschieben Sie den Regler, um den gegenwärtig definierten Wert zu ändern. Je höher der Referenzwert desto niedriger wird der dB Wert. Es werden alle paar %1$s Sekunden neue Messungen vorgenommen und das Ergebnis unten angezeigt. Drücken Sie den zurück-Button, wenn Sie einen passenden Wert gefunden haben.</string>
|
||||
<string name="volumeTest">Lautstärkekalibrierung</string>
|
||||
<string name="volumeCalibrationExplanation">Um einen dB Wert für die Lautstärkemessung zu berechnen müssen Sie einen sogenannten physikalischen Referenzwert angeben. Bitte lesen Sie bei Wikipedia nach, um mehr zu erfahren. Dieser Wert wird höchstwahrscheinlich für jedes Smartphone oder Tablet anders sein, deshalb diese Testanwendung. Verschieben Sie den Regler, um den gegenwärtig definierten Wert zu ändern. Je höher der Referenzwert desto niedriger wird der dB Wert. Es werden alle paar %1$s Sekunden neue Messungen vorgenommen und das Ergebnis unten angezeigt. Drücken Sie den zurück-Button, wenn Sie einen passenden Wert gefunden haben.</string>
|
||||
<string name="settingsWillTakeTime">Manche Einstellungen können nicht übernommen werden bevor der Dienst neu gestartet wird.</string>
|
||||
<string name="phoneIsRooted">Das Gerät ist gerootet.</string>
|
||||
<string name="phoneIsNotRooted">Das Gerät ist nicht gerootet.</string>
|
||||
<string name="dataConWithRootSuccess">Die Datenverbindung wurde mit superUser Rechten erfolgreich geändert.</string>
|
||||
<string name="dataConWithRootFail">Die Datenverbindung konnte mit superUser Rechten nicht geändert werden.</string>
|
||||
<string name="rootExplanation">Sie müssen Ihr Telefon rooten, damit diese Funktion funktionieren kann. Danach müssen Sie "Regel manuell ausführen", um den SuperUser Berechtigungsdialog zu zeigen. Wenn dieser erscheint, müssen Sie den Haken setzen, der es immer erlaubt. Ansonsten kann die Regel nicht funktionieren, wenn Sie das Telefon gerade nicht benutzen und demnach den nächsten Dialog nicht genehmigen können.</string>
|
||||
<string name="errorWritingConfig">Fehler beim Schreiben der Konfiguration. Gibt es einen beschreibbaren Speicher, und wurde alle Berechtigungen gegeben?</string>
|
||||
<string name="phoneNrReplacementError">Die letzte Telefonnummer konnte nicht in die Variable integriert werden. Sie liegt mir nicht vor.</string>
|
||||
@ -478,7 +436,6 @@
|
||||
<string name="appRequiresPermissiontoAccessExternalStorage">Automation benötigt Rechte, um auf den Speicher zuzugreifen, um seine Konfiguration und Regeln lesen zu können.</string>
|
||||
<string name="mainScreenPermissionNote">Automation benötigt mehr Rechte, um vollständig funktionsfähig zu sein. Klicken Sie auf diesen Text, um mehr zu erfahren und die fehlenden Rechte zu beantragen.</string>
|
||||
<string name="invalidDevice">Ungültiges Gerät</string>
|
||||
<string name="google_app_id">your app id</string>
|
||||
<string name="logFileMaxSizeSummary">Maximale Größe der Protokolldatei in Megabyte. Wenn sie größer wird, wird sie rotiert.</string>
|
||||
<string name="logFileMaxSizeTitle">Maximale Größe des Protokolls [Mb]</string>
|
||||
<string name="android.permission.READ_CALL_LOG">Telefonprotokoll lesen</string>
|
||||
@ -518,14 +475,14 @@
|
||||
<string name="textMessageAnnotations">Sie können direkt eine Telefonnummer eingeben. Alternativ können Sie eine aus Ihren Kontakten auswählen. Aber: Es wird immer die Nummer gespeichert, nicht der Kontakt referenziert. D.h., wenn Sie einmal die Nummer eines Kontaktes ändern, müssen Sie diese Regel aktualisieren.</string>
|
||||
<string name="importNumberFromContacts">Von Kontakten importieren</string>
|
||||
<string name="android9RecordAudioNotice">Falls Sie die Umgebungslautstärke als Auslöser benutzen: Leider hat sich Google entschlossen ab Android Version 9 (Pie) Hintergrundanwendungen den Zugriff auf das Mikrofon zu verweigern. Das bedeutet, dass dieser Auslöser keinen Effekt mehr hat und keine Regeln auslösen wird.</string>
|
||||
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Diese Aktion wird also keinen Effekt auf Ihrem Gerät haben.</string>
|
||||
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Nur, wenn Ihr Gerät gerootet ist, sollte es weiterhin funktionieren. Wenn nicht, wird diese Aktion leider keinen Effekt mehr auf Ihrem Gerät haben.</string>
|
||||
<string name="messageNotShownAgain">Diese Nachricht wird nicht wieder angezeigt.</string>
|
||||
<string name="chooseActivityHint">In diesem letzten Auswahlfeld müssen Sie eine bestimmte \"Activity\" auswählen. Vereinfacht ist das ein bestimmtes Fenster der ausgewählten Anwendung. Wenn Sie nicht wissen, welche Sie auswählen sollen, ist es normalerweise eine gute Idee zunächst welche auszuprobieren, die \"main\" oder \"launcher\" im Namen haben.</string>
|
||||
<string name="edit">Bearbeiten</string>
|
||||
<string name="clickAndHoldForOptions">Klicken und halten Sie ein Objekt für Optionen.</string>
|
||||
<string name="startAutomationAsService">Automation als Dienst starten</string>
|
||||
<string name="setScreenBrightness">Set screen brightness</string>
|
||||
<string name="setScreenBrightnessEnterValue">Enter the desired brightness (from 0 to 100).</string>
|
||||
<string name="setScreenBrightness">Bildschirmhelligkeit einstellen</string>
|
||||
<string name="setScreenBrightnessEnterValue">Geben Sie den gewünschten Helligkeitswert ein (von 0 bis 100).</string>
|
||||
<string name="autoBrightness">Automatische Helligkeitseinstellung verwenden</string>
|
||||
<string name="apply">übernehmen</string>
|
||||
<string name="brightnessAuto">automatische Helligkeit</string>
|
||||
@ -540,7 +497,7 @@
|
||||
<string name="manageLocations">Orte anlegen oder ändern</string>
|
||||
<string name="publishedOn">veröffentlicht am</string>
|
||||
<string name="filesHaveBeenMovedTo">Automation benutzt jetzt ein anderes Verzeichnis, um Ihre Daten zu speichern. Alle Ihre Automation-Dateien wurden hierhin verschoben: \"%s\". Die Berechtigung für den externen Speicher wird nun nicht mehr benötigt; Sie können Sie entfernen. In einer künftigen Version wird sie entfernt werden.</string>
|
||||
<string name="locationEngineDisabledShort">Die Position kann nicht mehr bestimmt werden.</string>
|
||||
<string name="locationEngineDisabledShort">Die Position kann nicht mehr im Hintergrund bestimmt werden. Klicken Sie hier für mehr Infos.</string>
|
||||
<string name="locationEngineDisabledLong">Leider kann die Position nicht mehr bestimmt werden. Großer Dank dafür geht an Google für seine unendliche Weisheit und Großzügigkeit.\\n\\nBeginnend mit Android 10 wurde eine neue Berechtigung eingeführt, die benötigt wird, um als App die Position auch im Hintergrund bestimmen zu können, was, für eine App wie diese, natürlich notwendig ist.\\n\\nWährend ich das grundsätzlich für eine gute Idee halte, gilt das nicht für die Schikanen, die man Entwicklern damit zumutet.\\n\\nWenn man eine App entwickelt, kann man versuchen sich für diese Berechtigung zu qualifizieren, indem man einen Katalog von Bedingungen erfüllt. Leider wurden neue Versionen meiner Anwendung über einen Zeitraum von drei Monaten immer wieder abgelehnt.\\n\\nDas lief auf die immer gleiche Art ab:\\n\\nIch habe eine neue Version eingereicht, die all diese Anforderungen erfüllt hat.\\n\\nGoogles miserabler Entwickler-Support behauptete ich würde sie nicht einhalten.\\n\\nIch habe Beweise geliefert, daß ich alles einhalte.<br />Ich bekam eine Antwort wie "Ich kann Ihnen nicht weiterhelfen.\\n\\nIrgendwann habe ich aufgegeben.\\n\\nDie Folge davon ist nun, daß die Google Play Version keine Positionsbestimmung mehr im Hintergrund durchführen kann. Meine einzige Alternative wäre es gewesen, daß die ganze Anwendung aus dem Store fliegt.\\n\\nDas tut mir sehr leid, aber ich habe mein Bestes gegeben mit einem Kunden\"dienst\" zu diskutieren, der mehrfach beim Turing-Test durchgefallen ist.\\n\\nDie gute Nachricht: Die Anwendung kann es immer noch!\\n\\nAutomation ist nun Open Source Software und kann ab sofort bei F-Droid heruntergeladen werden. F-Droid ist ein freier Appstore, der Ihre Privatsphäre respektiert - statt nur so zu tun wie Google das macht.\\n\\nSichern Sie Ihre Konfiguratinsdatei, deinstallieren Sie dazu diese Anwendung, installieren sie von F-Droid neu, Konfigurationsdatei zurückspielen und fertig.\\n\\nKlicken Sie hier, um mehr herauszufinden:</string>
|
||||
<string name="filesStoredAt">Konfigurations- und Logdateien werden hier gespeichert: %1$s. Klicken Sie hier auf diesen Text, um dieses Verzeichnis in einem Datei-Explorer zu öffnen. Leider funktioniert das nur auf gerooteten Geräten.\n\nFür alle anderen Geräte: Benutzen Sie einfach den Export Button, wenn Sie eine Sicherung anlegen wollen.</string>
|
||||
<string name="directionStringEquals">ist gleich</string>
|
||||
@ -578,10 +535,9 @@
|
||||
<string name="shareConfigAndLogFilesWithDev">Konfigurations- und Logdatei mit Entwickler teilen (via email).</string>
|
||||
<string name="shareConfigAndLogExplanation">Dies wird eine neue Email öffnen mit Konfigurations- und Logdateien als Zip-Anhang. Sie wird nicht automatisch versendet. D.h. Sie können so z.B. auch den Adressaten zu sich selbst ändern.</string>
|
||||
<string name="notificationTriggerExplanation">Dieser Auslöser reagiert auf Benachrichtigungen anderer Anwendung im Benachrichtigungsbereich von Android (oder wenn diese geschlossen werden). Sie können eine bestimmte Anwendung festlegen, von die Nachricht stammen muß. Wenn nicht, zählt jede Benachrichtigung. Sie können auch Zeichenketten für Titel oder Nachrichteninhalt festlegen, die enthalten sein müssen. Die Groß-/Kleinschreibung wird hierbei nicht berücksichtigt.</string>
|
||||
<string name="ruleActivationComplete">Regel \"%1$s\" wurde fertig ausgeführt.</string>
|
||||
<string name="addParameters">Parameter hinzufügen</string>
|
||||
<string name="errorRunningRule">Fehler beim Ausführen einer Regel.</string>
|
||||
<string name="startAppChoiceNote">Hier haben Sie 2 grundsätzliche Optionen:\n\n1. Sie können ein Programm starten, indem Sie eine Activity auswählen.\nStellen Sie sich das so vor, daß Sie ein bestimmtes Fenster einer Anwendung vorauswählen, in das man direkt springt. Behalten Sie im Kopf, daß das nicht immer funktionieren wird. Das liegt daran, daß die Fenster einer Anwendung miteinander interagieren können, sich u.U. Parameter übergeben. Wenn man jetzt ganz kalt in ein bestimmtes Fenster springt, könnte dieses zum Start z.B. bestimmte Parameter erwarten - die fehlen. So könnte es passieren, daß das Fenster zwar versucht zu öffnen, das aber nicht klappt und es somit nie wirlich sichtbar wird. Versuchen Sie\'s trotzdem!\nSie können den Pfad manuell eingeben, sollten aber den Auswählen-Knopf benutzen. Wenn Sie es dennoch manuell eingeben, geben Sie den PackageName ins obere Feld ein und den vollen Pfad der Activity ins untere.\n\n2. Auswahl per Action\nIm Gegensatz zur Auswahl eines bestimmten Fensters, können Sie ein Programm auch über eine Action starten lassen. Stellen Sie sich das so vor als würden Sie in den Wald rufen \"Ich hätte gerne XYZ\" und falls eine Anwendung installiert ist, die das liefern kann, wird sie gestartet. Ein gutes Beispiel wäre zum Beispiel "Browser starten" - es könnten sogar mehrere installiert sein, die das können (aber normalerweise gibts eine, die als Standard eingestellt ist).\nDiese Action müssen Sie manuell eingeben. Der PackageName ist hier optional. Behalten Sie dabei im Auge, daß mögliche Variablen nicht aufgelöst werden. Beispielsweise werden Sie häufig im Internet finden, daß man die Kamera über die Action \"MediaStore.ACTION_IMAGE_CAPTURE\" starten kann. Das ist grundsätzlich nicht richtig, wird aber nicht direkt funktionieren, denn das ist nur eine Variable. Sie müssen dann einen Blick in die Android Dokumentation werfen, wo Sie sehen werden, daß sich hinter dieser Variable eigentlich der Wert \"android.media.action.IMAGE_CAPTURE\" verbirgt. Gibt man diesen in das Feld ein, wird\'s funktionieren.</string>
|
||||
<string name="startAppChoiceNote">Hier haben Sie 2 grundsätzliche Optionen:\n\n1. Sie können ein Programm starten, indem Sie eine Activity auswählen.\nStellen Sie sich das so vor, daß Sie ein bestimmtes Fenster einer Anwendung vorauswählen, in das man direkt springt. Behalten Sie im Kopf, daß das nicht immer funktionieren wird. Das liegt daran, daß die Fenster einer Anwendung miteinander interagieren können, sich u.U. Parameter übergeben. Wenn man jetzt ganz kalt in ein bestimmtes Fenster springt, könnte dieses zum Start z.B. bestimmte Parameter erwarten - die fehlen. So könnte es passieren, daß das Fenster zwar versucht zu öffnen, das aber nicht klappt und es somit nie wirlich sichtbar wird. Versuchen Sie\'s trotzdem!\nSie können den Pfad manuell eingeben, sollten aber den Auswählen-Knopf benutzen. Wenn Sie es dennoch manuell eingeben, geben Sie den PackageName ins obere Feld ein und den vollen Pfad der Activity ins untere.\n\n2. Auswahl per Action\nIm Gegensatz zur Auswahl eines bestimmten Fensters, können Sie ein Programm auch über eine Action starten lassen. Stellen Sie sich das so vor als würden Sie in den Wald rufen \"Ich hätte gerne XYZ\" und falls eine Anwendung installiert ist, die das liefern kann, wird sie gestartet. Ein gutes Beispiel wäre zum Beispiel "Browser starten" - es könnten sogar mehrere installiert sein, die das können (aber normalerweise gibts eine, die als Standard eingestellt ist).\nDiese Action müssen Sie manuell eingeben. Der PackageName ist hier optional. Behalten Sie dabei im Auge, daß mögliche Variablen nicht aufgelöst werden. Beispielsweise werden Sie häufig im Internet finden, daß man die Kamera über die Action \"MediaStore.ACTION_IMAGE_CAPTURE\" starten kann. Das ist grundsätzlich richtig, wird aber nicht direkt funktionieren, denn das ist nur eine Variable. Sie müssen dann einen Blick in die Android Dokumentation werfen, wo Sie sehen werden, daß sich hinter dieser Variable eigentlich der Wert \"android.media.action.IMAGE_CAPTURE\" verbirgt. Gibt man diesen in das Feld ein, wird\'s funktionieren.</string>
|
||||
<string name="cantFindSoundFile">Kann die Audiodatei %1$s nicht finden und daher auch nicht abspielen.</string>
|
||||
<string name="startAppByActivity">per Activity</string>
|
||||
<string name="startAppByAction">per Action</string>
|
||||
@ -621,4 +577,86 @@
|
||||
<string name="loadWifiList">WLAN Liste laden</string>
|
||||
<string name="noKnownWifis">Es gibt keine bekannten WLANs auf Ihrem Gerät.</string>
|
||||
<string name="needLocationPermForWifiList">Die Liste von WLANs auf Ihrem Gerät könnte verwendet werden, um zu ermitteln, an welchen Orten Sie waren. Deshalb ist die Positions-Berechtigung nötig, um die Liste dieser WLANs zu laden. Wenn Sie eines aus der Liste auswählen möchten, müssen Sie diese Berechtigung gewähren. Wenn nicht, können Sie immer noch eines manuell eingeben.</string>
|
||||
<string name="urlToTriggerExplanation">Diese Funktion öffnet NICHT den Browser, sondern löst die HTTP Anfrage im Hintergrund aus. Sie können das z.B. benutzen, um Befehle an Ihre Heimautomatisierung zu schicken.</string>
|
||||
<string name="clone">Klonen</string>
|
||||
<string name="updateAvailable">Es gibt eine neue Version der Anwendung. Möchten Sie den Browser öffnen, um sie herunterzuladen?</string>
|
||||
<string name="automaticUpdateCheckSummary">Nur bei der APK Version.</string>
|
||||
<string name="automaticUpdateCheck">Nach Updates suchen</string>
|
||||
<string name="locationFound">Position gefunden. Der vorgeschlagene Mindestradius für Orte beträgt %1$d m.</string>
|
||||
<string name="locationFoundInaccurate">Es konnte nur eine ungenaue Position gefunden werden. Das funktioniert u.U. nicht zuverlässig. Der vorgeschlagene Mindestradius für Orte beträgt %1$d m.</string>
|
||||
<string name="pleaseGiveBgLocation">Gehen Sie auf dem nächsten Bildschirm bitte auf Berechtigungen, dann Position. Wählen Sie dort Immer erlauben aus, um Automation zu ermöglichen, die Position im Hintergrund zu ermitteln.</string>
|
||||
<string name="noLocationCouldBeFound">Leider konnte nach einem Limit von %1$s Sekunden keine Position gefunden werden.</string>
|
||||
<string name="vibrate">Vibrieren</string>
|
||||
<string name="test">Ausprobieren</string>
|
||||
<string name="VibrateExplanation">Geben Sie eine Vibrationsdauer, gefolgt von einem Komma ein, dann eine Pausendauer. Sie können so viele Vibrationen eingeben, wie sie möchten. Trennen Sie sie wieder mit Kommata.\nZ.B. wird das Muster 100,500,500,1000,100 100ms vibrieren, 500ms warten, 500ms vibrieren, 1000ms warten, 100ms vibrieren.\nWenn Sie denken, daß eine Vibration verschluckt wird, verlängern Sie die Pause vor ihr.</string>
|
||||
<string name="pleaseEnterValidVibrationPattern">Bitte geben Sie ein gültiges Vibrationsmuster ein.</string>
|
||||
<string name="tabsPlacement">Position der Tableiste</string>
|
||||
<string name="top">Oben</string>
|
||||
<string name="bottom">Unten</string>
|
||||
<string name="tabsPlacementSummary">Wol soll die Taskleiste angezeigt werden?</string>
|
||||
<string name="tones">Klingeltöne</string>
|
||||
<string name="miscellaneous">Verschiedenes</string>
|
||||
<string name="dnd">Nicht stören</string>
|
||||
<string name="dndOff">Nicht stören aus</string>
|
||||
<string name="dndAlarms">Alarme durchlassen</string>
|
||||
<string name="dndPriority">Prioritätsbenachrichtigungen durchlassen</string>
|
||||
<string name="dndNothing">Nichts durchlassen</string>
|
||||
<string name="repeatEveryXseconds">Alle x Sekunden wiederholen</string>
|
||||
<string name="repeatEveryXsecondsWithVariable">alle %1$s Sekunden wiederholen</string>
|
||||
<string name="donate">Spenden</string>
|
||||
<string name="notice">Hinweis</string>
|
||||
<string name="automationNotificationsIgnored">Wenn Sie keine bestimmte Anwendung auswählen, werden Benachrichtigungen von Automation selbst ignoriert, um Schleifen zu verhindern.</string>
|
||||
<string name="elementSkipped">Ein Element der Konfigurationsdatei konnte nicht gelesen werden. Die Datei könnte von einer neueren Programmversion erstellt worden sein.</string>
|
||||
<string name="permissionsRequiredNotAvailable">Ihre Regeln benötigen Berechtigungen, die die installierte Variante von Automation nicht unterstützt.</string>
|
||||
<string name="dndRemarks">Feineinstellungen (wie Telefonanrufe erlauben, Auswählen bestimmter Telefonnummern, etc.) können nur in den Systemeinstellungen gesetzt werden.</string>
|
||||
<string name="wifiApi30">Weil Google wieder einen weiteren Teil von Android kaputt gemacht hat, können ab API 30 nur noch jede WLANs angezeigt werden, die sich gegenwärtig in Reichweite befinden, nicht mehr alle, zu denen das Gerät einmal verbunden war.</string>
|
||||
<string name="smsDialogNotice">Wenn Sie in diesem Programm noch keine SMS-senden Aktion benutzt haben, zeigt Android wahrscheinlich beim ersten Ausführen einen Bestätigungsdialog an. Sie müssen das Häkchen bei \"Immer erlauben\" setzen und bestätigen, wenn Sie möchten, daß diese Aktion im Hintergrund ausgeführt werden kann. Es wird daher empfohlen, diese Regel einmalig manuell auszuführen, um diesen Dialog zu provozieren.</string>
|
||||
<string name="silentTriggersDnd">Hinweis: Der Stumm-Modus löst auf neuren Geräten häufig die Funktion \"Nicht stören\" aus. Wenn das auf Ihrem Gerät passiert, wird empfohlen stattdessen den Normalen Modus zu verwenden und alle Lautstärken auf 0 zu reduzieren.</string>
|
||||
<string name="deviceOrientation">Geräteausrichtung</string>
|
||||
<string name="tolerance">Toleranz (0-180)</string>
|
||||
<string name="orientationAzimuth">Azimut:</string>
|
||||
<string name="orientationPitch">Neigung:</string>
|
||||
<string name="enterValidNumbersIntoAllFields">Geben Sie gültige Nummern in allen Feldern ein.</string>
|
||||
<string name="orientationRoll">Rollen:</string>
|
||||
<string name="wouldCurrentlyApply">Würde gerade zutreffen?</string>
|
||||
<string name="deviceIsInCertainOrientation">Das Gerät hat eine bestimmte Ausrichtung</string>
|
||||
<string name="toleranceOf180OnlyAllowedIn2Fields">Eine Toleranz von 180 ist nur für zwei Toleranz-Felder erlaubt, nicht alle drei. Andernfalls würde der Auslöser immer zutreffen.</string>
|
||||
<string name="unknown">unbekannt</string>
|
||||
<string name="orientation">Ausrichtung</string>
|
||||
<string name="turnScreenOnOrOff">Bildschirm ein- oder ausschalten</string>
|
||||
<string name="turnScreenOn">Bildschirm einschalten</string>
|
||||
<string name="turnScreenOff">Bildschirm ausschalten</string>
|
||||
<string name="mustApply">Muß zutreffen</string>
|
||||
<string name="deviceOrientationTimeAcceptIntervalTitle">Signal Häufigkeit</string>
|
||||
<string name="deviceOrientationTimeAcceptIntervalSummary">Neue Signale nur alle x Millisekunden akzeptieren</string>
|
||||
<string name="deviceOrientationSettings">Geräteausrichtungseinstellungen</string>
|
||||
<string name="explanationDeviceOrientationDirection">Wenn das Häkchen gesetzt ist, bedeutet das, daß das Gerät in der angegebenen Ausrichtung sein muß. Wenn es nicht gesetzt ist, führt jede andere Ausrichtung zu einem positiven Ergebnis.</string>
|
||||
<string name="deviceOrientationExplanation">Wenn Sie Ihr Gerät bewegen, werden die Zahlen unten aktualisiert. Was Sie hier sehen können, ist die momentane Ausrichtung Ihres Geräts, gemessen in Grad. Wenn das Gerät in der gewünschten Ausrichtung ist, klicken Sie den \"übernehmen\" Knopf, um die Werte in die \"gewünscht\" Felder zu übertragen.\nWeil es sehr unwahrscheinlich ist, daß Sie diese exakte Ausrichtung jemals wieder erreichen, müssen Sie Toleranzen eingeben. Dies ist der Winkel in Grad, der in jede Richtung noch akzeptiert wird. 15° entsprechen somit einem Gesamtwinkel von 30°, 15 in jede Richtung.\nWenn Ihnen nur eine bestimmte Achse wichtig ist, können Sie eine Toleranz von 180° für die anderen beiden Richtungen angeben.</string>
|
||||
<string name="actionSetBluetoothTethering">Bluetooth Tethering</string>
|
||||
<string name="actionTurnBluetoothTetheringOn">Bluetooth Tethering einschalten</string>
|
||||
<string name="actionTurnBluetoothTetheringOff">Bluetooth Tethering ausschalten</string>
|
||||
<string name="enterRepetitionTime">Sie müssen eine positive Ganzzahl als Wiederholungszeit eingeben.</string>
|
||||
<string name="btTetheringNotice">Diese Funktion funktioniert bestätigt bis einschließlich Android 8.0. Ab einer höheren Version funktioniert sie nicht mehr, aber ich ich kann mangels physischer Geräte nicht sagen, aber welcher genau. Unter Android 11 funktioniert es definitiv nicht mehr. Wenn Sie eine Version dazwischen haben, lassen Sie mich bitte wissen, ob es funktioniert oder nicht.</string>
|
||||
<string name="triggerWrong">Mit diesem Auslöser stimmt etwas nicht. Er konnte nicht korrekt geladen werden.</string>
|
||||
<string name="android.permission.BIND_DEVICE_ADMIN">Geräte Administrator</string>
|
||||
<string name="deviceAdminNote">Geräte Administrator Rechte werden für mindestens 1 Regel benötigt, die Sie angelegt haben.</string>
|
||||
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Von der Akku-Optimierung ausschließen</string>
|
||||
<string name="recommendedForBetterReliability">Empfohlen für bessere Zuverlässigkeit</string>
|
||||
<string name="needsToBeActive">Muß aktiv sein</string>
|
||||
<string name="checkSettings">Einstellungen überprüfen</string>
|
||||
<string name="profileActive">Profil %1$s ist aktiv</string>
|
||||
<string name="profileNotActive">Profil %1$s ist nicht aktiv</string>
|
||||
<string name="profileTriggerCheckSettings">Wenn dieses Häkchen nicht gesetzt ist, wird nur geprüft, ob das ausgewählte Profil zuletzt aktiviert wurde. Es ist egal, ob Audio-Einstellungen von außerhalb verändert wurden.\nWenn das Häkchen aber gesetzt ist, müssen die aktuellen Audio-Einstellungen auch wirklich genau so gesetzt sein, wie im Profil definiert. ACHTUNG: Der Klingelton selbst kann derzeit noch nicht überprüft werden.</string>
|
||||
<string name="profileCouldNotBeDeleted">Profil konnte nicht gelöscht werden.</string>
|
||||
<string name="ruleXIsUsingProfileY">Dieses Profil kann nicht gelöscht werden. Regel %s$1 verwendet noch Profil %s$2.</string>
|
||||
<string name="noRepetition">keine Wiederholung</string>
|
||||
<string name="usingAuthentication">mit Authentifizierung</string>
|
||||
<string name="toNumber">zu Nummer</string>
|
||||
<string name="message">Nachricht</string>
|
||||
<string name="onDays">an Tagen</string>
|
||||
<string name="notSet">nicht gesetzt</string>
|
||||
<string name="takeLauncherActivity">Automatisch auswählen</string>
|
||||
<string name="pickActivityManually">Manuell auswählen</string>
|
||||
<string name="launcherOrManualExplanation">Einfacher Modus: Automation kann versuchen, die Start-Activity des Zielprogramms automatisch zu finden.\nAlternativ können Sie die gewünschte Activity auch manuell auswählen.\nWelche Variante möchten Sie?</string>
|
||||
<string name="launcherNotFound">Eine Start-Activity dieser Anwendung konnte nicht gefunden werden. Sie müssen manuell eine auswählen.</string>
|
||||
</resources>
|
@ -1,20 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="ruleActivate">Estoy activando norma %1$s</string>
|
||||
<string name="ruleActivate">Estoy activando regla %1$s</string>
|
||||
<string name="profileActivate">Estoy activando perfil %1$s</string>
|
||||
<string name="ruleActivateToggle">Estoy activando norma %1$s en el modo del invertir</string>
|
||||
<string name="ruleActivateToggle">Estoy activando regla %1$s en el modo de invertir</string>
|
||||
<string name="addPoi">Crear sitio</string>
|
||||
<string name="addRule">Crear norma</string>
|
||||
<string name="addRule">Crear regla</string>
|
||||
<string name="poiList">Lista de sitios:</string>
|
||||
<string name="ruleList">Lista de normas:</string>
|
||||
<string name="ruleList">Lista de reglas:</string>
|
||||
<string name="pleaseEnterValidName">Inserte un nombre válido, por favor.</string>
|
||||
<string name="pleaseSpecifiyTrigger">Inserta al menos una condición, por favor.</string>
|
||||
<string name="pleaseSpecifiyAction">Inserta al menos una acción, por favor.</string>
|
||||
<string name="serviceWontStart">No hay normas definidas. Servicio no enciende.</string>
|
||||
<string name="pleaseSpecifiyTrigger">Inserte al menos una condición, por favor.</string>
|
||||
<string name="pleaseSpecifiyAction">Inserte al menos una acción, por favor.</string>
|
||||
<string name="serviceWontStart">No hay reglas definidas. Servicio no enciende.</string>
|
||||
<string name="serviceStarted">Automation servicio ha iniciado.</string>
|
||||
<string name="version">Versión %1$s.</string>
|
||||
<string name="distanceBetween">Distancia entre el sitio GPS y el sitio red está %1$d metros. Este +1m debe ser el minimo.</string>
|
||||
<string name="comparing">Tengo tanto sitio red como sitio gps. Estoy comparando...</string>
|
||||
<string name="distanceBetween">Distancia entre el sitio GPS y el sitio red está %1$d metros. Este +1m debe ser el mínimo.</string>
|
||||
<string name="positioningWindowNotice">Si está en una edificación vaya cerca de una ventana hasta que una posición haya sido encontrada. Sino podria durar mucho tiempo o no seria posible.</string>
|
||||
<string name="gettingPosition">Buscando posición. Espere, por favor...</string>
|
||||
<string name="yes">Si</string>
|
||||
@ -25,19 +24,15 @@
|
||||
<string name="thursday">Jueves</string>
|
||||
<string name="friday">Viernes</string>
|
||||
<string name="saturday">Sábado</string>
|
||||
<string name="headphoneMicrophone">Microfóno</string>
|
||||
<string name="whatsThis">Que es eso?</string>
|
||||
<string name="headphoneMicrophone">Micrófono</string>
|
||||
<string name="whatsThis">Qué es esto?</string>
|
||||
<string name="privacyLocationingTitle">Solo usar localización privada</string>
|
||||
<string name="privacyLocationingSummary">Avoid locationing methods that may send your location to a provider, e.g. Google. This will use GPS only and may therefore be slow or not work reliably.</string>
|
||||
<string name="enforcingGps">Private Locationing enabled, enforcing GPS use.</string>
|
||||
<string name="notEnforcingGps">Private Locationing not enabled, using regular provider search.</string>
|
||||
<string name="volumeAlarms">Alarmas</string>
|
||||
<string name="change">modificar</string>
|
||||
<string name="soundModeNormal">Normal</string>
|
||||
<string name="soundModeVibrate">Vibración</string>
|
||||
<string name="soundModeSilent">Silencio</string>
|
||||
<string name="enterAname">Enter a name!</string>
|
||||
<string name="noChangeSelectedProfileDoesntMakeSense">No change selected. Profile doesn\'t make sense.</string>
|
||||
<string name="enterAname">Inserte un nombre.</string>
|
||||
<string name="username">Nombre de usuario</string>
|
||||
<string name="ok">Ok</string>
|
||||
<string name="continueText">continuar</string>
|
||||
@ -47,17 +42,17 @@
|
||||
<string name="ruleXrequiresThis">Regla \"%1$s\" lo necesita.</string>
|
||||
<string name="sendTextMessage">Enviar mensaje SMS</string>
|
||||
<string name="importNumberFromContacts">Importar número del directorio</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="textToSend">Texto de enviar</string>
|
||||
<string name="edit">Editar</string>
|
||||
<string name="textToSend">Texto para enviar</string>
|
||||
<string name="password">Contraseña</string>
|
||||
<string name="showOnMap">Monstrar en una mapa</string>
|
||||
<string name="headphoneAny">Igual</string>
|
||||
<string name="showOnMap">Mostrar en un mapa</string>
|
||||
<string name="headphoneAny">Cualquier</string>
|
||||
<string name="sunday">Domingo</string>
|
||||
<string name="pleaseEnterValidLatitude">Por favor inserte un grado de latitud válido.</string>
|
||||
<string name="pleaseEnterValidLongitude">Por favor inserte un grado de longitud válido.</string>
|
||||
<string name="pleaseEnterValidRadius">Por favor inserte un radio válido.</string>
|
||||
<string name="selectOneDay">Por favor seleccione al menos un dia.</string>
|
||||
<string name="whatToDoWithRule">Hacer que con la norma?</string>
|
||||
<string name="selectOneDay">Por favor seleccione al menos un día.</string>
|
||||
<string name="whatToDoWithRule">Hacer que con la regla?</string>
|
||||
<string name="whatToDoWithPoi">Hacer que con el sitio?</string>
|
||||
<string name="whatToDoWithProfile">Hacer que con el perfil?</string>
|
||||
<string name="delete">eliminar</string>
|
||||
@ -65,7 +60,7 @@
|
||||
<string name="serviceStopped">Servicio automation terminado.</string>
|
||||
<string name="logServiceStopping">Terminando servicio.</string>
|
||||
<string name="stillGettingPosition">Todavia buscando posición</string>
|
||||
<string name="lastRule">Última norma:</string>
|
||||
<string name="lastRule">Última regla:</string>
|
||||
<string name="at">el</string>
|
||||
<string name="service">Servicio:</string>
|
||||
<string name="getCurrentPosition">Buscar posición actual</string>
|
||||
@ -73,14 +68,14 @@
|
||||
<string name="deletePoi">Eliminar posición</string>
|
||||
<string name="latitude">Latitud</string>
|
||||
<string name="longitude">Longitud</string>
|
||||
<string name="ruleName">Nombre de la norma</string>
|
||||
<string name="ruleName">Nombre de la regla</string>
|
||||
<string name="triggers">Condición(es)</string>
|
||||
<string name="triggersComment">y-conectado (todo tiene que aplicar al mismo tiempo)</string>
|
||||
<string name="addTrigger">Añadir condición</string>
|
||||
<string name="actions">Acción(es)</string>
|
||||
<string name="actionsComment">(ejecutado en esta orden)</string>
|
||||
<string name="addAction">Añadir acción</string>
|
||||
<string name="saveRule">Guardar norma</string>
|
||||
<string name="saveRule">Guardar regla</string>
|
||||
<string name="start">Inicio</string>
|
||||
<string name="end">Final</string>
|
||||
<string name="save">Guardar</string>
|
||||
@ -93,7 +88,7 @@
|
||||
<string name="noPoisSpecified">Primero tiene que crear sitios.</string>
|
||||
<string name="selectPoi">Seleccionar sitio</string>
|
||||
<string name="selectTypeOfAction">Seleccione tipo de la acción</string>
|
||||
<string name="connected">connectado</string>
|
||||
<string name="connected">conectado</string>
|
||||
<string name="stopped">terminado</string>
|
||||
<string name="started">Comenzado</string>
|
||||
<string name="disconnected">desconectado</string>
|
||||
@ -101,13 +96,13 @@
|
||||
<string name="whatToDoWithTrigger">Hacer que con la condición?</string>
|
||||
<string name="whatToDoWithAction">Hacer que con la acción?</string>
|
||||
<string name="radiusHasToBePositive">Radio tiene que ser un número positivo.</string>
|
||||
<string name="poiStillReferenced">Todavia hay normas que usan este sitio (%1$s). No puedo eliminarlo.</string>
|
||||
<string name="poiStillReferenced">Todavia hay reglas que usan este sitio (%1$s). No puedo eliminarlo.</string>
|
||||
<string name="generalSettings">Configuración general.</string>
|
||||
<string name="startAtSystemBoot">Iniciar al boot.</string>
|
||||
<string name="writeLogFile">Escribir un archivo protocolo</string>
|
||||
<string name="wifiState">Estado wifi</string>
|
||||
<string name="showHelp">Descripción</string>
|
||||
<string name="rules">Normas</string>
|
||||
<string name="rules">Reglas</string>
|
||||
<string name="timeframes">Intervalo</string>
|
||||
<string name="helpTitleEnergySaving">Configuración de ahorro de energia</string>
|
||||
<string name="speedMaximumTime">Tiempo en minutos</string>
|
||||
@ -136,53 +131,53 @@
|
||||
<string name="closestPoi">sitio mas cerca</string>
|
||||
<string name="poi">Posición</string>
|
||||
<string name="pois">posiciónes</string>
|
||||
<string name="serviceNotRunning">Servicio not esta activo</string>
|
||||
<string name="serviceNotRunning">Servicio no está activo</string>
|
||||
<string name="general">General</string>
|
||||
<string name="startServiceAfterAppUpdate">Encender servicio después un update si estuve activado</string>
|
||||
<string name="startServiceAfterAppUpdateShort">Encender servicio después un update</string>
|
||||
<string name="startServiceAfterAppUpdate">Encender servicio después de un update si estuvo activado.</string>
|
||||
<string name="startServiceAfterAppUpdateShort">Encender servicio después de un update</string>
|
||||
<string name="cancel">Cancelar</string>
|
||||
<string name="wifiName">Nombre de wifi</string>
|
||||
<string name="wifiConnection">Coneción a un wifi</string>
|
||||
<string name="exceeding">exedendo</string>
|
||||
<string name="droppingBelow">estendo menos que</string>
|
||||
<string name="anyWifi">algun wifi</string>
|
||||
<string name="selectApplication">Elega la app</string>
|
||||
<string name="selectPackageOfApplication">Elega el paquete de la app</string>
|
||||
<string name="selectActivityToBeStarted">Elega la actividad de la app</string>
|
||||
<string name="wifiConnection">Conexión a un wifi</string>
|
||||
<string name="exceeding">excediendo</string>
|
||||
<string name="droppingBelow">estando menos que</string>
|
||||
<string name="anyWifi">algún wifi</string>
|
||||
<string name="selectApplication">Elija app</string>
|
||||
<string name="selectPackageOfApplication">Elija el paquete de la app</string>
|
||||
<string name="selectActivityToBeStarted">Elija la actividad de la app</string>
|
||||
<string name="errorStartingOtherActivity">Error encendiendo otra app</string>
|
||||
<string name="startAppBySendBroadcast">con sendBroadcast()</string>
|
||||
<string name="startAppByStartActivity">con startActivity()</string>
|
||||
<string name="stringNotAllowed">String %1$s not esta permitido.</string>
|
||||
<string name="noFilesImported">No pudo importar archivos.</string>
|
||||
<string name="noApplicableFilesFoundInDirectory">No pudo encontrar archivos.</string>
|
||||
<string name="prefsImportError">Hubo un error en importar la configuracion.</string>
|
||||
<string name="configurationImportedSuccessfully">Importe la configuracion con éxito.</string>
|
||||
<string name="prefsImportError">Hubo un error durante la importación de la configuración.</string>
|
||||
<string name="configurationImportedSuccessfully">La configuracion está importada con éxito.</string>
|
||||
<string name="importConfiguration">Importar configuracion</string>
|
||||
<string name="exportConfiguration">Exportar configuracion</string>
|
||||
<string name="startAppSelectionType">Método de elegir applicación</string>
|
||||
<string name="startAppSelectionType">Método de elegir aplicación</string>
|
||||
<string name="addParameters">Añade parametrós</string>
|
||||
<string name="fileDoesNotExist">Archivo no exista.</string>
|
||||
<string name="selectSoundFile">Elija archivo sonido</string>
|
||||
<string name="alwaysPlay">siempre tocar</string>
|
||||
<string name="playSound">Tocar sonido</string>
|
||||
<string name="fileDoesNotExist">Archivo no existe.</string>
|
||||
<string name="selectSoundFile">Elegir archivo sonido</string>
|
||||
<string name="alwaysPlay">reproducir siempre</string>
|
||||
<string name="playSound">Reproducir sonido</string>
|
||||
<string name="direction">dirección</string>
|
||||
<string name="anyApp">alguna app</string>
|
||||
<string name="anyApp">cualquier app</string>
|
||||
<string name="directionStringNotEquals">no es igual a</string>
|
||||
<string name="directionStringStartsWith">comenza con</string>
|
||||
<string name="directionStringStartsWith">comienza con</string>
|
||||
<string name="directionStringEndsWith">termina con</string>
|
||||
<string name="directionStringContains">incluye</string>
|
||||
<string name="directionStringEquals">es igual a</string>
|
||||
<string name="text">Texto</string>
|
||||
<string name="title">Titulo</string>
|
||||
<string name="notification">Notificaión</string>
|
||||
<string name="locationDisabled">Localización desactivado</string>
|
||||
<string name="title">Título</string>
|
||||
<string name="notification">Notificación</string>
|
||||
<string name="locationDisabled">Localización desactivada</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="android.permission.ACCESS_BACKGROUND_LOCATION">Determinar su posición en el contexto</string>
|
||||
<string name="manageLocations">Crear p editar sitios</string>
|
||||
<string name="startScreen">Ventana incial</string>
|
||||
<string name="android.permission.ACCESS_BACKGROUND_LOCATION">Determinar su posición en el fondo.</string>
|
||||
<string name="manageLocations">Crear o editar sitios</string>
|
||||
<string name="startScreen">Ventana de inicio</string>
|
||||
<string name="positioningEngine">Metodo de localización</string>
|
||||
<string name="deviceDoesNotHaveBluetooth">Este dispositivo no tiene Bluetooth. Puede continuar pero probablemente no va a funciónar.</string>
|
||||
<string name="android.permission.READ_CALL_LOG">Leer protocolo de teléfono</string>
|
||||
<string name="android.permission.READ_CALL_LOG">Leer protocolo de llamadas</string>
|
||||
<string name="android.permission.READ_CALENDAR">Leer calendario</string>
|
||||
<string name="android.permission.ACCESS_FINE_LOCATION">Determinar la posición exacta</string>
|
||||
<string name="android.permission.ACCESS_COARSE_LOCATION">Determinar la posición aproximada</string>
|
||||
@ -192,119 +187,118 @@
|
||||
<string name="android.permission.VIBRATE">Vibrar</string>
|
||||
<string name="android.permission.MODIFY_AUDIO_SETTINGS">Modificar la configuración sonida</string>
|
||||
<string name="android.permission.RECORD_AUDIO">Grabar audio</string>
|
||||
<string name="android.permission.PROCESS_OUTGOING_CALLS">Detecar llamados saliendos</string>
|
||||
<string name="android.permission.READ_PHONE_STATE">Detecar el estado del dispositivo</string>
|
||||
<string name="android.permission.READ_EXTERNAL_STORAGE">Leer la memoria</string>
|
||||
<string name="android.permission.WRITE_EXTERNAL_STORAGE">Escribir a la memoria</string>
|
||||
<string name="android.permission.PROCESS_OUTGOING_CALLS">Detectar llamadas salientes</string>
|
||||
<string name="android.permission.READ_PHONE_STATE">Detectar el estado del dispositivo</string>
|
||||
<string name="android.permission.READ_EXTERNAL_STORAGE">Leer la almacenamiento</string>
|
||||
<string name="android.permission.WRITE_EXTERNAL_STORAGE">Escribir en el almacenamiento</string>
|
||||
<string name="android.permission.WRITE_SETTINGS">Modificar la configuración del dispositivo</string>
|
||||
<string name="android.permission.BATTERY_STATS">Determinar el estado de la batteria</string>
|
||||
<string name="android.permission.BATTERY_STATS">Determinar el estado de la bateria</string>
|
||||
<string name="android.permission.CHANGE_BACKGROUND_DATA_SETTING">Modificar la conexión internet</string>
|
||||
<string name="android.permission.ACCESS_NOTIFICATION_POLICY">Exeder configuración no molestar</string>
|
||||
<string name="android.permission.WRITE_SECURE_SETTINGS">Escribir a la memoria</string>
|
||||
<string name="apply">aceptar</string>
|
||||
<string name="publishedOn">publicitado el</string>
|
||||
<string name="android.permission.WRITE_SECURE_SETTINGS">Escribir en el almacenamiento</string>
|
||||
<string name="apply">aplicar</string>
|
||||
<string name="publishedOn">publicado el</string>
|
||||
<string name="postsNotification">%1$s crea notificación</string>
|
||||
<string name="removedNotification">notificación de %1$s removido</string>
|
||||
<string name="notificationAppears">Notificación aparece</string>
|
||||
<string name="notificationDisappears">Notificación deaparece</string>
|
||||
<string name="notificationDisappears">Notificación desaparece</string>
|
||||
<string name="startAppByActivity">a través de activity</string>
|
||||
<string name="startAppByAction">a través de action</string>
|
||||
<string name="enterValidAction">Inserte una action válida</string>
|
||||
<string name="enterPackageName">Inserte un package válido</string>
|
||||
<string name="configurationExportedSuccessfully">Exportación completada con éxito</string>
|
||||
<string name="noFileManageInstalled">No mánager archivo esta instalada</string>
|
||||
<string name="cantFindSoundFile">No puedo buscar el archivo sonido %1$s, por eso no puedo tocar lo.</string>
|
||||
<string name="ruleActive">Norma activa</string>
|
||||
<string name="triggerCharging">Batteria esta cargando</string>
|
||||
<string name="noFileManageInstalled">Administrador de archivos no esta instalada</string>
|
||||
<string name="cantFindSoundFile">No puedo buscar el archivo sonido %1$s, por eso no puedo reproducirlo.</string>
|
||||
<string name="ruleActive">Regla activa</string>
|
||||
<string name="triggerCharging">Bateria esta cargando</string>
|
||||
<string name="triggerUsb_host_connection">USB conexión a un computador</string>
|
||||
<string name="actionSetDisplayRotation">Girar monitor</string>
|
||||
<string name="actionEnableScreenRotation">activar girar monitor</string>
|
||||
<string name="actionDisableScreenRotation">desactivar girar monitor</string>
|
||||
<string name="overview">Sinopsis</string>
|
||||
<string name="enterWifiName">Inserta el nombre del wifi. Deje vacio para applicar a todos wifis.</string>
|
||||
<string name="overview">Panoramica</string>
|
||||
<string name="enterWifiName">Inserta el nombre del wifi. Deje vacio para aplicar a todos wifis.</string>
|
||||
<string name="startOtherActivity">Iniciar otra app</string>
|
||||
<string name="settings">Ajustes</string>
|
||||
<string name="errorReadingSettings">Error leer ajustes.</string>
|
||||
<string name="bluetoothConnection">Bluetooth conexión</string>
|
||||
<string name="bluetoothConnectionTo">Bluetooth conexión to %1$s</string>
|
||||
<string name="anyDevice">algun aparato</string>
|
||||
<string name="noDevice">no aparato</string>
|
||||
<string name="actionPlayMusic">Abrir jugador musica</string>
|
||||
<string name="bluetoothConnection">Conexión Bluetooth</string>
|
||||
<string name="bluetoothConnectionTo">Conexión Bluetooth con %1$s</string>
|
||||
<string name="anyDevice">cualquier dispositivo</string>
|
||||
<string name="noDevice">ningun dispositivo</string>
|
||||
<string name="actionPlayMusic">Abrir reproductor de música</string>
|
||||
<string name="profiles">Perfiles</string>
|
||||
<string name="ruleHistory">Historia de normas (más ultimas al primero)</string>
|
||||
<string name="lockSoundChanges">Bloquerar modificaciónes sonidas</string>
|
||||
<string name="ruleHistory">Historia de reglas (más ultimas al primero)</string>
|
||||
<string name="lockSoundChanges">Bloquear modificaciónes de sonido</string>
|
||||
<string name="status">Estado</string>
|
||||
<string name="android.permission.ACCESS_NETWORK_STATE">Determinar el estado de la red</string>
|
||||
<string name="clickAndHoldForOptions">Clice ý ase un elemento para opciónes</string>
|
||||
<string name="clickAndHoldForOptions">Cliquee y mantenga un elemento para opciónes.</string>
|
||||
<string name="ruleLegend">Verde = activado, roja = desactivado, amarillo = no sufienctes permisos</string>
|
||||
<string name="addProfile">Añadir perfil</string>
|
||||
<string name="profile">Perfil</string>
|
||||
<string name="invalidProfileName">Nombre invalido</string>
|
||||
<string name="anotherProfileByThatName">Hay otro perfil con lo mismo nombre.</string>
|
||||
<string name="anotherProfileByThatName">Hay otro perfil con el mismo nombre.</string>
|
||||
<string name="errorActivatingProfile">Error activando perfil:</string>
|
||||
<string name="executeRulesAndProfilesWithSingleClickTitle">Activar normas/perfiles con 1 clic</string>
|
||||
<string name="executeRulesAndProfilesWithSingleClickTitle">Activar reglas/perfiles con 1 clic.</string>
|
||||
<string name="name">Nombre</string>
|
||||
<string name="useAuthentication">Usar verificación de la autenticidad</string>
|
||||
<string name="radiusWithUnit">Radio [m]</string>
|
||||
<string name="volumes">Niveles sonidos</string>
|
||||
<string name="volumes">Volumenes</string>
|
||||
<string name="volumeRingtoneNotifications">Sonido polifónico ý notificaciónes</string>
|
||||
<string name="notificationRingtone">Sonido polifónico para notificaciónes</string>
|
||||
<string name="incomingCallsRingtone">Sonido polifónico para llamadas</string>
|
||||
<string name="batteryLevel">NIvel de la bateria</string>
|
||||
<string name="selectBattery">Elegir nivel de la bateria</string>
|
||||
<string name="triggerNoiseLevel">Nivel del rudio fondo</string>
|
||||
<string name="anotherAppIsRunning">Otra app esta enciendo/terminado</string>
|
||||
<string name="airplaneMode">Modo vuelo</string>
|
||||
<string name="triggerHeadsetPlugged">Auriculares conectado</string>
|
||||
<string name="headsetConnected">Auriculares (tipo: %1$s) conectado</string>
|
||||
<string name="headsetDisconnected">Auriculares (tipo: %1$s) desconectado</string>
|
||||
<string name="phoneCall">Llamado</string>
|
||||
<string name="incomingCallsRingtone">Sonido de llamadas</string>
|
||||
<string name="batteryLevel">Nivel de la bateria</string>
|
||||
<string name="selectBattery">Elija nivel de la bateria</string>
|
||||
<string name="triggerNoiseLevel">Nivel del ruido fondo</string>
|
||||
<string name="anotherAppIsRunning">Otra app esta encendida/terminada</string>
|
||||
<string name="airplaneMode">Modo avión</string>
|
||||
<string name="triggerHeadsetPlugged">Auriculares conectados</string>
|
||||
<string name="headsetConnected">Auriculares (tipo: %1$s) conectados</string>
|
||||
<string name="headsetDisconnected">Auriculares (tipo: %1$s) desconectados</string>
|
||||
<string name="phoneCall">Llamada</string>
|
||||
<string name="phoneNumber">Número de teléfono</string>
|
||||
<string name="enterPhoneNumber">Inserte numbero de teléfono. Vacio para algun número</string>
|
||||
<string name="phoneDirection">Direción de llamada</string>
|
||||
<string name="enterPhoneNumber">Inserte numero de teléfono. Vacio para algún número.</string>
|
||||
<string name="phoneDirection">Elija llamada\nentrante o saliente</string>
|
||||
<string name="headphoneSimple">Auriculares</string>
|
||||
<string name="headphoneSelectType">Elegir tipo de los auriculares</string>
|
||||
<string name="accelerometer">" Acelerómetro"</string>
|
||||
<string name="headphoneSelectType">Elija tipo de auriculares</string>
|
||||
<string name="accelerometer">Acelerómetro</string>
|
||||
<string name="gpsAccuracy">GPS exactitud [m]</string>
|
||||
<string name="soundSettings">Configuración de sonido</string>
|
||||
<string name="settingsCategoryNoiseLevelMeasurements">Medición de ruido fondo</string>
|
||||
<string name="waitBeforeNextAction">Esperar antes de la ación próxima</string>
|
||||
<string name="wakeupDevice">Desperatar dispositivo</string>
|
||||
<string name="textToSpeak">Text para hablar</string>
|
||||
<string name="waitBeforeNextAction">Esperar antes de la acción próxima</string>
|
||||
<string name="wakeupDevice">Despertar dispositivo</string>
|
||||
<string name="textToSpeak">Texto para hablar</string>
|
||||
<string name="state">Estado</string>
|
||||
<string name="setScreenBrightness">Poner luminosidad del monitor</string>
|
||||
<string name="brightnessManual">luminosidad manual del monitor</string>
|
||||
<string name="brightnessAuto">luminosidad automatico</string>
|
||||
<string name="autoBrightness">Activar luminosidad automatico</string>
|
||||
<string name="setScreenBrightnessEnterValue">Inserte luminosidad deseada (de 0 a 100).</string>
|
||||
<string name="autoBrightnessNotice">Si usa luminosidad automatica el valor probablemente no va a durar mucho tiempo.</string>
|
||||
<string name="actionDataConnection">Datos dispositivoes</string>
|
||||
<string name="setScreenBrightness">Poner nivel de brillo</string>
|
||||
<string name="brightnessManual">nivel de brillo manual</string>
|
||||
<string name="brightnessAuto">brillo automatico</string>
|
||||
<string name="autoBrightness">Activar brillo automatico</string>
|
||||
<string name="setScreenBrightnessEnterValue">Inserte nivel de brillo deseado (de 0 a 100).</string>
|
||||
<string name="autoBrightnessNotice">Si usa nivel de brillo automatico el valor probablemente no va a durar mucho tiempo.</string>
|
||||
<string name="actionDataConnection">Datos móviles</string>
|
||||
<string name="actionSpeakText">Hablar texto</string>
|
||||
<string name="selectToggleDirection">Activar o desactivar</string>
|
||||
<string name="selectToggleDirection">Activar o desactivar?</string>
|
||||
<string name="activated">activado</string>
|
||||
<string name="activate">Activar</string>
|
||||
<string name="deactivate">Desactivar</string>
|
||||
<string name="deactivated">desactivado</string>
|
||||
<string name="selectNoiseLevel">Elija nivel del ruido fondo</string>
|
||||
<string name="selectSpeed">Elegir velocidad</string>
|
||||
<string name="selectNoiseLevel">Elija nivel del ruido de fondo</string>
|
||||
<string name="selectSpeed">Elija velocidad</string>
|
||||
<string name="selectTypeOfActivity">Elija tipo de actividad</string>
|
||||
<string name="selectTypeOfTrigger">Elija tipo de condición</string>
|
||||
<string name="startAppStartType">Elija tipo de comienzo</string>
|
||||
<string name="android.permission.BLUETOOTH">Cambiar ajusted Bluetooth</string>
|
||||
<string name="android.permission.BLUETOOTH_ADMIN">Cambiar ajusted Bluetooth</string>
|
||||
<string name="android.permission.BLUETOOTH">Cambiar ajustes Bluetooth</string>
|
||||
<string name="android.permission.BLUETOOTH_ADMIN">Cambiar ajustes Bluetooth</string>
|
||||
<string name="moreSettings">Mas ajustes</string>
|
||||
<string name="openExamplesPage">Abrir pagina con ejemplos</string>
|
||||
<string name="openExamplesPage">Abrir página con ejemplos</string>
|
||||
<string name="activityOrActionName">Nombre del la\nactivitdad or la action</string>
|
||||
<string name="packageName">Nombre del paquete</string>
|
||||
<string name="parameterName">Nombre del parámetro</string>
|
||||
<string name="parameterValue">Valor del parámetro</string>
|
||||
<string name="addIntentValue">Añadir pareja intento</string>
|
||||
<string name="parameterType">Tipo del parámetro</string>
|
||||
<string name="phoneNumberExplanation">Puedes entrar un número, pero es opciónal. Si quieres usar un puedes elegir un de su directorio o entrar un manualmente. Adiciónalmente puedes usar expresiónes regulares. Para testar esos me gusta la pagina:</string>
|
||||
<string name="phoneNumberExplanation">Puedes introducir un número, pero es opciónal. Si quieres usar uno puedes elegir uno de su directorio o introducir uno manualmente. Adiciónalmente puedes usar expresiónes regulares. Para probar esos me gusta la pagina:</string>
|
||||
<string name="screenRotationEnabled">Rotación del monitor activado.</string>
|
||||
<string name="screenRotationDisabled">Rotación del monitor desactivado.</string>
|
||||
<string name="noPoisDefinedShort">No hay sitios.</string>
|
||||
<string name="starting">inciendo</string>
|
||||
<string name="starting">iniciando</string>
|
||||
<string name="stopping">terminando</string>
|
||||
<string name="connecting">conectando</string>
|
||||
<string name="disconnecting">desconectando</string>
|
||||
@ -312,34 +306,34 @@
|
||||
<string name="disconnectedFromWifi">desconectado a wifi \"%1$s\"</string>
|
||||
<string name="cantStopIt">No puedo terminarlo.</string>
|
||||
<string name="httpAcceptAllCertificatesTitle">Aceptar todo los certificados</string>
|
||||
<string name="httpAcceptAllCertificatesSummary">Omitir comprobar el validez de certificados (no es una bien idea)</string>
|
||||
<string name="httpAcceptAllCertificatesSummary">Omitir comprobar la validez de certificados (no es una buena idea)</string>
|
||||
<string name="httpAttemptsTimeoutTitle">Timeout [sec]</string>
|
||||
<string name="httpAttemptsTitle">Número de pruebas HTTP</string>
|
||||
<string name="httpAttemptsTimeoutSummary">Timeout de HTTP requests [segundos]</string>
|
||||
<string name="httpAttemptGapTitle">Pausa [sec]</string>
|
||||
<string name="runManually">Encender manualmente</string>
|
||||
<string name="serviceHasToRunForThat">Para este ación el servicio tiene que estar activo</string>
|
||||
<string name="serviceHasToRunForThat">Para esta acción el servicio tiene que estar activo</string>
|
||||
<string name="gpsComparison">Comparación GPS</string>
|
||||
<string name="timeoutForGpsComparisonsTitle">GPS timeout [sec]</string>
|
||||
<string name="muteTextToSpeechDuringCallsTitle">Silencio durante llamadas</string>
|
||||
<string name="anotherRuleByThatName">Todavia hay otra norma con lo mismo nombre.</string>
|
||||
<string name="anotherRuleByThatName">Ya existe otra regla con el mismo nombre.</string>
|
||||
<string name="settingsCategoryProcessMonitoring">Monitoreo de procesos</string>
|
||||
<string name="timeBetweenProcessMonitoringsTitle">Secundos inter monitoreos de procesos</string>
|
||||
<string name="timeBetweenProcessMonitoringsTitle">Segundos entre monitoreos de procesos</string>
|
||||
<string name="processes">Procesos</string>
|
||||
<string name="processMonitoring">Monitoreo de procesos</string>
|
||||
<string name="privacy">Política de privacidad</string>
|
||||
<string name="moveUp">Deplazar a ariba</string>
|
||||
<string name="moveDown">Deplazar a abajo</string>
|
||||
<string name="moveUp">Desplazar a arriba</string>
|
||||
<string name="moveDown">Desplazar a abajo</string>
|
||||
<string name="warning">Alerta</string>
|
||||
<string name="ringing">soniendo</string>
|
||||
<string name="ringing">sonando</string>
|
||||
<string name="from">de</string>
|
||||
<string name="to">a</string>
|
||||
<string name="matching">concordiando</string>
|
||||
<string name="loadWifiList">Cargar listo de wifis</string>
|
||||
<string name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">Leer notificaciónes del systema</string>
|
||||
<string name="matching">cordinando</string>
|
||||
<string name="loadWifiList">Cargar lista de wifis</string>
|
||||
<string name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">Leer notificaciónes del sistema</string>
|
||||
<string name="bluetoothFailed">No pude activar o desactivar Bluetooth. Tiene el dispositvo Bluetooth?</string>
|
||||
<string name="urlTooShort">El url tiene que tener mínimo 10 caracteres.</string>
|
||||
<string name="textTooShort">El texto tiene que tener mínimo 10 caracteres.</string>
|
||||
<string name="enterPhoneNumberAndText">Introduce un número de teléfono y un mensaje de texto.</string>
|
||||
<string name="onOff">On/Off</string>
|
||||
<string name="useTextToSpeechOnNormalSummary">Usar TextToSpeech en un perfil normal</string>
|
||||
<string name="useTextToSpeechOnVibrateSummary">Usar TextToSpeech en un perfil vibración</string>
|
||||
@ -350,62 +344,318 @@
|
||||
<string name="positioningSettings">Configuración de buscar posición</string>
|
||||
<string name="listenToWifiState">Observar estado de wifi cuando es posible</string>
|
||||
<string name="listenToAccelerometerState">Observar movimiento del dispositivo cuando wifi no está disponible</string>
|
||||
<string name="accelerometerTimer">Usar acelerómetro despues x minutos sin cambio de torre telefónica</string>
|
||||
<string name="accelerometerTimer">Usar acelerómetro después x minutos sin cambio de torre telefónica</string>
|
||||
<string name="cellMastIdleTime">Tiempo inactivo de las torres telefónicas</string>
|
||||
<string name="accelerometerThresholdDescription">Valor limite para movimientos acelerómetro</string>
|
||||
<string name="accelerometerThreshold">Valor acelerómetro</string>
|
||||
<string name="positioningThresholds">Posicionando valores</string>
|
||||
<string name="minimumDistanceChangeForGpsLocationUpdates">Minima distancia para cambio de GPS</string>
|
||||
<string name="distanceForGpsUpdate">Minimo cambio GPS [m]</string>
|
||||
<string name="minimumDistanceChangeForNetworkLocationUpdates">Minima distancia para cambio de red telefonica</string>
|
||||
<string name="distanceForNetworkUpdate">Minimo cambio red [m]</string>
|
||||
<string name="minimumDistanceChangeForGpsLocationUpdates">Mínima distancia para cambio de GPS</string>
|
||||
<string name="distanceForGpsUpdate">Mínimo cambio GPS [m]</string>
|
||||
<string name="minimumDistanceChangeForNetworkLocationUpdates">Mínima distancia para cambio de red telefonica</string>
|
||||
<string name="distanceForNetworkUpdate">Mínimo cambio red [m]</string>
|
||||
<string name="satisfactoryAccuracyGps">Exactitud necesaria para GPS en metros.</string>
|
||||
<string name="satisfactoryAccuracyNetwork">Exactitud necesaria para red en metros.</string>
|
||||
<string name="networkAccuracy">Red exactitud [m]</string>
|
||||
<string name="minimumTimeForLocationUpdates">Tiempo minimo para cambio en milisegundos para actualizar posición</string>
|
||||
<string name="timeForUpdate">Tiempo de actualizar [milisegundos]</string>
|
||||
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo.
|
||||
Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dispositivo\n[serialnr] - el número de serie de su dispositivo\n[latitude] - su latitud\n[longitude] - su longitud\n[phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante\n[d] - Dia del mes, 2 digitos con cero al comienzo\n[m] - número del mes, 2 digitos con cero al comienzo\n[Y] - Número del año, 4 digitos\n[h] - Hora, formato 12 horas con cero al comienzo\n[H] - Hora, formato 24 horas con cero al comienzo\n[i] - Minutos con cero al comienzo\n[s] - Segundos con cero al comienzo\n[ms] - milisegundos\n[notificationTitle] - Título de la última notificación\n[notificationText] - Texto de la última notificación</string>
|
||||
<string name="minimumTimeForLocationUpdates">Tiempo mínimo para cambio en milisegundos para actualizar posición</string>
|
||||
<string name="timeForUpdate">Tiempo para actualizar [milisegundos]</string>
|
||||
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto. [uniqueid] - el número único de su dispositivo [serialnr] - el número de serie de su dispositivo [latitude] - su latitud [longitude] - su longitud [phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante [d] - Dia del mes, 2 digitos con cero al comienzo [m] - número del mes, 2 digitos con cero al comienzo [Y] - Número del año, 4 digitos [h] - Hora, formato 12 horas con cero al comienzo [H] - Hora, formato 24 horas con cero al comienzo [i] - Minutos con cero al comienzo [s] - Segundos con cero al comienzo [ms] - milisegundos [notificationTitle] - Título de la última notificación [notificationText] - Texto de la última notificación</string>
|
||||
<string name="screenRotationAlreadyEnabled">Rotación del monitor todavia esta activado.</string>
|
||||
<string name="screenRotationAlreadyDisabled">Rotación del monitor todavia esta desactivado.</string>
|
||||
<string name="needLocationPermForWifiList">Se puede usar la lista de wifis conocidos para determinar los sitios a cuales estuve. Por eso el permiso locación esta necesaria para cargar la lista de wifis. Si quiere elegir un de la lista tiene que conceder el permiso. En caso contrario todavia puede entrar un nombre wifi manualmente.</string>
|
||||
<string name="com.wireguard.android.permission.CONTROL_TUNNELS">Controlar conexiones de la app wireguard</string>
|
||||
<string name="shareConfigAndLogFilesWithDev">Enviar configuración y procotolo al developer (via email).</string>
|
||||
<string name="rootExplanation">Necesita permiso root para este functión. Después encenda la función \"ejecutar norma manualmente\" para presentar el permiso superuser dialogo. Es necesita elegir \"siempre permitir root para esta app\". En caso contrario la norma no puede funcionar al fondo.</string>
|
||||
<string name="helpTextRules">Todos las condiciones estan y-conectado. La norma solo va a aplicarse cuando todos las condiciones sus aplican. Si quiere O cree otra norma.</string>
|
||||
<string name="timeBetweenNoiseLevelMeasurementsSummary">Segundos inter dos ensayos de nivel de ruido</string>
|
||||
<string name="timeBetweenNoiseLevelMeasurementsTitle">Segundos inter dos ensayos de nivel de ruido</string>
|
||||
<string name="lengthOfNoiseLevelMeasurementsSummary">Duración en segundos para un ensayos de nivel de ruido</string>
|
||||
<string name="lengthOfNoiseLevelMeasurementsTitle">Duración en segundos para un ensayos de nivel de ruido</string>
|
||||
<string name="referenceValueForNoiseLevelMeasurementsSummary">Referencia fisicalo para ensayo de nivel ruido</string>
|
||||
<string name="referenceValueForNoiseLevelMeasurementsTitle">Referencia fisicalo para ensayo de nivel ruido</string>
|
||||
<string name="logLevelSummary">Nivel del registro (1=minimo, 5=maximo)</string>
|
||||
<string name="needLocationPermForWifiList">Se puede usar la lista de wifis conocidos para determinar los sitios en los cuales estuvo. Por eso el permiso de localización es necesario para cargar la lista de wifis. Si quiere elegir uno de la lista tiene que conceder el permiso. En caso contrario todavia puede introducir un nombre wifi manualmente.</string>
|
||||
<string name="com.wireguard.android.permission.CONTROL_TUNNELS">Controlar conexiones de la app Wireguard</string>
|
||||
<string name="shareConfigAndLogFilesWithDev">Enviar configuración y procotolo al desarollador (vía email).</string>
|
||||
<string name="rootExplanation">Necesita permiso root para esta función. Después encienda la función \"ejecutar regla manualmente\" para presentar el permiso superuser dialogo. Es necesario elegir \"siempre permitir root para esta app\". En caso contrario la regla no puede funcionar en segundo plano.</string>
|
||||
<string name="helpTextRules">Todas las condiciones están \"Y\"-conectadas. La regla solo va a aplicarse cuando todas las condiciones se aplican. Si quiere \"O\", cree otra regla.</string>
|
||||
<string name="timeBetweenNoiseLevelMeasurementsSummary">Segundos entre dos ensayos de nivel de ruido</string>
|
||||
<string name="timeBetweenNoiseLevelMeasurementsTitle">Segundos entre dos ensayos de nivel de ruido</string>
|
||||
<string name="lengthOfNoiseLevelMeasurementsSummary">Duración en segundos para una prueba de nivel de ruido</string>
|
||||
<string name="lengthOfNoiseLevelMeasurementsTitle">Duración en segundos para una prueba de nivel de ruido</string>
|
||||
<string name="referenceValueForNoiseLevelMeasurementsSummary">Referencia fisicalo para prueba de nivel ruido</string>
|
||||
<string name="referenceValueForNoiseLevelMeasurementsTitle">Referencia fisicalo para prueba de nivel ruido</string>
|
||||
<string name="logLevelSummary">Nivel del registro (1=mínimo, 5=máximo)</string>
|
||||
<string name="logLevelTitle">Nivel del registro</string>
|
||||
<string name="unknownActionSpecified">Ación inconocido especicado</string>
|
||||
<string name="errorChangingScreenRotation">Error cambiando rotación del monitor</string>
|
||||
<string name="failedToTriggerBluetooth">Error cambiando Bluetooth. El dispositivo tiene Bluetooth?</string>
|
||||
<string name="failedToTriggerBluetooth">Error cambiando Bluetooth. Tiene el dispositivo Bluetooth?</string>
|
||||
<string name="settingsCategoryHttp">Pedido HTTP</string>
|
||||
<string name="httpAttemptsSummary">Cantidad de los pruebos en caso pedidos HTTP fallan por razones de conexißon</string>
|
||||
<string name="httpAttemptsSummary">Cantidad de las pruebas en caso pedidos HTTP fallan por razones de conexión</string>
|
||||
<string name="httpAttemptGapSummary">Pausa antes de otra prueba [segundos]</string>
|
||||
<string name="timeoutForGpsComparisonsSummary">Tiempo maximo en segundos</string>
|
||||
<string name="rememberLastActivePoiSummary">Se esta en un sitio reinicie su dispositivo o la aplicaión y salga el sitio la aplicaión va a procesar normas que incluyan saliendo este sitio.</string>
|
||||
<string name="rememberLastActivePoiTitle">Memorar ultimom sitio activo.</string>
|
||||
<string name="settingsErased">Configuración borrado.</string>
|
||||
<string name="settingsSetToDefault">Configuración reajustado al predeterminado.</string>
|
||||
<string name="privacyConfirmationText">Voy a abrir un browser y cargar la politica de privacidad de la pagina del dessarrolador.</string>
|
||||
<string name="waitBeforeNextActionEnterValue">Inserte un valor en milisegundos para cuánto tiempo esperar antes de la proxima ación.</string>
|
||||
<string name="wakeupDeviceValue">Inserte un valor en milisegundos para cuánto tiempo el dispositivo se tiene que quedar activo. 0 para usar el valor predeterminado.</string>
|
||||
<string name="enterAPositiveValidNonDecimalNumber">Inserte un numero positivo non-decimal.</string>
|
||||
<string name="cantMoveUp">No puedo mover objeto ariba. Todavia esta en la cima.</string>
|
||||
<string name="cantMoveDown">No puedo mover objeto abajo. Todavia esta en el fondo.</string>
|
||||
<string name="timeFrameWhichDays">En cuales dias?</string>
|
||||
<string name="insideOrOutsideTimeFrames">Dentro o fuera de esos intervalos?</string>
|
||||
<string name="timeoutForGpsComparisonsSummary">Tiempo máximo en segundos</string>
|
||||
<string name="rememberLastActivePoiSummary">Si está en un sitio, reinicie su dispositivo o la aplicaión y salga del sitio, la aplicaión va a procesar reglas que incluyan saliendo este sitio.</string>
|
||||
<string name="rememberLastActivePoiTitle">Memorizar último sitio activo.</string>
|
||||
<string name="settingsErased">Configuración borrada.</string>
|
||||
<string name="settingsSetToDefault">Configuración reajustada al predeterminado.</string>
|
||||
<string name="privacyConfirmationText">Voy a abrir un browser y cargar la política de privacidad de la página del desarrolador.</string>
|
||||
<string name="waitBeforeNextActionEnterValue">Inserte un valor en milisegundos por cuánto tiempo esperar antes de la proxima acción.</string>
|
||||
<string name="wakeupDeviceValue">Inserte un valor en milisegundos por cuánto tiempo el dispositivo se tiene que quedar activo. 0 para usar el valor predeterminado.</string>
|
||||
<string name="enterAPositiveValidNonDecimalNumber">Inserte un numero positivo no-decimal.</string>
|
||||
<string name="cantMoveUp">No puedo mover objeto arriba. Ya está en el máximo.</string>
|
||||
<string name="cantMoveDown">No puedo mover objeto abajo. Todavia está en el mínimo.</string>
|
||||
<string name="timeFrameWhichDays">En cuales días?</string>
|
||||
<string name="insideOrOutsideTimeFrames">Dentro o fuera de esos periodos?</string>
|
||||
<string name="roaming">Roaming</string>
|
||||
<string name="until">hasta</string>
|
||||
<string name="application">Aplicación</string>
|
||||
<string name="is">esta</string>
|
||||
<string name="is">está</string>
|
||||
<string name="with">con</string>
|
||||
<string name="any">algun</string>
|
||||
<string name="incoming">recibidiendo</string>
|
||||
<string name="any">cualquier</string>
|
||||
<string name="incoming">recibiendo</string>
|
||||
<string name="outgoing">saliendo</string>
|
||||
<string name="noKnownWifis">No hay wifis conocidos en su dispositivo.</string>
|
||||
<string name="helpTextTimeFrame">Si crea una regla con un periodo tiene dos opciones. Puede elegir entre entrar o salir de un periodo. En todo caso la regla será ejecutada solo una vez. Si crea una regla con una condición \"entrar periodo xyz\" y por ejemplo la acción \"poner el dispositivo en vibración\", el dispositivo NO va a cambiar a sonido de llamada automaticamente despues del periodo. Si desea esto tiene que crear otra regla con otro periodo.</string>
|
||||
<string name="toggableRules">Reglas reversibles</string>
|
||||
<string name="helpTextPoi">Un sitio consiste de coordinadas GPS y un radio. Porque la localización vía red móvil terrestre es relativamente imprecisa (pero rápida y barata) no especifiqué el radio demasiado corto. La aplicación va a sugerir un radio minimo cuando cree un nuevo sitio.</string>
|
||||
<string name="generalText">Para usar este programa tiene que crear reglas. Ellos tienen condiciones, por ejemplo \"está en un sitio\" o \"está en un periodo\". Despues cliquee el on/off boton en la pantalla principal.</string>
|
||||
<string name="muteTextToSpeechDuringCallsSummary">Poner TextToSpeech en muto mientras dura las llamadas</string>
|
||||
<string name="anotherPoiByThatName">Ya existe otro sitio con el mismo nombre.</string>
|
||||
<string name="timeBetweenProcessMonitoringsSummary">Cuanto mas bajo, mas se utiliza la bateria</string>
|
||||
<string name="airplaneModeSdk17Warning">A partir de Android version 4.2 esta función solo functiona si su dispositivo esta rooted.</string>
|
||||
<string name="selectTypeOfIntentPair">"Elija un tipo par intent. "</string>
|
||||
<string name="enterNameForIntentPair">Inserte nombre para par intent.</string>
|
||||
<string name="enterValueForIntentPair">Inserte valor para par intent.</string>
|
||||
<string name="whatToDoWithIntentPair">Hacer que con par?</string>
|
||||
<string name="gettingListOfInstalledApplications">Determinando lista de aplicaciones instaladas...</string>
|
||||
<string name="actionSetDataConnectionOn">activar datos móviles</string>
|
||||
<string name="actionSetDataConnectionOff">desactivar datos móviles</string>
|
||||
<string name="incomingAdjective">recibiendo</string>
|
||||
<string name="outgoingAdjective">saliendo</string>
|
||||
<string name="anyNumber">cualquier número</string>
|
||||
<string name="number">número</string>
|
||||
<string name="nfcTag">tag NFC</string>
|
||||
<string name="closeTo">cerca de</string>
|
||||
<string name="withLabel">con etiqueta</string>
|
||||
<string name="deviceDoesNotHaveNfc">Parece que este dispositivo no tiene NFC.</string>
|
||||
<string name="nfcReadTag">Leer ID de tag.</string>
|
||||
<string name="nfcWriteTag">Escribir tag</string>
|
||||
<string name="nfcEnterValidIdentifier">Inserte una etiqueta valida para el tag (como \"Puerta de casa\").</string>
|
||||
<string name="nfcTagWrittenSuccessfully">Tag escrita con éxito.</string>
|
||||
<string name="nfcTagWriteError">Error escribiendo tag. Está el tag cerca?</string>
|
||||
<string name="nfcTagDiscovered">Tag encontrado.</string>
|
||||
<string name="nfcBringTagIntoRange">Traiga un tag cerca.</string>
|
||||
<string name="nfcTagFoundWithText">Tag encontrado con etiqueta:</string>
|
||||
<string name="nfcUnsupportedEncoding">No hay soporte para este codigo:</string>
|
||||
<string name="nfcNoNdefIntentBut">No NFC NDEF intent, pero</string>
|
||||
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC sin soporto en esta version Android, todavia no.</string>
|
||||
<string name="cantRunRule">No puedo ejecutar reglas.</string>
|
||||
<string name="nfcApplyTagToRule">Aplicar este tag a regla</string>
|
||||
<string name="nfcTagReadSuccessfully">Tag escritoso con éxito.</string>
|
||||
<string name="nfcValueNotSuitable">Valor guardado no valido.</string>
|
||||
<string name="nfcNoTag">No tag presente.</string>
|
||||
<string name="newNfcId">Escrba nuevo ID NFC</string>
|
||||
<string name="newId">Nuevo ID:</string>
|
||||
<string name="currentId">Actual ID:</string>
|
||||
<string name="nfcTagDataNotUsable">Tag no esta utilizable, escriba de nuevo.</string>
|
||||
<string name="none">ningún</string>
|
||||
<string name="anyLocation">cualquier sitio</string>
|
||||
<string name="eraseSettings">Borrar configuración</string>
|
||||
<string name="defaultSettings">Configuración standard</string>
|
||||
<string name="areYouSure">Está seguro?</string>
|
||||
<string name="detectedActivityOnBicycle">En bicicleta</string>
|
||||
<string name="detectedActivityOnFoot">A pie</string>
|
||||
<string name="detectedActivityInVehicle">En vehiculo (auto/autobus)</string>
|
||||
<string name="detectedActivityWalking">Caminando</string>
|
||||
<string name="detectedActivityRunning">corriendo</string>
|
||||
<string name="detectedActivityInvalidStatus">Actividad no válida</string>
|
||||
<string name="detectedActivityTilting">Inclinando</string>
|
||||
<string name="detectedActivityStill">Sin movimiento</string>
|
||||
<string name="detectedActivityUnknown">desconocida</string>
|
||||
<string name="triggerOnlyAvailableIfPlayServicesInstalled">Esta condición solo esta disponsible si Google Play Services están instalados.</string>
|
||||
<string name="activityDetectionFrequencyTitle">Frecuencia de detección de actividad [seg]</string>
|
||||
<string name="activityDetectionFrequencySummary">Segundos entre pruebas de detección de actividad.</string>
|
||||
<string name="activityDetectionRequiredProbabilityTitle">Probabilidad de detección de actividad.</string>
|
||||
<string name="activityDetectionRequiredProbabilitySummary">Certeza necesaria con cuales resultados (de detección de actividad) serán aceptados.</string>
|
||||
<string name="selectDeviceFromList">uno de la lista</string>
|
||||
<string name="connectionToDevice">conexión a dispositivo</string>
|
||||
<string name="disconnectionFromDevice">desconexión de dispositivo</string>
|
||||
<string name="privacyLocationingSummary">Evitar usar metodos de localización cuales envian su posición a un proveedor, por ejemplo Google. Esto solo va a usar GPS. Por eso puede trajabar lento o/y poco fiable.</string>
|
||||
<string name="locationEngineNotActive">Localización no esta activo.</string>
|
||||
<string name="noMapsApplicationFound">Parece que no hay una aplicación de mapa en su dispositivo.</string>
|
||||
<string name="soundMode">Modo de sonido de llamada.</string>
|
||||
<string name="showIcon">Monstrar icono</string>
|
||||
<string name="showIconWhenServiceIsRunning">Monstrar icono cuando el servicio esta activo (ocultando solo funciona antes Android 7)</string>
|
||||
<string name="currentVolume">Volumen actual</string>
|
||||
<string name="volumeTest">Calibrado de volumen</string>
|
||||
<string name="permissionsTitle">Permisos necesarios</string>
|
||||
<string name="disabledFeatures">Funciones desactivadas</string>
|
||||
<string name="invalidDevice">Dispositivo no valido.</string>
|
||||
<string name="android.permission.ACCESS_WIFI_STATE">Determinar estado de wifi</string>
|
||||
<string name="android.permission.WAKE_LOCK">Mantener dispositivo activado</string>
|
||||
<string name="android.permission.MODIFY_PHONE_STATE">Cambiar ajustes del dispositivo</string>
|
||||
<string name="android.permission.GET_TASKS">Determinar procesos activos</string>
|
||||
<string name="android.permission.RECEIVE_BOOT_COMPLETED">Detectar reinicio del dispositivo</string>
|
||||
<string name="helpTextActivityDetection">Esta función puede detectar su estado de movimiento (a pie, en bicicleta, en vehiculo). La función no es parte de Automation, pero de Google Play Services. Técnicamente no da un \"si\" o \"no\" resultado, pero una probabilidad. Puede configurar este porcentaje del cual Automation va a aceptar un resultado. Dos comentarios: 1) Mas de un estado se puede aplicar al mismo tiempo. Por ejemplo puede estar a pie en un autobus. 2) Este sensor es relativamente caro (bateria). Si es posible considere alternativas, por ejemplo bluetooth conexión a su coche en vez de \"en vehiculo\".</string>
|
||||
<string name="textMessageAnnotations">Puede insertar un numero de llamada. Alternativamente puede importar un numero de su directorio. Pero tenga en cuenta: El número será guardado, no el contacto. Si cambias el número en su directorio tiene que cambiar la regla también.</string>
|
||||
<string name="startAutomationAsService">Encender automation como un servicio</string>
|
||||
<string name="startScreenSummary">Elija la pantalla con que Automation enciende.</string>
|
||||
<string name="useExistingTag">Use existente tag NFC</string>
|
||||
<string name="nfcBringTagIntoRangeToRead">Traiga un tag dentro del alcance.</string>
|
||||
<string name="toggleRule">Regla reversible</string>
|
||||
<string name="toggling">revirtiendo</string>
|
||||
<string name="toggle">revertir</string>
|
||||
<string name="overlapBetweenPois">Detecte sobreposición con sitio %1$s de %2$s metros. Reduzca el radio de este al minimo.</string>
|
||||
<string name="invalidPoiName">Nombre invalido para sitio.</string>
|
||||
<string name="activityDetection">Detección de actividad</string>
|
||||
<string name="android.permission.ACTIVITY_RECOGNITION">Detección de actividad</string>
|
||||
<string name="detectedActivity">Actividad detectada:</string>
|
||||
<string name="incomingCallFrom">Llamada entrante de %1$s.</string>
|
||||
<string name="outgoingCallTo">Llamando a %1$s.</string>
|
||||
<string name="toggleNotAllowed">Reversibilidad solo esta permitida para reglas que tienen tags NFC por condición. Consulte la ayuda para mas información.</string>
|
||||
<string name="errorReadingPoisAndRulesFromFile">Error en la lectura sitios y reglas del archivo.</string>
|
||||
<string name="noDataChangedReadingAnyway">Aparece no hay cambios. Pero puede haber cambios en la memoria que pueden ser recogidos. Leyendo archivo de nuevo.</string>
|
||||
<string name="bluetoothDisconnectFrom">Conexión Bluetooth de %1$s desconectada</string>
|
||||
<string name="bluetoothDeviceInRange">Dispositivo Bluetooth %1$s en alcance.</string>
|
||||
<string name="bluetoothDeviceOutOfRange">Dispositivo Bluetooth %1$s fuera de alcance.</string>
|
||||
<string name="deviceInRange">dispositivo en alcance</string>
|
||||
<string name="deviceOutOfRange">dispositivo fuera de alcance</string>
|
||||
<string name="selectDeviceOption">Elija una opción de dispositivo.</string>
|
||||
<string name="selectConnectionOption">Elija una opción de conexión.</string>
|
||||
<string name="noiseDetectionHint">Si piensa que la detección del volumen no funciona correctamente (dependiendo del valor que configuró), tenga en cuenta todos los dispositivos son diferentes. Por eso puede cambiar la \"referencia del detección del volumen\" en la configuración. Para mas informaciones vease https://es.wikipedia.org/wiki/Nivel_de_presi%C3%B3n_sonora. Puede usar el probador del volumen en pantalla principal para calibrar su dispositivo.</string>
|
||||
<string name="hint">Pista</string>
|
||||
<string name="hapticFeedback">Sensación tactil (vibracion cuando toca la pantalla)</string>
|
||||
<string name="helpTextSound">En la pantalla principal puede usar \"bloquear cambios de sonido\" para temporalmente evitar, basado en la norma, cambios de sonido. Por ejemplo podría estar en una situación o en un sitio donde un tono de llamada está bien, pero esta vez no es oportuno. La función se desactiva automaticamente despues del tiempo configurado. Cliquee el \"+\" boton para adicionar mas tiempo. Se puede desactivar la función antes tambien usando el boton interruptor (en consecuencia reactivar cambios de sonido, basados en normas).</string>
|
||||
<string name="helpTextToggable">Las normas tienen una configuracion que se llama \\\"reversible\\\". Significa si una norma es ejecutada y despues las mismas condiciones aplican, la norma es ejecutada de forma reversible donde sea posible. Actualmente solo funciona con la condición NFC. Si toca el tag dos veces, y hay una norma reversible con este tag, la aplicación va a hacer lo contrario de la situación actual, por ejemplo desactivar wifi cuando está activo.</string>
|
||||
<string name="helpTextProcessMonitoring">Si crea una norma con vigilancia del proceso, la aplicación va a revisar periodicamente si el proceso está activo. Puede ajustar la frecuencia en la configuración. Puede relentizar la reacción, pero la vigilancia permanente gasta mucha bateria. No hay un broadcast del sistema operativo para este evento.</string>
|
||||
<string name="helpTextEnergySaving">Muchos fabricantes intentan conservar energia limitando las actividades de segundo plano de otras apps. Desafortunadamente el resultado es que esas aplicaciones no funcionan por completo. Automation está entre ellas. Vease <a href="https://dontkillmyapp.com/">esta pagina</a> para determinar como excluir Automation de tales medidas.</string>
|
||||
<string name="speedMaximumTimeBetweenLocations">Tiempo maximo entre 2 sitios para determinar la velocidad.</string>
|
||||
<string name="clone">Clonar</string>
|
||||
<string name="updateAvailable">Hay nueva versión de la app. Quiere abrir un browser y descargarla?</string>
|
||||
<string name="automaticUpdateCheck">Buscar updates</string>
|
||||
<string name="urlToTriggerExplanation">Esta función NO abre el browser, pero enciende un URL en el fondo. Puede usar lo por ejemplo para enviar comandos a su automatización de la casa.</string>
|
||||
<string name="automaticUpdateCheckSummary">Solo en la versión APK.</string>
|
||||
<string name="locationFound">Determine una posición. El radio minimo sugerido es %1$d m.</string>
|
||||
<string name="locationFoundInaccurate">Solo pude determinar una posición imprecisa. Puede ser, que funcione poco fiable. El radio minimo sugerido es %1$d m.</string>
|
||||
<string name="volumeMusicVideoGameMedia">Multimedia (música, video …)</string>
|
||||
<string name="audibleSelection">Audio habilitado cuando selectión</string>
|
||||
<string name="screenLockUnlockSound">Sonido del (des-)bloqueo de pantalla</string>
|
||||
<string name="vibrateWhenRinging">Vibrar timbrando</string>
|
||||
<string name="noChangeSelectedProfileDoesntMakeSense">No hay cambios seleccionados. Perfil no tiene sentido.</string>
|
||||
<string name="noProfilesCreateOneFirst">No hay perfilies en su configuración. Cree uno primero.</string>
|
||||
<string name="errorWritingFile">Error escribiendo el archivo.</string>
|
||||
<string name="unknownError">Error desconocido.</string>
|
||||
<string name="noWritableFolderFound">No pude encontrar una carpeta para guardar el archivo de la configuración.</string>
|
||||
<string name="usbTetheringFailForAboveGingerbread">Probablemente no funcionará porque esta mas actual que Android 2.3. Podría usar el enrutador wifi en lugar de eso.</string>
|
||||
<string name="usingNewThreadForRuleExecution">Usar nuevo thread para ejecutar regla.</string>
|
||||
<string name="startNewThreadForRuleExecution">Usar nuevo thread para ejecutar regla.</string>
|
||||
<string name="newThreadRules">Nuevo thread</string>
|
||||
<string name="someOptionsNotAvailableYet">Algunas opcciones estan desactivadas y todavia no pueden ser usadas. Estas seran introducidas en una versión futura.</string>
|
||||
<string name="noProfileChangeSoundLocked">Perfil no será activado. Último perfil activado estuvo/esta bloqueado.</string>
|
||||
<string name="enterValidReferenceValue">Inserte un valor valido de referencia.</string>
|
||||
<string name="settingsWillTakeTime">Algunos ajustes no seran aplicados antes de reiniciar el servicio.</string>
|
||||
<string name="errorWritingConfig">Error escribiendo config. Tiene una memoria descrita?</string>
|
||||
<string name="phoneNrReplacementError">No pude insertar el numero de la ultima llamada in en la variable. No lo tengo.</string>
|
||||
<string name="permissionsExplanation">Explicación de permisos necesarios</string>
|
||||
<string name="theFollowingPermissionsHaveBeenDenied">Los siguientes permisos serán negados:</string>
|
||||
<string name="permissionsExplanationGeneric">Por el momento la app está en un modo limitado, pocas funciones están desactivadas. Para funcionar completamente necesita permisos. Si quiere toda la funcionalidad tiene que otorgar en los siguientes diálogos permisos. Si no ciertas reglas no serán ejecutadas. Por consiguiente hay explicaciones para los permisos requeridos. Cliquee continuar cuando esta preparado para proceder.</string>
|
||||
<string name="permissionsExplanationSmall">Para activar la función que será usada, mas permisos son necesarios. Cliquee continuar para los requisitos.</string>
|
||||
<string name="storeSettings">Leer y guardar configuración.</string>
|
||||
<string name="featuresDisabled">CUIDADO: Funciones estan desactivadas, Automation esta en modo limitado. Cliquee aqui para mas informacion.</string>
|
||||
<string name="volumeCalibrationExplanation">Para calcular un valor dB para determinar el nivel del ruido de fondo tiene que especificar un valor de referencia fisico. Por favor lea el articulo en Wikipedia para mas información. Este valor será probablemente diferente para todos los dispositivos. Mueva el regulador para cambiar el valor. Cuanto mas alto el valor de referencia menos será el valor dB. Las mediciónes se harán cada %1$s segundos y el resultado aparecerá abajo. Presione atrás cuando encuentre un valor indicado.</string>
|
||||
<string name="systemSettingsNote1">El permiso para cambiar ajustes del OS es necesario (incluso cosas simples como activar bluetooth o wifi). Despues de cliquear continuar una ventana aparecerá en la cual tiene que activar eso para Automation. Entonces cliquee el boton atrás.</string>
|
||||
<string name="systemSettingsNote2">Mas permisos serán requeridos en un segundo dialogo luego.</string>
|
||||
<string name="appRequiresPermissiontoAccessExternalStorage">Automation necesita acceso al almacenamiento externo para leer su configuración y reglas.</string>
|
||||
<string name="mainScreenPermissionNote">" Automation necesita mas permisos para funcionar en su totalidad. Cliquee en este texto para encontrar mas y requerirlos."</string>
|
||||
<string name="logFileMaxSizeSummary">Maximo tamaño del archivo log. Será alternado si es mas alto.</string>
|
||||
<string name="logFileMaxSizeTitle">Maximo tamaño del archivo log [Mb]</string>
|
||||
<string name="theseAreThePermissionsRequired">Esos son los permisos necesarios.</string>
|
||||
<string name="android9RecordAudioNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
|
||||
<string name="android10WifiToggleNotice">Desafortunadamente Google dedició remover esta función en Android 10. Applicaciones regulares ya no pueden activar o desactivar wifi. Solo si su dispositivo esta rooted debe funcionar adelante. Si no este ación no va a continuar de funcionar.</string>
|
||||
<string name="messageNotShownAgain">Esta nota no aparecerá otra vez.</string>
|
||||
<string name="noLocationCouldBeFound">No pude encontrar una posición despues de un limite de %1$s segundos..</string>
|
||||
<string name="pleaseGiveBgLocation">En la proxima pantalla por favor vaya a permisos, luego a posición. Ahi elija \"Siempre permitir\" para permitir Automation determinar la posición en el fondo.</string>
|
||||
<string name="ConfigurationExportError">Hubo un error durante la exportación de la configuración.</string>
|
||||
<string name="rulesImportedSuccessfully">Reglas y sitios están exportados con exito.</string>
|
||||
<string name="rulesImportError">Hubo un error durante la importación de las reglas y sitios.</string>
|
||||
<string name="notAllFilesImported">No pudo importar todos los archivos aplicables.</string>
|
||||
<string name="importExportExplanation">Despues de cliquear importar o exportar elija el directorio de que archivos serán importados o a que serán exportados. Si exporta archivos que ya existen serán sobreescritos.</string>
|
||||
<string name="errorRunningRule">Hubo un error al iniciar una regla.</string>
|
||||
<string name="locationEngineDisabledShort">La posición no sera determinada mas en el fondo. Cliquee aqui para averiguar más.</string>
|
||||
<string name="displayNewsOnMainScreen">Mostrar noticias de la app en la pantalla principal.</string>
|
||||
<string name="displayNewsOnMainScreenDescription">Noticias solo de esta app. Hablamos de 1-2 veces por año, no mas.</string>
|
||||
<string name="featureNotInFdroidVersion">Esta caracteristica esta basada en software libre. Por eso no esta disponsible en la versión F-Droid.</string>
|
||||
<string name="chooseActivityHint">En esta selección final tiene que elegir una \"Activity\" especifica. Simplificado: es una ventana especifica de la aplicación elegida. Si no sabe cual tiene que elegir, normalmente es una buena idea probar los que tienen \"main\" o \"launcher\" en el nombre.</string>
|
||||
<string name="googleSarcasm">Gracias a la sabiduria infinita de Google y su esfuerzo constante de proteger la privacidad de todo el mundo. Por eso de todas las reglas que pueden enviar SMS o determinar el estado del movil las condiciones y acciones, que Google considera de riesgo, fueron eliminadas.</string>
|
||||
<string name="screenLockSoundNotice">Sonidos de bloqueo de pantalla no seran mas cambiados en dispositivos que usan Android 6 o mas nuevos. Cualquier ajuste aqui no va a funcionar en cualquier dirección.</string>
|
||||
<string name="googleLocationChicanery">Este app almacena datos de posición para activar reglas que necesitan la posición o la velocidad - incluso cuando la app esta cerrada o no en uso.</string>
|
||||
<string name="googleLocationChicaneryOld">Este app almacena datos de posición para determinar si actualmente esta en uno de los sitios que creó. Además estan usados para determinar su actual velocidad (si usa esta condición en reglas). Incluso cuando la app esta cerrada o no en uso (pero solo cuando el servicio esta iniciado).</string>
|
||||
<string name="settingsReferringToRestrictedFeatures">Su configuración y/o reglas actualmente referencian caracteristicas no-libres no seran proveidas en la versión F-Droid. Esto incluye determinar su actual actividad fisica.</string>
|
||||
<string name="filesHaveBeenMovedTo">Automation ahora usa otra ruta para guardar sus archivos. Todos sus archivos de Automation fueron desplazados aqui: \"%s\". El permiso del almacenamiento externo todavia no es necesario; puede revocarlo. Sera eliminado en una futura versión.</string>
|
||||
<string name="newsOptIn">Quiere recibir noticias (solo importantes) en la pantalla principal? Estas serán descargadas de la pagina del desarollador. No habrán notificaciones inoportunas, solo un texto en la pantalla principal cuando abra la app.</string>
|
||||
<string name="filesStoredAt">Config y archivos de log seran guardados en el directorio %1$s. Cliquee en este texto para abrir un administrador de archivos. Desafortunadamente solo funciona en un dispositivo rooted.\n\nPARA OTROS DISP.: Simplemente use el boton para crear un backup.</string>
|
||||
<string name="notificationTriggerExplanation">Esta condición responde a todas las aplicaciones que abren o cierran notificaciones en el areal notificaciones. Puedes especificar otra aplicación de que la notificación tiene que venir. Si no la notificación puede originarse de cualquier app. Tambien puedes especificar strings que (/no) tienen que estar en en titulo o el texto de la notificación. La comparación es insensible a minúsculas y mayúsculas.</string>
|
||||
<string name="alwaysPlayExplanation">Si este ajuste esta activo el sonido será reproducido siempre. Si esta inactivo el sonido solo será reproducido si su dispositivo ni esta en mute ni en vibración. Pero si esta activo cambiará el volumen. Tambien si su dispositivo esta en el modo timbre el volumen multimedia no será cambiado por ejemplo. En resumen si el volumen multimedia esta en mute no escuchará nada.</string>
|
||||
<string name="shareConfigAndLogExplanation">Esto comenzará un nuevo email con su config y los archivos de log adjunto como archivo zip. No será enviado automaticamente. Todavia tiene que cliquear \"enviar\". Tambien puede cambiar el receptor a si mismo por ejemplo.</string>
|
||||
<string name="tabsPlacement">Posición de la barra de tabs</string>
|
||||
<string name="top">Arriba</string>
|
||||
<string name="bottom">Abajo</string>
|
||||
<string name="vibrate">Vibrar</string>
|
||||
<string name="test">Probar</string>
|
||||
<string name="VibrateExplanation">Elija la duración de la vibración, seguido de un coma y una duración de una pausa. Puedes concatenar tantos como quiere. Separelos con comas tambien. Por ejemplo el patrón 100,500,500,1000,100 va a vibrar 100, esperar 500, vibrar 500, esperar 1000, vibrar 100 ms. Si cree que una vibración está perdida, pruebe incrementar la pausa antes de esta vibración.</string>
|
||||
<string name="pleaseEnterValidVibrationPattern">Por favor introduzca un patrón de vibración válido.</string>
|
||||
<string name="tabsPlacementSummary">Elija done la barra de tabs está puesto.</string>
|
||||
<string name="intentDataComment">Si su parametro es de tipo Uri y especifica \"IntentData\" como nombre (minúscula/mayáscula no es importante), el parametro no está añadido como un parametro normal con puExtra(), pero estará añadido al intent con setData().</string>
|
||||
<string name="locationEngineDisabledLong">Desafortunadamente su posición todavia no puede ser determinada. Gratitud va para Google por su sabiduria y amabilidad infinita.\n\nDejenme explicarselo mas. Comenzando con Android 10 un nuevo permiso se introdujo que es necesario para determinar la posición en el fondo (que es necesario para una app como esta). Aunque lo considero una buena idea, conlleva a una chicana para desarolladores.\n\nCuando se esta desarrollando una app se puede intentar calificar para este permiso mientras se sigue un catalogo de condiciones. Desafortunadamente nuevas versiones de mi app fueron rechazadas por un periodo de trés meses. Cumplé todas las condiciones, pero Google\'s mierda servicio para desarolladores afirmó que no. Despues de presentar pruebas, que cumplí con todo, recibí una respuesta de \"No puedo ayudarte mas.\". En algun momento me rendí.\n\nComo consecuencia la version Google Play todavia no sabe usar la locación como una condición. Mi única alternativa fue remover la applicación de Google Play.\n\nLo siento mucho, pero hicé todo lo posible para discutir con un support que no sabe aprobar la prueba de Turing repetidamente.\n\nLa noticia positiva: Usted todavia puede tener todo!\n\nAutomation ahora es open source y se puede encontrar en F-Droid. Es un app store que se preocupa por su privacidad - en vez de solo simular eso. Simplemente guarde su configuración, desinstale la app, instale la de F-Droid, restaure su configuración - terminado.\n\nCliquee aqui para averiguar más:</string>
|
||||
<string name="startAppChoiceNote">Aqui tiene 2 opciones generales:\\n\\n1. Puede encender un programa seleccionando un activity. Imagine eso como preseleccionar una pantalla/ventana especifica de una aplicación. Tenga en cuenta que no siempre funcionará. Eso es porque las ventanas de una app pueden interactuar entre ellas, por ejemplo dar parametros. Si se abre una ventana especifica directamente esta interacción todavia no ha ocurrido y la ventana se podría cerrar al instante (por lo tanto nunca será presentada). Pruebe esto sin embargo! Puede introducir una trayectoria de una activity manualmente, pero es recomendable usar el boton \"Elegir\". Si decide introducir la trayectoria de la app manualmente en la casilla de arriba y la trayectoria completa de una activity en la de abajo.\\n\\n2.Elección con action\\nContrariamente a elegir una ventana especifica, tambien puede encender una app con un action. Es similar a llamar \"Queria xyz\" y si hay una app que le puede ayudar a usted sera encendida. Un ejemplo bueno seria \"abrir browser\" - podria tener multiples (una normalemente es el valor predeterminado). Usted necesita introducirlo manualmente, PackageName es opcional aqui. Tenga en cuenta las variables no seran resueltas. Si por ejemplo quiere encender la camara usando \"MediaStore.ACTION_IMAGE_CAPTURE\" no va a funcionar. Tiene que mirar en la documentación de Android y usar el valor real de esta variable que - en este ejemplo - seria \"android.media.action.IMAGE_CAPTURE\".</string>
|
||||
<string name="tones">Sonidos</string>
|
||||
<string name="dnd">No interrumpir</string>
|
||||
<string name="donate">Donar</string>
|
||||
<string name="notice">Nota</string>
|
||||
<string name="deviceOrientation">Orientación</string>
|
||||
<string name="tolerance">Tolerancia</string>
|
||||
<string name="orientationAzimuth">" Acimut:"</string>
|
||||
<string name="turnScreenOff">apagar pantalla</string>
|
||||
<string name="turnScreenOn">encender pantalla</string>
|
||||
<string name="actionSetBluetoothTethering">Enrutador Bluetooth</string>
|
||||
<string name="actionTurnBluetoothTetheringOn">activar enrutador Bluetooth</string>
|
||||
<string name="actionTurnBluetoothTetheringOff">desactivar enrutador Bluetooth</string>
|
||||
<string name="miscellaneous">Misceláneo</string>
|
||||
<string name="dndOff">No interrumpir apagado</string>
|
||||
<string name="dndPriority">Permitir notificaciones prioritarias</string>
|
||||
<string name="dndAlarms">Permitir alarmas</string>
|
||||
<string name="dndNothing">Permitir nada</string>
|
||||
<string name="unknown">desconocido</string>
|
||||
<string name="orientation">Orientación</string>
|
||||
<string name="turnScreenOnOrOff">Activar o desactivar pantalla</string>
|
||||
<string name="mustApply">Debe aplicar</string>
|
||||
<string name="deviceOrientationTimeAcceptIntervalTitle">Frecuencia de señal</string>
|
||||
<string name="deviceOrientationSettings">Configuración del orientación del dispositivo</string>
|
||||
<string name="android.permission.BIND_DEVICE_ADMIN">Administrador del dispositivo</string>
|
||||
<string name="orientationRoll">Rotación:</string>
|
||||
<string name="orientationPitch">Inclinación:</string>
|
||||
<string name="wouldCurrentlyApply">¿Se aplicaría actualmente?</string>
|
||||
<string name="repeatEveryXseconds">Repetir cada x segundos</string>
|
||||
<string name="repeatEveryXsecondsWithVariable">repetir cada %1$s segundos</string>
|
||||
<string name="permissionsRequiredNotAvailable">Sus reglas requerían permisos que no se pueden solicitar a este tipo instalado de Automation.</string>
|
||||
<string name="automationNotificationsIgnored">Si no elige una aplicación específica, sino que elige \"Cualquier aplicación\", las notificaciones de Automatización se ignorarán para evitar bucles.</string>
|
||||
<string name="enterRepetitionTime">Debe insertar un valor positivo no decimal para el tiempo de repetición.</string>
|
||||
<string name="elementSkipped">No se pudo leer un elemento del archivo de configuración. El archivoo puede haber sido creado por una versión más reciente del programa.</string>
|
||||
<string name="enterValidNumbersIntoAllFields">Introduzca números válidos en todos los campos.</string>
|
||||
<string name="toleranceOf180OnlyAllowedIn2Fields">Se permite una tolerancia de 180 solo para 2 campos de tolerancia, no para todos los 3. De lo contrario, el disparador SIEMPRE se aplicaría.</string>
|
||||
<string name="triggerWrong">Hay algo mal con este condición. No se pudo cargar correctamente.</string>
|
||||
<string name="deviceOrientationTimeAcceptIntervalSummary">Aceptar nuevas señales de movimiento cada x milisegundos</string>
|
||||
<string name="deviceAdminNote">Se requieren permisos de administrador de dispositivo para al mens 1 reglas que haya creado.</string>
|
||||
<string name="dndRemarks">El ajuste fino (como permitir llamadas telefónicas, elegir números específicos, etc.) solo se puede hacer desde la configuración del sistema.</string>
|
||||
<string name="btTetheringNotice">Se confirma que esta función funcionará hasta Android 8.0. A partir de alguna versión superior deja de funcionar, pero debido a la falta de dispositivos físicos no puedo decir cuál es. En Android 11 definitivamente ya no funciona. Si tiene una versión intermedia, hágamelo saber si está funcionando o no.</string>
|
||||
<string name="deviceIsInCertainOrientation">el dispositivo esta en una orientación determinada</string>
|
||||
<string name="explanationDeviceOrientationDirection">Si la casilla de verificación está marcada, significa que el dispositivo debe estar en la orientación que especifique. Si no está marcado, cualquier orientación que NO coincida con sus criterios servirá.</string>
|
||||
<string name="silentTriggersDnd">OBSERVACIÓN: El modo silencioso a menudo activa No-Interrumpir en dispositivos más nuevos. Si eso sucede en su dispositivo, le recomiendo usar el modo normal en su lugar y reducir todos los volúmenes a cero.</string>
|
||||
<string name="wifiApi30">Porque Google arruinó otra parte de Android, a partir de API 30 solo se puede mostrar los wifi actualmente visibles, ya no todos que su positivo tiene conectados.</string>
|
||||
<string name="smsDialogNotice">Si no ha utilizado una acción de envío de sms en este programa antes, Android puede mostrar un diálogo de confirmación adicional, pidiéndole que permita el envío de mensajes. Debe seleccionar la casilla de verificación \"permitir siempre\" y confirmar si desea que esta acción funcione en segundo plano. Se recomienda ejecutar esta regla manualmente una vez para provocar este diálogo de confirmación.</string>
|
||||
<string name="deviceOrientationExplanation">Cuando mueva su dispositivo, los siguientes números se actualizarán. Lo que puede ver allí, es la orientación actual de su dispositivo medida en grados. Si está en la orientación deseada, haga clic en el botón Aplicar para copiar los valores actuales en los campos deseados. Debido a que alcanzar esta orientación exacta nunca más es muy poco probable, también deba ingresar a una tolerancia. Esta es la cantidad de grados a los que la orientación puede desviarse en cualquier dirección. 15° resultará en un ángulo total de 30°, 15° en todas las direcciones. Si solo le importa un eje específico, especifique una tolerancia de 180° para los otros dos.</string>
|
||||
<string name="profileNotActive">el perfil %1$s no está activo</string>
|
||||
<string name="profileActive">el perfil %1$s está activo</string>
|
||||
<string name="checkSettings">Comprobar la configuración</string>
|
||||
<string name="needsToBeActive">Necesita estar activo</string>
|
||||
<string name="recommendedForBetterReliability">Recomendado para una mejor fiabilidad</string>
|
||||
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Excluir de la optimización de la batería</string>
|
||||
<string name="profileTriggerCheckSettings">Si esta casilla de verificación no está desactivada, solo se marcará si el perfil seleccionado ha sido el último en activarse. No importa si alguna configuración relacionada con el audio se ha cambiado externamente.\nSin embargo, si la casilla de verificación está habilitada, la configuración de audio actual realmente debe ser como se define en el perfil. CUIDADO: La comprobación del archivo de tono de llamada no es compatible actualmente, todavía.</string>
|
||||
<string name="ruleXIsUsingProfileY">No se puede eliminar este perfil. La regla %s$1 hace referencia al perfil %s$2.</string>
|
||||
<string name="profileCouldNotBeDeleted">No se pudo eliminar el perfil.</string>
|
||||
<string name="noRepetition">sin repetición</string>
|
||||
<string name="usingAuthentication">uso de la autenticación</string>
|
||||
<string name="toNumber">a número</string>
|
||||
<string name="message">mensaje</string>
|
||||
<string name="onDays">en días</string>
|
||||
<string name="notSet">no configurado</string>
|
||||
<string name="takeLauncherActivity">Buscar automaticamente</string>
|
||||
<string name="pickActivityManually">Eligir manualmente</string>
|
||||
<string name="launcherOrManualExplanation">Modo facil: Automation puede probar identifcar el launcher activity del programa automaticamente.\nAlternativamente puede eligir una de las activities del programa manualmente.\nCual variante queria?</string>
|
||||
<string name="launcherNotFound">No se puede encontrar una launcher activity. Tiene que elegir una manualmente.</string>
|
||||
</resources>
|