Compare commits

..

14 Commits

Author SHA1 Message Date
2a067507ae new release 1.7.2 2022-01-10 10:33:49 +01:00
1c8eec735d code cleanups 2022-01-09 21:43:49 +01:00
53f46c10da translations 2022-01-09 14:55:52 +01:00
c5f04afe85 translations 2022-01-09 14:01:38 +01:00
4d7fa711f9 profile trigger 2022-01-09 13:51:38 +01:00
4bea2113fa profile trigger 2022-01-09 13:48:12 +01:00
890260b8eb startApp 2022-01-08 19:00:06 +01:00
230521149f startApp 2022-01-08 14:46:01 +01:00
9a50da550a bugs and translations 2022-01-05 23:27:27 +01:00
941bb3e1af profile trigger 2022-01-05 18:06:26 +01:00
5653a9c70e profile trigger 2022-01-04 17:51:27 +01:00
8c6331237d Cosmetics 2022-01-04 16:14:13 +01:00
1bbf04d548 Exclusion from battery optimization 2022-01-03 23:24:34 +01:00
a2d93d27cb Cosmetics 2022-01-03 19:50:57 +01:00
37 changed files with 1023 additions and 322 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 115 versionCode 116
versionName "1.7.1" versionName "1.7.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 115, "versionCode": 116,
"versionName": "1.7.1-googlePlay", "versionName": "1.7.2-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk" "outputFile": "app-googlePlayFlavor-release.apk"
} }
], ],

View File

@ -65,6 +65,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_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="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-feature <uses-feature
android:name="android.hardware.telephony" android:name="android.hardware.telephony"
@ -121,15 +122,7 @@
<receiver android:name=".receivers.PackageReplacedReceiver" <receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true"> android:enabled="true">
<intent-filter> <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" /> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receivers.DateTimeListener" /> <receiver android:name=".receivers.DateTimeListener" />
@ -154,6 +147,7 @@
<activity android:name=".ActivityDisplayLongMessage" /> <activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" /> <activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" /> <activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" /> <activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" /> <activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityManageTriggerPhoneCall" /> <activity android:name=".ActivityManageTriggerPhoneCall" />

View File

@ -12,10 +12,10 @@ import android.widget.Toast;
import com.google.android.gms.location.DetectedActivity; import com.google.android.gms.location.DetectedActivity;
import com.jens.automation2.receivers.ActivityDetectionReceiver; import com.jens.automation2.receivers.ActivityDetectionReceiver;
import java.sql.Time;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
public class Rule implements Comparable<Rule> public class Rule implements Comparable<Rule>
@ -23,9 +23,9 @@ public class Rule implements Comparable<Rule>
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>(); private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
public static boolean isAnyRuleActive = false; public static boolean isAnyRuleActive = false;
private static ArrayList<Rule> ruleRunHistory = new ArrayList<Rule>(); private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static ArrayList<Rule> getRuleRunHistory() public static List<Rule> getRuleRunHistory()
{ {
return ruleRunHistory; return ruleRunHistory;
} }
@ -834,7 +834,31 @@ public class Rule implements Comparable<Rule>
return ruleCandidates; return ruleCandidates;
}*/ }*/
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile) public static ArrayList<Rule> findRuleCandidatesByTriggerProfile(Profile profile)
{
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
for(Rule oneRule : ruleCollection)
{
innerloop:
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
{
String profileName = oneTrigger.getTriggerParameter2().split(triggerParameter2Split)[0];
if(profileName.equals(profile.getName()))
{
ruleCandidates.add(oneRule);
break innerloop; //if the profile is found we don't need to search the other triggers in the same rule
}
}
}
}
return ruleCandidates;
}
public static ArrayList<Rule> findRuleCandidatesByActionProfile(Profile profile)
{ {
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>(); ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();

View File

@ -51,6 +51,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> <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.GET_TASKS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.NFC" /> <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.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_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="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-feature <uses-feature
android:name="android.hardware.telephony" android:name="android.hardware.telephony"
@ -118,15 +120,7 @@
<receiver android:name=".receivers.PackageReplacedReceiver" <receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true"> android:enabled="true">
<intent-filter> <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" /> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receivers.DateTimeListener" /> <receiver android:name=".receivers.DateTimeListener" />
@ -151,6 +145,7 @@
<activity android:name=".ActivityDisplayLongMessage" /> <activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" /> <activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" /> <activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" /> <activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" /> <activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityManageTriggerPhoneCall" /> <activity android:name=".ActivityManageTriggerPhoneCall" />
@ -184,6 +179,7 @@
</intent-filter> </intent-filter>
--> -->
<!-- <!--
<meta-data <meta-data
android:name="android.nfc.action.TECH_DISCOVERED" android:name="android.nfc.action.TECH_DISCOVERED"
@ -217,7 +213,6 @@
<activity android:name=".ActivityPermissions" /> <activity android:name=".ActivityPermissions" />
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p--> <!-- 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"/> <uses-library android:name="org.apache.http.legacy" android:required="false"/>

View File

@ -8,10 +8,11 @@ import android.os.AsyncTask;
import android.os.Looper; import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import java.sql.Time;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
public class Rule implements Comparable<Rule> public class Rule implements Comparable<Rule>
@ -19,9 +20,9 @@ public class Rule implements Comparable<Rule>
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>(); private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
public static boolean isAnyRuleActive = false; public static boolean isAnyRuleActive = false;
private static ArrayList<Rule> ruleRunHistory = new ArrayList<Rule>(); private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static ArrayList<Rule> getRuleRunHistory() public static List<Rule> getRuleRunHistory()
{ {
return ruleRunHistory; return ruleRunHistory;
} }
@ -806,7 +807,31 @@ public class Rule implements Comparable<Rule>
return ruleCandidates; return ruleCandidates;
}*/ }*/
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile) public static ArrayList<Rule> findRuleCandidatesByTriggerProfile(Profile profile)
{
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
for(Rule oneRule : ruleCollection)
{
innerloop:
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
{
String profileName = oneTrigger.getTriggerParameter2().split(triggerParameter2Split)[0];
if(profileName.equals(profile.getName()))
{
ruleCandidates.add(oneRule);
break innerloop; //if the profile is found we don't need to search the other triggers in the same rule
}
}
}
}
return ruleCandidates;
}
public static ArrayList<Rule> findRuleCandidatesByActionProfile(Profile profile)
{ {
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>(); ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();

View File

@ -64,6 +64,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_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="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<application <application
android:allowBackup="true" android:allowBackup="true"
@ -113,15 +114,7 @@
<receiver android:name=".receivers.PackageReplacedReceiver" <receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true"> android:enabled="true">
<intent-filter> <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" /> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receivers.DateTimeListener" /> <receiver android:name=".receivers.DateTimeListener" />
@ -146,6 +139,7 @@
<activity android:name=".ActivityDisplayLongMessage" /> <activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" /> <activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" /> <activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" /> <activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" /> <activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityManageTriggerPhoneCall" /> <activity android:name=".ActivityManageTriggerPhoneCall" />
@ -213,7 +207,6 @@
<activity android:name=".ActivityPermissions" /> <activity android:name=".ActivityPermissions" />
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p--> <!-- 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"/> <uses-library android:name="org.apache.http.legacy" android:required="false"/>

View File

@ -12,10 +12,10 @@ import android.widget.Toast;
import com.google.android.gms.location.DetectedActivity; import com.google.android.gms.location.DetectedActivity;
import com.jens.automation2.receivers.ActivityDetectionReceiver; import com.jens.automation2.receivers.ActivityDetectionReceiver;
import java.sql.Time;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
public class Rule implements Comparable<Rule> public class Rule implements Comparable<Rule>
@ -23,9 +23,9 @@ public class Rule implements Comparable<Rule>
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>(); private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
public static boolean isAnyRuleActive = false; public static boolean isAnyRuleActive = false;
private static ArrayList<Rule> ruleRunHistory = new ArrayList<Rule>(); private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static ArrayList<Rule> getRuleRunHistory() public static List<Rule> getRuleRunHistory()
{ {
return ruleRunHistory; return ruleRunHistory;
} }
@ -834,7 +834,31 @@ public class Rule implements Comparable<Rule>
return ruleCandidates; return ruleCandidates;
}*/ }*/
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile) public static ArrayList<Rule> findRuleCandidatesByTriggerProfile(Profile profile)
{
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
for(Rule oneRule : ruleCollection)
{
innerloop:
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
{
String profileName = oneTrigger.getTriggerParameter2().split(triggerParameter2Split)[0];
if(profileName.equals(profile.getName()))
{
ruleCandidates.add(oneRule);
break innerloop; //if the profile is found we don't need to search the other triggers in the same rule
}
}
}
}
return ruleCandidates;
}
public static ArrayList<Rule> findRuleCandidatesByActionProfile(Profile profile)
{ {
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>(); ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();

View File

@ -154,95 +154,92 @@ public class Action
{ {
StringBuilder returnString = new StringBuilder(); StringBuilder returnString = new StringBuilder();
if(this.getAction().equals(Action_Enum.setWifi)) switch(getAction())
{ {
if(this.getParameter1()) case setWifi:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOff));
} break;
else if(this.getAction().equals(Action_Enum.setBluetooth)) case setBluetooth:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOff));
} break;
else if(this.getAction().equals(Action_Enum.setUsbTethering)) case setUsbTethering:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOff));
} break;
else if(this.getAction().equals(Action_Enum.setWifiTethering)) case setWifiTethering:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOff));
} break;
else if(this.getAction().equals(Action_Enum.setBluetoothTethering)) case setBluetoothTethering:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOff));
} break;
else if(this.getAction().equals(Action_Enum.setDisplayRotation)) case setDisplayRotation:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionEnableScreenRotation)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionEnableScreenRotation));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionDisableScreenRotation)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionDisableScreenRotation));
} break;
else if(this.getAction().equals(Action_Enum.setAirplaneMode)) case setAirplaneMode:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOff));
} break;
else if(this.getAction().equals(Action_Enum.setDataConnection)) case setDataConnection:
{ if (this.getParameter1())
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOff));
} break;
else if(this.getAction().equals(Action_Enum.startOtherActivity)) case startOtherActivity:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.startOtherActivity)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.startOtherActivity));
} break;
else if(this.getAction().equals(Action_Enum.triggerUrl)) case triggerUrl:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTriggerUrl)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTriggerUrl));
} break;
else if(this.getAction().equals(Action_Enum.speakText)) case speakText:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSpeakText)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSpeakText));
} break;
else if(this.getAction().equals(Action_Enum.playMusic)) case playMusic:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionPlayMusic)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionPlayMusic));
} break;
else if(this.getAction().equals(Action_Enum.sendTextMessage)) case sendTextMessage:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendTextMessage)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendTextMessage));
} break;
else if(this.getAction().equals(Action_Enum.turnScreenOnOrOff)) case turnScreenOnOrOff:
{ if (getParameter1())
if(getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOn)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOn));
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOff)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOff));
} break;
else if(this.getAction().equals(Action_Enum.playSound)) case playSound:
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound));
} break;
else 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()); returnString.append(action.toString());
}
if(this.getAction().equals(Action_Enum.triggerUrl)) if(this.getAction().equals(Action_Enum.triggerUrl))
{ {
@ -252,7 +249,7 @@ public class Action
returnString.append(": " + components[2]); returnString.append(": " + components[2]);
if(parameter1) if(parameter1)
returnString.append(" using authentication."); returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.usingAuthentication) + ".");
} }
else else
returnString.append(": " + components[0]); returnString.append(": " + components[0]);
@ -266,14 +263,14 @@ public class Action
String[] components = parameter2.split(Actions.smsSeparator); String[] components = parameter2.split(Actions.smsSeparator);
if(components.length >= 2) 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)) else if(this.getAction().equals(Action_Enum.setScreenBrightness))
{ {
returnString.append(" to "); returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.to) + " ");
if(parameter1) if(parameter1)
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto));

View File

@ -184,8 +184,16 @@ public class ActivityMainProfiles extends ActivityGeneric
startActivityForResult(manageSpecificProfileIntent, 2000); startActivityForResult(manageSpecificProfileIntent, 2000);
break; break;
case 2: case 2:
if(profile.delete(myAutomationService)) Rule user = profile.isInUseByRules();
if(user == null)
{
if (profile.delete(ActivityMainProfiles.this))
updateListView(); 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; break;
} }
} }

View File

@ -230,7 +230,7 @@ public class ActivityManageActionStartActivity extends Activity
return null; return null;
} }
private AlertDialog getActionStartActivityDialog1() private AlertDialog getActionStartActivityDialog1Application()
{ {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectApplication)); alertDialogBuilder.setTitle(getResources().getString(R.string.selectApplication));
@ -241,33 +241,78 @@ public class ActivityManageActionStartActivity extends Activity
public void onClick(DialogInterface dialog, int which) public void onClick(DialogInterface dialog, int which)
{ {
dialog.dismiss(); dialog.dismiss();
getActionStartActivityDialog2(applicationArray[which]).show(); getActionStartActivityDialog2(applicationArray[which]);
} }
}); });
AlertDialog alertDialog = alertDialogBuilder.create(); AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog; return alertDialog;
} }
private AlertDialog getActionStartActivityDialog2(String applicationName) private void getActionStartActivityDialog2(String applicationName)
{ {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectPackageOfApplication)); alertDialogBuilder.setTitle(getResources().getString(R.string.selectPackageOfApplication));
final String[] packageArray = ActivityManageActionStartActivity.getPackageListString(this, applicationName); final String[] packageArray = ActivityManageActionStartActivity.getPackageListString(this, applicationName);
if(packageArray.length > 1)
{
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener() alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
{ {
@Override @Override
public void onClick(DialogInterface dialog, int which) public void onClick(DialogInterface dialog, int which)
{ {
getActionStartActivityDialog3(packageArray[which]).show(); getActionStartActivityDialog4ActivityPickMethod(packageArray[which]).show();
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
} }
}); });
AlertDialog alertDialog = alertDialogBuilder.create(); 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; return alertDialog;
} }
private AlertDialog getActionStartActivityDialog3(final String packageName)
private AlertDialog getActionStartActivityDialog5Activity(final String packageName)
{ {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectActivityToBeStarted)); alertDialogBuilder.setTitle(getResources().getString(R.string.selectActivityToBeStarted));
@ -283,7 +328,6 @@ public class ActivityManageActionStartActivity extends Activity
} }
}); });
AlertDialog alertDialog = alertDialogBuilder.create(); AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog; return alertDialog;
} }
@ -598,7 +642,6 @@ public class ActivityManageActionStartActivity extends Activity
} }
}); });
AlertDialog alertDialog = alertDialogBuilder.create(); AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog; return alertDialog;
} }
@ -615,9 +658,7 @@ public class ActivityManageActionStartActivity extends Activity
protected void onPostExecute(Void result) protected void onPostExecute(Void result)
{ {
progressDialog.dismiss(); progressDialog.dismiss();
getActionStartActivityDialog1().show(); getActionStartActivityDialog1Application().show();
} }
} }
} }

View File

@ -3,7 +3,6 @@ package com.jens.automation2;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -14,6 +13,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.InputType; import android.text.InputType;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -50,34 +50,35 @@ public class ActivityManageRule extends Activity
{ {
final static String activityDetectionClassPath = "com.jens.automation2.receivers.ActivityDetectionReceiver"; final static String activityDetectionClassPath = "com.jens.automation2.receivers.ActivityDetectionReceiver";
public final static String intentNameTriggerParameter1 = "triggerParameter1"; public final static String intentNameTriggerParameter1 = "triggerParameter1";
public final static String intentNameTriggerParameter2 = "triggerParameter2";
public final static String intentNameActionParameter1 = "actionParameter1"; public final static String intentNameActionParameter1 = "actionParameter1";
public final static String intentNameActionParameter2 = "actionParameter2"; public final static String intentNameActionParameter2 = "actionParameter2";
public Context context; public Context context;
private Button cmdTriggerAdd, cmdActionAdd, cmdSaveRule; Button cmdTriggerAdd, cmdActionAdd, cmdSaveRule;
private ListView triggerListView, actionListView; ListView triggerListView, actionListView;
private EditText etRuleName; EditText etRuleName;
private CheckBox chkRuleActive, chkRuleToggle; CheckBox chkRuleActive, chkRuleToggle;
private static ActivityManageRule instance = null; static ActivityManageRule instance = null;
ImageView imageHelpButton; ImageView imageHelpButton;
private static ProgressDialog progressDialog = null; static ProgressDialog progressDialog = null;
private static Trigger_Enum triggerType; static Trigger_Enum triggerType;
private static boolean triggerParameter; static boolean triggerParameter;
private static PointOfInterest triggerPoi; static PointOfInterest triggerPoi;
private static String triggerProcess; static String triggerProcess;
private static int triggerBattery; static int triggerBattery;
private static double triggerSpeed; static double triggerSpeed;
private static double triggerNoise; static double triggerNoise;
private static TimeFrame triggerTimeFrame; static TimeFrame triggerTimeFrame;
private static String triggerWifiName; static String triggerWifiName;
private static Rule ruleToEdit; static Rule ruleToEdit;
private static boolean newRule; static boolean newRule;
private static Trigger newTrigger; static Trigger newTrigger;
private static Action newAction; static Action newAction;
ArrayAdapter<Trigger> triggerListViewAdapter; ArrayAdapter<Trigger> triggerListViewAdapter;
ArrayAdapter<Action> actionListViewAdapter; ArrayAdapter<Action> actionListViewAdapter;
@ -106,6 +107,8 @@ public class ActivityManageRule extends Activity
final static int requestCodeActionPlaySoundEdit = 502; final static int requestCodeActionPlaySoundEdit = 502;
final static int requestCodeTriggerPhoneCallAdd = 601; final static int requestCodeTriggerPhoneCallAdd = 601;
final static int requestCodeTriggerPhoneCallEdit = 602; final static int requestCodeTriggerPhoneCallEdit = 602;
final static int requestCodeTriggerProfileAdd = 603;
final static int requestCodeTriggerProfileEdit = 604;
final static int requestCodeTriggerWifiAdd = 723; final static int requestCodeTriggerWifiAdd = 723;
final static int requestCodeTriggerWifiEdit = 724; final static int requestCodeTriggerWifiEdit = 724;
final static int requestCodeActionSendTextMessageAdd = 5001; final static int requestCodeActionSendTextMessageAdd = 5001;
@ -271,11 +274,17 @@ public class ActivityManageRule extends Activity
phoneCallEditor.putExtra("edit", true); phoneCallEditor.putExtra("edit", true);
startActivityForResult(phoneCallEditor, requestCodeTriggerPhoneCallEdit); startActivityForResult(phoneCallEditor, requestCodeTriggerPhoneCallEdit);
break; 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: case wifiConnection:
Intent wifiEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerWifi.class); Intent wifiEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerWifi.class);
wifiEditor.putExtra("edit", true); wifiEditor.putExtra("edit", true);
wifiEditor.putExtra("wifiState", selectedTrigger.getTriggerParameter()); wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiState, selectedTrigger.getTriggerParameter());
wifiEditor.putExtra("wifiName", selectedTrigger.getTriggerParameter2()); wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiName, selectedTrigger.getTriggerParameter2());
startActivityForResult(wifiEditor, requestCodeTriggerWifiEdit); startActivityForResult(wifiEditor, requestCodeTriggerWifiEdit);
break; break;
case deviceOrientation: case deviceOrientation:
@ -496,6 +505,8 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.notification)); items.add(new Item(typesLong[i].toString(), R.drawable.notification));
else if(types[i].toString().equals(Trigger_Enum.deviceOrientation.toString())) else if(types[i].toString().equals(Trigger_Enum.deviceOrientation.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.smartphone)); 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 else
items.add(new Item(typesLong[i].toString(), R.drawable.placeholder)); items.add(new Item(typesLong[i].toString(), R.drawable.placeholder));
} }
@ -568,7 +579,6 @@ public class ActivityManageRule extends Activity
Intent wifiTriggerEditor = new Intent(myContext, ActivityManageTriggerWifi.class); Intent wifiTriggerEditor = new Intent(myContext, ActivityManageTriggerWifi.class);
startActivityForResult(wifiTriggerEditor, requestCodeTriggerWifiAdd); startActivityForResult(wifiTriggerEditor, requestCodeTriggerWifiAdd);
return; return;
// booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
} }
else if(triggerType == Trigger_Enum.deviceOrientation) else if(triggerType == Trigger_Enum.deviceOrientation)
{ {
@ -576,10 +586,7 @@ public class ActivityManageRule extends Activity
Intent devicePositionTriggerEditor = new Intent(myContext, ActivityManageTriggerDeviceOrientation.class); Intent devicePositionTriggerEditor = new Intent(myContext, ActivityManageTriggerDeviceOrientation.class);
startActivityForResult(devicePositionTriggerEditor, requestCodeTriggerDeviceOrientationAdd); startActivityForResult(devicePositionTriggerEditor, requestCodeTriggerDeviceOrientationAdd);
return; 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.process_started_stopped) else if(triggerType == Trigger_Enum.process_started_stopped)
booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)}; booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
else if(triggerType == Trigger_Enum.notification) else if(triggerType == Trigger_Enum.notification)
@ -599,7 +606,21 @@ public class ActivityManageRule extends Activity
Intent phoneTriggerEditor = new Intent(myContext, ActivityManageTriggerPhoneCall.class); Intent phoneTriggerEditor = new Intent(myContext, ActivityManageTriggerPhoneCall.class);
startActivityForResult(phoneTriggerEditor, requestCodeTriggerPhoneCallAdd); startActivityForResult(phoneTriggerEditor, requestCodeTriggerPhoneCallAdd);
return; 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) else if(triggerType == Trigger_Enum.activityDetection)
{ {
@ -622,7 +643,7 @@ public class ActivityManageRule extends Activity
} }
catch (IllegalAccessException | InvocationTargetException e) 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; return;
} }
@ -1030,7 +1051,6 @@ public class ActivityManageRule extends Activity
@Override @Override
protected String[] doInBackground(ActivityManageRule... params) protected String[] doInBackground(ActivityManageRule... params)
{ {
// Looper.prepare();
final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(params[0]); final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(params[0]);
return applicationArray; return applicationArray;
} }
@ -1166,8 +1186,8 @@ public class ActivityManageRule extends Activity
{ {
if(resultCode == RESULT_OK) if(resultCode == RESULT_OK)
{ {
newTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false)); newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
newTrigger.setTriggerParameter2(data.getStringExtra("wifiName")); newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
newTrigger.setParentRule(ruleToEdit); newTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().add(newTrigger); ruleToEdit.getTriggerSet().add(newTrigger);
this.refreshTriggerList(); this.refreshTriggerList();
@ -1179,8 +1199,8 @@ public class ActivityManageRule extends Activity
{ {
Trigger editedTrigger = new Trigger(); Trigger editedTrigger = new Trigger();
editedTrigger.setTriggerType(Trigger_Enum.wifiConnection); editedTrigger.setTriggerType(Trigger_Enum.wifiConnection);
editedTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false)); editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
editedTrigger.setTriggerParameter2(data.getStringExtra("wifiName")); editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
editedTrigger.setParentRule(ruleToEdit); editedTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger); ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
this.refreshTriggerList(); this.refreshTriggerList();
@ -1228,13 +1248,13 @@ public class ActivityManageRule extends Activity
{ {
ruleToEdit.getTriggerSet().add(newTrigger); ruleToEdit.getTriggerSet().add(newTrigger);
newTrigger.setTriggerParameter(data.getBooleanExtra("direction", false)); newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerNotification.intentNameNotificationDirection, false));
newTrigger.setTriggerParameter2( newTrigger.setTriggerParameter2(
data.getStringExtra("app") + Trigger.triggerParameter2Split + data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationApp) + Trigger.triggerParameter2Split +
data.getStringExtra("titleDir") + Trigger.triggerParameter2Split + data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitleDir) + Trigger.triggerParameter2Split +
data.getStringExtra("title") + Trigger.triggerParameter2Split + data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitle) + Trigger.triggerParameter2Split +
data.getStringExtra("textDir") + Trigger.triggerParameter2Split + data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTextDir) + Trigger.triggerParameter2Split +
data.getStringExtra("text") data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationText)
); );
newTrigger.setParentRule(ruleToEdit); newTrigger.setParentRule(ruleToEdit);
this.refreshTriggerList(); this.refreshTriggerList();
@ -1428,6 +1448,30 @@ public class ActivityManageRule extends Activity
this.refreshTriggerList(); 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 AlertDialog getActionTypeDialog() protected AlertDialog getActionTypeDialog()

View File

@ -43,7 +43,7 @@ public class ActivityManageTriggerDeviceOrientation extends Activity
{ {
desiredAzimuth = Float.parseFloat(etDesiredAzimuth.getText().toString()); desiredAzimuth = Float.parseFloat(etDesiredAzimuth.getText().toString());
desiredAzimuthTolerance = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString()); desiredAzimuthTolerance = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
if (Math.abs(azimuth) <= Math.abs(desiredAzimuth - desiredAzimuthTolerance) || Math.abs(azimuth) <= desiredAzimuth + desiredAzimuthTolerance) if (desiredAzimuthTolerance == 180 || (desiredAzimuth - desiredAzimuthTolerance <= azimuth && azimuth <= desiredAzimuth + desiredAzimuthTolerance))
{ {
tvAppliesAzimuth.setText(getResources().getString(R.string.yes)); tvAppliesAzimuth.setText(getResources().getString(R.string.yes));
tvAppliesAzimuth.setTextColor(Color.GREEN); tvAppliesAzimuth.setTextColor(Color.GREEN);
@ -63,7 +63,7 @@ public class ActivityManageTriggerDeviceOrientation extends Activity
{ {
desiredPitch = Float.parseFloat(etDesiredPitch.getText().toString()); desiredPitch = Float.parseFloat(etDesiredPitch.getText().toString());
desiredPitchTolerance = Float.parseFloat(etDesiredPitchTolerance.getText().toString()); desiredPitchTolerance = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
if (Math.abs(pitch) <= Math.abs(desiredPitch - desiredPitchTolerance) || Math.abs(pitch) <= desiredPitch + desiredPitchTolerance) if (desiredPitchTolerance == 180 || (desiredPitch - desiredPitchTolerance <= pitch && pitch <= desiredPitch + desiredPitchTolerance))
{ {
tvAppliesPitch.setText(getResources().getString(R.string.yes)); tvAppliesPitch.setText(getResources().getString(R.string.yes));
tvAppliesPitch.setTextColor(Color.GREEN); tvAppliesPitch.setTextColor(Color.GREEN);
@ -83,7 +83,7 @@ public class ActivityManageTriggerDeviceOrientation extends Activity
{ {
desiredRoll = Float.parseFloat(etDesiredRoll.getText().toString()); desiredRoll = Float.parseFloat(etDesiredRoll.getText().toString());
desiredRollTolerance = Float.parseFloat(etDesiredRollTolerance.getText().toString()); desiredRollTolerance = Float.parseFloat(etDesiredRollTolerance.getText().toString());
if (Math.abs(roll) <= Math.abs(desiredRoll - desiredRollTolerance) || Math.abs(roll) <= desiredRoll + desiredRollTolerance) if (desiredRollTolerance == 180 || (desiredRoll - desiredRollTolerance <= roll && roll <= desiredRoll + desiredRollTolerance))
{ {
tvAppliesRoll.setText(getResources().getString(R.string.yes)); tvAppliesRoll.setText(getResources().getString(R.string.yes));
tvAppliesRoll.setTextColor(Color.GREEN); tvAppliesRoll.setTextColor(Color.GREEN);
@ -159,14 +159,16 @@ public class ActivityManageTriggerDeviceOrientation extends Activity
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
// Round the values. Too long decimals will destroy the layout
if(!StringUtils.isEmpty(currentAzimuth.getText())) if(!StringUtils.isEmpty(currentAzimuth.getText()))
etDesiredAzimuth.setText(currentAzimuth.getText()); etDesiredAzimuth.setText(String.valueOf(Math.round(Float.parseFloat(currentAzimuth.getText().toString()))));
if(!StringUtils.isEmpty(currentPitch.getText())) if(!StringUtils.isEmpty(currentPitch.getText()))
etDesiredPitch.setText(currentPitch.getText()); etDesiredPitch.setText(String.valueOf(Math.round(Float.parseFloat(currentPitch.getText().toString()))));
if(!StringUtils.isEmpty(currentRoll.getText())) if(!StringUtils.isEmpty(currentRoll.getText()))
etDesiredRoll.setText(currentRoll.getText()); etDesiredRoll.setText(String.valueOf(Math.round(Float.parseFloat(currentRoll.getText().toString()))));
} }
}); });

View File

@ -31,6 +31,13 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
public class ActivityManageTriggerNotification extends Activity 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; public static Trigger editedNotificationTrigger;
boolean edit = false; boolean edit = false;
ProgressDialog progressDialog = null; ProgressDialog progressDialog = null;
@ -323,12 +330,12 @@ public class ActivityManageTriggerNotification extends Activity
else else
{ {
Intent data = new Intent(); Intent data = new Intent();
data.putExtra("direction", chkNotificationDirection.isChecked()); data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
data.putExtra("app", app); data.putExtra(intentNameNotificationApp, app);
data.putExtra("titleDir", titleDir); data.putExtra(intentNameNotificationTitleDir, titleDir);
data.putExtra("title", title); data.putExtra(intentNameNotificationTitle, title);
data.putExtra("textDir", textDir); data.putExtra(intentNameNotificationTextDir, textDir);
data.putExtra("text", text); data.putExtra(intentNameNotificationText, text);
ActivityManageTriggerNotification.this.setResult(RESULT_OK, data); ActivityManageTriggerNotification.this.setResult(RESULT_OK, data);
} }

View File

@ -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();
}
}
}

View File

@ -35,6 +35,9 @@ import java.util.List;
public class ActivityManageTriggerWifi extends Activity public class ActivityManageTriggerWifi extends Activity
{ {
public final static String intentNameWifiState = "wifiState";
public final static String intentNameWifiName = "wifiName";
RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected; RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected;
EditText etTriggerWifiName; EditText etTriggerWifiName;
Spinner spinnerWifiList; Spinner spinnerWifiList;

View File

@ -3,7 +3,6 @@ package com.jens.automation2;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
import android.content.ComponentName; import android.content.ComponentName;
@ -16,14 +15,13 @@ import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.Html; import android.text.Html;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.core.app.NotificationManagerCompat;
import com.jens.automation2.receivers.NotificationListener; import com.jens.automation2.receivers.NotificationListener;
@ -48,6 +46,7 @@ public class ActivityPermissions extends Activity
private static final int requestCodeForPermissionsBackgroundLocation = 12045; private static final int requestCodeForPermissionsBackgroundLocation = 12045;
private static final int requestCodeForPermissionsNotifications = 12046; private static final int requestCodeForPermissionsNotifications = 12046;
private static final int requestCodeForPermissionsDeviceAdmin = 12047; private static final int requestCodeForPermissionsDeviceAdmin = 12047;
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
protected String[] specificPermissionsToRequest = null; protected String[] specificPermissionsToRequest = null;
public static String intentExtraName = "permissionsToBeRequested"; public static String intentExtraName = "permissionsToBeRequested";
@ -288,6 +287,12 @@ public class ActivityPermissions extends Activity
{ {
return haveDeviceAdmin(); 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 else
{ {
int res = context.checkCallingOrSelfPermission(s); int res = context.checkCallingOrSelfPermission(s);
@ -341,11 +346,12 @@ public class ActivityPermissions extends Activity
for (Profile profile : Profile.getProfileCollection()) for (Profile profile : Profile.getProfileCollection())
{ {
if (profile.changeIncomingCallsRingtone) if (profile.changeIncomingCallsRingtone)
{
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions); 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) if (!onlyGeneral)
{ {
@ -851,6 +857,9 @@ public class ActivityPermissions extends Activity
for(String ruleName : getRulesUsing(Action.Action_Enum.turnScreenOnOrOff)) for(String ruleName : getRulesUsing(Action.Action_Enum.turnScreenOnOrOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName)); usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break; break;
case Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS:
usingElements.add(getResources().getString(R.string.recommendedForBetterReliability));
break;
} }
return usingElements; return usingElements;
@ -877,6 +886,7 @@ public class ActivityPermissions extends Activity
requestPermissions(cachedPermissionsToRequest, true); requestPermissions(cachedPermissionsToRequest, true);
} }
} }
if (requestCode == requestCodeForPermissionsDeviceAdmin) if (requestCode == requestCodeForPermissionsDeviceAdmin)
{ {
NotificationManager mNotificationManager = (NotificationManager) ActivityPermissions.this.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager mNotificationManager = (NotificationManager) ActivityPermissions.this.getSystemService(Context.NOTIFICATION_SERVICE);
@ -897,6 +907,10 @@ public class ActivityPermissions extends Activity
if (requestCode == requestCodeForPermissionsNotifications) if (requestCode == requestCodeForPermissionsNotifications)
if(havePermission(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, ActivityPermissions.this)) if(havePermission(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, ActivityPermissions.this))
requestPermissions(cachedPermissionsToRequest, true); requestPermissions(cachedPermissionsToRequest, true);
if (requestCode == requestCodeForPermissionsBatteryOptimization)
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
requestPermissions(cachedPermissionsToRequest, true);
} }
} }
@ -966,10 +980,20 @@ public class ActivityPermissions extends Activity
{ {
requiredPermissions.remove(s); requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions; cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"); Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
startActivityForResult(intent, requestCodeForPermissionsNotifications); startActivityForResult(intent, requestCodeForPermissionsNotifications);
return; 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) 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); AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.readLocation), getResources().getString(R.string.pleaseGiveBgLocation), ActivityPermissions.this);

View File

@ -216,6 +216,14 @@ public class Miscellaneous extends Service
return null; return null;
} }
public static int boolToInt(boolean input)
{
if(input)
return 1;
else
return 0;
}
@Override @Override
public IBinder onBind(Intent arg0) public IBinder onBind(Intent arg0)
{ {
@ -1065,6 +1073,23 @@ public class Miscellaneous extends Service
return ""; 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) public static boolean isGooglePlayInstalled(Context context)
{ {
// return false; // return false;

View File

@ -1,5 +1,6 @@
package com.jens.automation2; package com.jens.automation2;
import android.app.NotificationManager;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;
@ -14,10 +15,12 @@ import com.jens.automation2.Action.Action_Enum;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class Profile implements Comparable<Profile> 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 name;
protected String oldName; protected String oldName;
@ -267,7 +270,7 @@ public class Profile implements Comparable<Profile>
return hapticFeedback; return hapticFeedback;
} }
public static ArrayList<Profile> getProfileCollection() public static List<Profile> getProfileCollection()
{ {
return profileCollection; return profileCollection;
} }
@ -289,17 +292,11 @@ public class Profile implements Comparable<Profile>
return null; return null;
} }
public boolean delete(AutomationService myAutomationService)
{
// TODO Auto-generated method stub
return false;
}
private boolean applyRingTone(File ringtoneFile, int ringtoneType, Context context) private boolean applyRingTone(File ringtoneFile, int ringtoneType, Context context)
{ {
Miscellaneous.logEvent("i", "Profile", "Request to set ringtone to " + ringtoneFile.getAbsolutePath(), 3); 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(); String message = "Ringtone file does not exist or cannot read it: " + ringtoneFile.getAbsolutePath();
Miscellaneous.logEvent("i", "Profile", message, 3); Miscellaneous.logEvent("i", "Profile", message, 3);
@ -390,11 +387,23 @@ public class Profile implements Comparable<Profile>
} }
// Check if rules reference this profile // Check if rules reference this profile
ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByProfile(this); ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByActionProfile(this);
if(rulesThatReferenceMe.size() > 0) if(rulesThatReferenceMe.size() > 0)
{ {
for(Rule oneRule : rulesThatReferenceMe) 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()) for(Action oneAction : oneRule.getActionSet())
{ {
if(oneAction.getAction() == Action_Enum.changeSoundProfile) if(oneAction.getAction() == Action_Enum.changeSoundProfile)
@ -423,18 +432,49 @@ public class Profile implements Comparable<Profile>
return false; 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); return rule;
// write to file
return XmlFileInterface.writeFile();
} }
} }
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; return false;
} }
@ -463,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); Miscellaneous.logEvent("i", "Profile " + this.getName(), String.format(context.getResources().getString(R.string.profileActivate), this.getName()), 3);
profileActivationHistory.add(this);
AutomationService.getInstance().checkLockSoundChangesTimeElapsed(); AutomationService.getInstance().checkLockSoundChangesTimeElapsed();
if(AutomationService.getInstance().getLockSoundChangesEnd() == null) if(AutomationService.getInstance().getLockSoundChangesEnd() == null)
@ -534,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); 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 else
{ {
@ -541,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 @Override
public String toString() public String toString()
{ {

View File

@ -117,6 +117,10 @@ public class Trigger
if(!getParentRule().checkActivityDetection(this)) if(!getParentRule().checkActivityDetection(this))
result = false; result = false;
break; break;
case profileActive:
if(!checkProfileActive())
result = false;
break;
default: default:
break; break;
} }
@ -273,6 +277,43 @@ public class Trigger
return true; return true;
} }
boolean checkProfileActive()
{
String demandedProfileName = getTriggerParameter2().split(Trigger.triggerParameter2Split)[0];
boolean checkSettings = Boolean.parseBoolean(getTriggerParameter2().split(Trigger.triggerParameter2Split)[1]);
if(checkSettings)
{
Profile profile = Profile.getByName(demandedProfileName);
return profile.areMySettingsCurrentlyActive(Miscellaneous.getAnyContext());
}
else
{
try
{
Profile lastProfile = null;
if (Profile.profileActivationHistory.size() > 0)
{
lastProfile = Profile.profileActivationHistory.get(Profile.profileActivationHistory.size() - 1);
if (getTriggerParameter())
return demandedProfileName.equals(lastProfile.getName());
else
return !demandedProfileName.equals(lastProfile.getName());
}
else
return !getTriggerParameter();
}
catch (Exception e)
{
Miscellaneous.logEvent("w", "Trigger", "Error checking profile trigger.", 4);
}
}
return false;
}
boolean checkDeviceOrientation() boolean checkDeviceOrientation()
{ {
String deviceOrientationPieces[] = getTriggerParameter2().split(Trigger.triggerParameter2Split); String deviceOrientationPieces[] = getTriggerParameter2().split(Trigger.triggerParameter2Split);
@ -288,13 +329,7 @@ public class Trigger
if(desiredAzimuthTolerance < 180) if(desiredAzimuthTolerance < 180)
{ {
if ( if (!(desiredAzimuth - desiredAzimuthTolerance <= currentAzimuth && currentAzimuth <= desiredAzimuth + desiredAzimuthTolerance))
!(
Math.abs(currentAzimuth) <= Math.abs(desiredAzimuth - desiredAzimuthTolerance)
||
Math.abs(currentAzimuth) <= desiredAzimuth + desiredAzimuthTolerance
)
)
{ {
Miscellaneous.logEvent("i", "DeviceOrientation", "Azimuth outside of tolerance area.", 5); Miscellaneous.logEvent("i", "DeviceOrientation", "Azimuth outside of tolerance area.", 5);
if (getTriggerParameter()) if (getTriggerParameter())
@ -306,15 +341,7 @@ public class Trigger
if(desiredPitchTolerance < 180) if(desiredPitchTolerance < 180)
{ {
if ( if (!(desiredPitch - desiredPitchTolerance <= currentPitch && currentPitch <= desiredPitch + desiredPitchTolerance))
!(
(
Math.abs(currentPitch) <= Math.abs(desiredPitch - desiredPitchTolerance)
||
Math.abs(currentPitch) <= desiredPitch + desiredPitchTolerance
)
)
)
{ {
Miscellaneous.logEvent("i", "DeviceOrientation", "Pitch outside of tolerance area.", 5); Miscellaneous.logEvent("i", "DeviceOrientation", "Pitch outside of tolerance area.", 5);
if (getTriggerParameter()) if (getTriggerParameter())
@ -326,15 +353,7 @@ public class Trigger
if(desiredRollTolerance < 180) if(desiredRollTolerance < 180)
{ {
if ( if (!(desiredRoll - desiredRollTolerance <= currentRoll && currentRoll <= desiredRoll + desiredRollTolerance))
!(
(
Math.abs(currentRoll) <= Math.abs(desiredRoll - desiredRollTolerance)
||
Math.abs(currentRoll) <= desiredRoll + desiredRollTolerance
)
)
)
{ {
Miscellaneous.logEvent("i", "DeviceOrientation", "Roll outside of tolerance area.", 5); Miscellaneous.logEvent("i", "DeviceOrientation", "Roll outside of tolerance area.", 5);
if (getTriggerParameter()) if (getTriggerParameter())
@ -986,7 +1005,7 @@ public class Trigger
*/ */
public enum Trigger_Enum { public enum Trigger_Enum {
pointOfInterest, timeFrame, charging, batteryLevel, usb_host_connection, speed, noiseLevel, wifiConnection, process_started_stopped, airplaneMode, roaming, nfcTag, activityDetection, bluetoothConnection, headsetPlugged, notification, deviceOrientation, phoneCall; //phoneCall always needs to be at the very end because of Google's shitty so called privacy pointOfInterest, timeFrame, charging, batteryLevel, usb_host_connection, speed, noiseLevel, wifiConnection, process_started_stopped, airplaneMode, roaming, nfcTag, activityDetection, bluetoothConnection, headsetPlugged, notification, deviceOrientation, profileActive, phoneCall; //phoneCall always needs to be at the very end because of Google's shitty so called privacy
public String getFullName(Context context) public String getFullName(Context context)
{ {
@ -1028,6 +1047,8 @@ public class Trigger
return context.getResources().getString(R.string.notification); return context.getResources().getString(R.string.notification);
case deviceOrientation: case deviceOrientation:
return context.getResources().getString(R.string.deviceOrientation); return context.getResources().getString(R.string.deviceOrientation);
case profileActive:
return context.getResources().getString(R.string.profile);
default: default:
return "Unknown"; return "Unknown";
} }
@ -1261,11 +1282,11 @@ public class Trigger
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.leaving) + " "); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.leaving) + " ");
String repeat = ", no repetition"; String repeat = ", " + Miscellaneous.getAnyContext().getResources().getString(R.string.noRepetition);
if(this.getTimeFrame().getRepetition() > 0) if(this.getTimeFrame().getRepetition() > 0)
repeat = ", " + String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.repeatEveryXsecondsWithVariable), String.valueOf(this.getTimeFrame().getRepetition())); repeat = ", " + String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.repeatEveryXsecondsWithVariable), String.valueOf(this.getTimeFrame().getRepetition()));
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.triggerTimeFrame) + ": " + this.getTimeFrame().getTriggerTimeStart().toString() + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.until) + " " + this.getTimeFrame().getTriggerTimeStop().toString() + " on days " + this.getTimeFrame().getDayList().toString() + repeat); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.triggerTimeFrame) + ": " + this.getTimeFrame().getTriggerTimeStart().toString() + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.until) + " " + this.getTimeFrame().getTriggerTimeStop().toString() + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.onDays) + " " + this.getTimeFrame().getDayList().toString() + repeat);
break; break;
case speed: case speed:
if(getTriggerParameter()) if(getTriggerParameter())
@ -1310,11 +1331,11 @@ public class Trigger
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.airplaneMode)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.airplaneMode));
break; break;
case roaming: case roaming:
if(getTriggerParameter())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.activated) + " ");
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.deactivated) + " ");
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.roaming)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.roaming));
if(getTriggerParameter())
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.activated));
else
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.deactivated));
break; break;
case phoneCall: case phoneCall:
String[] elements = triggerParameter2.split(triggerParameter2Split); String[] elements = triggerParameter2.split(triggerParameter2Split);
@ -1346,24 +1367,9 @@ public class Trigger
else if(elements[0].equals(Trigger.triggerPhoneCallStateStopped)) else if(elements[0].equals(Trigger.triggerPhoneCallStateStopped))
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.stopped)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.stopped));
// returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.phoneCall));
// if(phoneNumber != null && !phoneNumber.equals("any"))
// returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.with) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.number) + " " + phoneNumber);
// else
// returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.with) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.anyNumber));
//
// if(getTriggerParameter())
// returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.started));
// else
// returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.stopped));
break; break;
case nfcTag: case nfcTag:
// This type doesn't have an activate/deactivate equivalent // This type doesn't have an activate/deactivate equivalent
// if(getTriggerParameter())
// returnString += Miscellaneous.getAnyContext().getResources().getString(R.string.activated) + " ";
// else
// returnString += Miscellaneous.getAnyContext().getResources().getString(R.string.deactivated) + " ";
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.closeTo) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.nfcTag) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.withLabel) + " " + this.getNfcTagId()); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.closeTo) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.nfcTag) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.withLabel) + " " + this.getNfcTagId());
break; break;
case activityDetection: case activityDetection:
@ -1373,21 +1379,7 @@ public class Trigger
if (ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION")) if (ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
{ {
// This type doesn't have an activate/deactivate equivalent, at least not yet. // This type doesn't have an activate/deactivate equivalent, at least not yet.
// try
// {
returnString.append(Miscellaneous.runMethodReflective(ActivityManageRule.activityDetectionClassPath, "getDescription", new Object[]{getActivityDetectionType()})); returnString.append(Miscellaneous.runMethodReflective(ActivityManageRule.activityDetectionClassPath, "getDescription", new Object[]{getActivityDetectionType()}));
// for(Method method : activityDetection.getMethods())
// {
// if(method.getName().equalsIgnoreCase("getDescription"))
// returnString.append(method.invoke());
//// returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.detectedActivity) + " " + activityDetection.getDescription(getActivityDetectionType()));
// }
// }
// catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException e)
// {
// e.printStackTrace();
// }
} }
else else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.featureNotInFdroidVersion)); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.featureNotInFdroidVersion));
@ -1449,7 +1441,7 @@ public class Trigger
type = Miscellaneous.getAnyContext().getResources().getString(R.string.headphoneAny); type = Miscellaneous.getAnyContext().getResources().getString(R.string.headphoneAny);
break; break;
default: default:
type = "not set"; type = Miscellaneous.getAnyContext().getResources().getString(R.string.notSet);
break; break;
} }
if(getTriggerParameter()) if(getTriggerParameter())
@ -1500,6 +1492,12 @@ public class Trigger
case deviceOrientation: case deviceOrientation:
returnString.append(Miscellaneous.getAnyContext().getString(R.string.deviceIsInCertainOrientation)); returnString.append(Miscellaneous.getAnyContext().getString(R.string.deviceIsInCertainOrientation));
break; break;
case profileActive:
if(triggerParameter)
returnString.append(String.format(Miscellaneous.getAnyContext().getString(R.string.profileActive), getTriggerParameter2().split(Trigger.triggerParameter2Split)[0]));
else
returnString.append(String.format(Miscellaneous.getAnyContext().getString(R.string.profileNotActive), getTriggerParameter2().split(Trigger.triggerParameter2Split)[0]));
break;
default: default:
returnString.append("error"); returnString.append("error");
break; break;

View File

@ -14,14 +14,6 @@ public class PackageReplacedReceiver extends BroadcastReceiver
@Override @Override
public void onReceive(Context context, Intent intent) 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); Settings.readFromPersistentStorage(context);
Miscellaneous.logEvent("i", context.getResources().getString(R.string.applicationHasBeenUpdated), context.getResources().getString(R.string.applicationHasBeenUpdated), 2); 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); 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() private static boolean hasServiceBeenRunning()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -22,7 +22,14 @@
<TableRow <TableRow
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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 <TextView
android:text="@string/orientationAzimuth" android:text="@string/orientationAzimuth"
@ -39,7 +46,14 @@
<TableRow <TableRow
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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 <TextView
android:text="@string/orientationPitch" android:text="@string/orientationPitch"
@ -56,7 +70,14 @@
<TableRow <TableRow
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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 <TextView
android:text="@string/orientationRoll" android:text="@string/orientationRoll"

View 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>

View File

@ -356,7 +356,7 @@
<string name="selectConnectionOption">Wählen Sie eine Verbindungsoption.</string> <string name="selectConnectionOption">Wählen Sie eine Verbindungsoption.</string>
<string name="triggerHeadsetPlugged">Headset Verbindung</string> <string name="triggerHeadsetPlugged">Headset Verbindung</string>
<string name="actionPlayMusic">Musikplayer öffnen</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="headsetDisconnected">Headset (type: %1$s) getrennt</string>
<string name="headphoneSimple">Kopfhörer</string> <string name="headphoneSimple">Kopfhörer</string>
<string name="headphoneMicrophone">Mikrofon</string> <string name="headphoneMicrophone">Mikrofon</string>
@ -630,7 +630,7 @@
<string name="deviceOrientationTimeAcceptIntervalTitle">Signal Häufigkeit</string> <string name="deviceOrientationTimeAcceptIntervalTitle">Signal Häufigkeit</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Neue Signale nur alle x Millisekunden akzeptieren</string> <string name="deviceOrientationTimeAcceptIntervalSummary">Neue Signale nur alle x Millisekunden akzeptieren</string>
<string name="deviceOrientationSettings">Geräteausrichtungseinstellungen</string> <string name="deviceOrientationSettings">Geräteausrichtungseinstellungen</string>
<string name="explanationDeviceOrientationDirection">Wenn das Häkchen gesetzt ist, bedeutet das, daß das Geräte in der angegebenen Ausrichtung sein muß. Wenn es nicht gesetzt ist, führt jede andere Ausrichtung zu einem positiven Ergebnis.</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="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="actionSetBluetoothTethering">Bluetooth Tethering</string>
<string name="actionTurnBluetoothTetheringOn">Bluetooth Tethering einschalten</string> <string name="actionTurnBluetoothTetheringOn">Bluetooth Tethering einschalten</string>
@ -640,4 +640,23 @@
<string name="triggerWrong">Mit diesem Auslöser stimmt etwas nicht. Er konnte nicht korrekt geladen werden.</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="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="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> </resources>

View File

@ -639,4 +639,23 @@
<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="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="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="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> </resources>

View File

@ -640,4 +640,23 @@
<string name="deviceOrientationSettings">Impostazioni di orientamento del dispositivo</string> <string name="deviceOrientationSettings">Impostazioni di orientamento del dispositivo</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Amministrazione dispositivo</string> <string name="android.permission.BIND_DEVICE_ADMIN">Amministrazione dispositivo</string>
<string name="deviceAdminNote">I permessi di amministratore del dispositivo sono necessari per almeno 1 delle regole che hai creato.</string> <string name="deviceAdminNote">I permessi di amministratore del dispositivo sono necessari per almeno 1 delle regole che hai creato.</string>
<string name="profileTriggerCheckSettings">Se questa casella di controllo non è disabilitata, verrà selezionata solo se il profilo selezionato è stato l\'ultimo ad essere attivato. Non importa se le impostazioni relative all\'audio sono state modificate esternamente.\nTuttavia, se la casella di controllo è abilitata, le impostazioni audio correnti devono essere definite nel profilo. ATTENZIONE: il controllo del file della suoneria non è ancora supportato.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Escludere dall\'ottimizzazione della batteria</string>
<string name="recommendedForBetterReliability">Consigliato per una migliore affidabilità</string>
<string name="needsToBeActive">Deve essere attivo</string>
<string name="checkSettings">Controlla le impostazioni</string>
<string name="profileActive">profilo %1$s è attivo</string>
<string name="profileNotActive">profilo %1$s non attivo</string>
<string name="ruleXIsUsingProfileY">Impossibile eliminare questo profilo. La regola %s$1 fa riferimento al profilo %s$2.</string>
<string name="profileCouldNotBeDeleted">Impossibile eliminare il profilo.</string>
<string name="noRepetition">nessuna ripetizione</string>
<string name="usingAuthentication">utilizzo dell\'autenticazione</string>
<string name="toNumber">al numero</string>
<string name="message">messaggio</string>
<string name="onDays">nei giorni</string>
<string name="notSet">non impostato</string>
<string name="takeLauncherActivity">Trova automaticamente</string>
<string name="pickActivityManually">Scegli manualmente</string>
<string name="launcherOrManualExplanation">Modalità semplice: l\'automazione può provare a identificare l\'attività di avvio del programma desiderato.\nIn alternativa puoi anche scegliere manualmente una delle attività dell\'applicazione.\nCosa vorresti?</string>
<string name="launcherNotFound">Impossibile identificare un\'attività di avvio di questa app. Dovrai sceglierne uno manualmente.</string>
</resources> </resources>

View File

@ -638,4 +638,23 @@
<string name="btTetheringNotice">Deze functie werkt naar verluidt tot Android 8.0. Vanaf een hogere versie werkt het niet meer, maar door een gebrek aan fysieke apparaten kan ik niet zeggen welke dat is. Op Android 11 werkt het absoluut niet meer. Als je een versie tussendoor hebt, laat het me dan weten of het werkt of niet.</string> <string name="btTetheringNotice">Deze functie werkt naar verluidt tot Android 8.0. Vanaf een hogere versie werkt het niet meer, maar door een gebrek aan fysieke apparaten kan ik niet zeggen welke dat is. Op Android 11 werkt het absoluut niet meer. Als je een versie tussendoor hebt, laat het me dan weten of het werkt of niet.</string>
<string name="deviceOrientationExplanation">Wanneer u uw apparaat verplaatst, worden de onderstaande nummers bijgewerkt. Wat je daar kunt zien, is de huidige oriëntatie van je apparaat gemeten in graden. Als het zich in de gewenste richting bevindt, klikt u op de knop Toepassen om de huidige waarden naar de gewenste velden te kopiëren.\nOmdat het zeer onwaarschijnlijk is dat u deze exacte oriëntatie ooit nog bereikt, moet u ook een tolerantie invoeren. Dit is het aantal graden waarin de oriëntatie in beide richtingen kan afwijken. 15° resulteert in een totale hoek van 30°, 15° in elke richting.\nAls u slechts om één specifieke as geeft, geef dan een tolerantie van 180° op voor de twee andere.</string> <string name="deviceOrientationExplanation">Wanneer u uw apparaat verplaatst, worden de onderstaande nummers bijgewerkt. Wat je daar kunt zien, is de huidige oriëntatie van je apparaat gemeten in graden. Als het zich in de gewenste richting bevindt, klikt u op de knop Toepassen om de huidige waarden naar de gewenste velden te kopiëren.\nOmdat het zeer onwaarschijnlijk is dat u deze exacte oriëntatie ooit nog bereikt, moet u ook een tolerantie invoeren. Dit is het aantal graden waarin de oriëntatie in beide richtingen kan afwijken. 15° resulteert in een totale hoek van 30°, 15° in elke richting.\nAls u slechts om één specifieke as geeft, geef dan een tolerantie van 180° op voor de twee andere.</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">Een tolerantie van 180 is alleen toegestaan voor 2 tolerantievelden, niet alle 3. Anders zou de trigger ALTIJD van toepassing zijn.</string> <string name="toleranceOf180OnlyAllowedIn2Fields">Een tolerantie van 180 is alleen toegestaan voor 2 tolerantievelden, niet alle 3. Anders zou de trigger ALTIJD van toepassing zijn.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Uitsluiten van batterijoptimalisatie</string>
<string name="recommendedForBetterReliability">Aanbevolen voor een betere betrouwbaarheid</string>
<string name="needsToBeActive">Moet actief zijn</string>
<string name="checkSettings">Instellingen controleren</string>
<string name="profileActive">profile %1$s is actief</string>
<string name="profileNotActive">profile %1$s is niet actief</string>
<string name="profileTriggerCheckSettings">Als dit selectievakje niet is uitgeschakeld, wordt het alleen aangevinkt als het geselecteerde profiel het laatste is dat is geactiveerd. Het maakt niet uit of audiogerelateerde instellingen extern zijn gewijzigd.\nAls het selectievakje echter is ingeschakeld, moeten de huidige audio-instellingen echt worden gedefinieerd in het profiel. PAS OP: Het controleren van het beltoonbestand wordt momenteel nog niet ondersteund.</string>
<string name="ruleXIsUsingProfileY">Kan dit profiel niet verwijderen. Regel %s$1 verwijst naar het profiel %s$2.</string>
<string name="profileCouldNotBeDeleted">Profiel kan niet worden verwijderd.</string>
<string name="noRepetition">geen herhaling</string>
<string name="usingAuthentication">authenticatie gebruiken</string>
<string name="toNumber">naar nummer</string>
<string name="message">Bericht</string>
<string name="onDays">op dagen</string>
<string name="notSet">niet ingesteld</string>
<string name="takeLauncherActivity">Automatisch zoeken</string>
<string name="pickActivityManually">Handmatig kiezen</string>
<string name="launcherNotFound">Een launcher-activiteit van deze app kon niet worden geïdentificeerd. U moet er handmatig een kiezen.</string>
<string name="launcherOrManualExplanation">Eenvoudige modus: Automatisering kan proberen de opstartactiviteit van het gewenste programma te identificeren.\nU kunt ook handmatig een van de activiteiten van de toepassing kiezen.\nWat wil je?</string>
</resources> </resources>

View File

@ -736,4 +736,23 @@
<string name="explanationDeviceOrientationDirection">If the checkbox is checked that means the device has to be in the orientation you specify. If it\'s not checked, any orientation that does NOT match your criteria will do.</string> <string name="explanationDeviceOrientationDirection">If the checkbox is checked that means the device has to be in the orientation you specify. If it\'s not checked, any orientation that does NOT match your criteria will do.</string>
<string name="permissionsRequiredNotAvailable">Your rules required permissions which cannot be requested from this installed flavor of Automation.</string> <string name="permissionsRequiredNotAvailable">Your rules required permissions which cannot be requested from this installed flavor of Automation.</string>
<string name="smsDialogNotice">If you have not used a send-sms action in this program before, Android may show an additional confirmation dialog, asking you to allow sending messages. You need to select the \"always allow\" checkbox and confirm if you want this action to work in the background. It\'s advised to run this rule manually once to provoke this confirmation dialog.</string> <string name="smsDialogNotice">If you have not used a send-sms action in this program before, Android may show an additional confirmation dialog, asking you to allow sending messages. You need to select the \"always allow\" checkbox and confirm if you want this action to work in the background. It\'s advised to run this rule manually once to provoke this confirmation dialog.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Exclude from battery optimization</string>
<string name="recommendedForBetterReliability">Recommended for better reliability</string>
<string name="needsToBeActive">Needs to be active</string>
<string name="checkSettings">Check settings</string>
<string name="profileActive">profile %1$s is active</string>
<string name="profileNotActive">profile %1$s is not active</string>
<string name="profileTriggerCheckSettings">If this checkbox is not disabled, it will only be checked if the selected profile has been the last one to be activated. It doesn\'t matter if any audio related settings have been changed externally. However if the checkbox is enabled, the current audio settings really need to be like defined in the profile. BEWARE: Checking the ringtone file is currently not supported, yet.</string>
<string name="ruleXIsUsingProfileY">Cannot delete this profile. Rule %s$1 is referencing profile %s$2.</string>
<string name="profileCouldNotBeDeleted">Profile could not be deleted.</string>
<string name="noRepetition">no repetition</string>
<string name="usingAuthentication">using authentication</string>
<string name="toNumber">to number</string>
<string name="message">message</string>
<string name="onDays">on days</string>
<string name="notSet">not set</string>
<string name="takeLauncherActivity">Find automatically</string>
<string name="pickActivityManually">Choose manually</string>
<string name="launcherOrManualExplanation">Easy mode: Automation can try to identify the launcher activity of the desired program automatically. Alternatively you can also pick one of the application\'s activities manually. What would you like?</string>
<string name="launcherNotFound">A launcher activity of this app could not be identified. You will have to pick one manually.</string>
</resources> </resources>

View File

@ -0,0 +1,4 @@
* Neue Berechtigung: Ausschluss von der Batterieoptimierung
* Neuer Auslöser: Profile können als Auslöser verwendet werden
* Behoben: Fehler im Geräteausrichtungs-Auslöser
* Aktion "App starten" etwas vereinfacht

View File

@ -0,0 +1,4 @@
* New permission requested: Exclusion from battery optimization
* New trigger: Profiles can be used as trigger
* Fixed: Bug in orientation trigger
* "Start app" action simplified a bit

View File

@ -0,0 +1 @@
* New action: Create notification

View File

@ -0,0 +1,4 @@
* Nuevo permiso solicitado: Exclusión de la optimización de la batería
* Nuevo disparador: los perfiles se pueden utilizar como disparador
* Corregido: Error en el disparador de orientación
* La acción "Iniciar aplicación" se simplificó un poco

View File

@ -0,0 +1,4 @@
* Nuova autorizzazione richiesta: esclusione dall'ottimizzazione della batteria
* Nuovo trigger: i profili possono essere utilizzati come trigger
* Risolto: Bug nel trigger di orientamento
* Azione "Start app" semplificata un po '

View File

@ -0,0 +1,4 @@
* Nieuwe toestemming gevraagd: Uitsluiting van batterij optimalisatie
* Nieuwe trigger: Profielen kunnen worden gebruikt als trigger
* Opgelost: Bug in oriëntatie trigger
* "Start app" actie een beetje vereenvoudigd