Merge remote-tracking branch 'origin/development-stable' into development

# Conflicts:
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-es/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-nl/strings.xml
#	app/src/main/res/values/strings.xml
#	build.gradle
#	fastlane/metadata/android/en-US/changelogs/119.txt
This commit is contained in:
jens 2022-05-15 01:54:32 +02:00
commit 41efa7c11b
36 changed files with 283 additions and 140 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 31
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 118
versionName "1.7.4"
versionCode 119
versionName "1.7.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

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

View File

@ -21,23 +21,23 @@ import java.util.List;
public class Rule implements Comparable<Rule>
{
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
protected static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
protected static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static List<Rule> getRuleRunHistory()
{
return ruleRunHistory;
}
private ArrayList<Trigger> triggerSet;
private ArrayList<Action> actionSet;
private String name;
private boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
private boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
private Calendar lastExecution;
protected ArrayList<Trigger> triggerSet;
protected ArrayList<Action> actionSet;
protected String name;
protected boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
protected boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
protected Calendar lastExecution;
private static Date lastActivatedRuleActivationTime;
protected static Date lastActivatedRuleActivationTime;
public Calendar getLastExecution()
{
@ -185,6 +185,7 @@ public class Rule implements Comparable<Rule>
if(this.checkBeforeSaving(context, true))
{
Miscellaneous.logEvent("i", "Rule", "Changing rule: " + this.toString(), 3);
boolean returnValue = XmlFileInterface.writeFile();
if(returnValue)
@ -233,12 +234,16 @@ public class Rule implements Comparable<Rule>
}
if(!changeExistingRule)
{
for (Rule rule : Rule.ruleCollection)
{
if (rule.getName().equals(this.getName()))
{
Toast.makeText(context, context.getResources().getString(R.string.anotherRuleByThatName), Toast.LENGTH_LONG).show();
return false;
}
}
}
if(this.getTriggerSet().size() == 0)
{
@ -334,6 +339,15 @@ public class Rule implements Comparable<Rule>
{
if (oneTrigger.hasStateNotAppliedSinceLastRuleExecution())
return true;
/*
Workaround for repetition in TimeFrame triggers
*/
if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.timeFrame))
{
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
}
return false;

View File

@ -18,23 +18,23 @@ import java.util.List;
public class Rule implements Comparable<Rule>
{
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
protected static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
protected static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static List<Rule> getRuleRunHistory()
{
return ruleRunHistory;
}
private ArrayList<Trigger> triggerSet;
private ArrayList<Action> actionSet;
private String name;
private boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
private boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
private Calendar lastExecution;
protected ArrayList<Trigger> triggerSet;
protected ArrayList<Action> actionSet;
protected String name;
protected boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
protected boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
protected Calendar lastExecution;
private static Date lastActivatedRuleActivationTime;
protected static Date lastActivatedRuleActivationTime;
public Calendar getLastExecution()
{
@ -182,6 +182,7 @@ public class Rule implements Comparable<Rule>
if(this.checkBeforeSaving(context, true))
{
Miscellaneous.logEvent("i", "Rule", "Changing rule: " + this.toString(), 3);
boolean returnValue = XmlFileInterface.writeFile();
if(returnValue)
@ -230,12 +231,16 @@ public class Rule implements Comparable<Rule>
}
if(!changeExistingRule)
{
for (Rule rule : Rule.ruleCollection)
{
if (rule.getName().equals(this.getName()))
{
Toast.makeText(context, context.getResources().getString(R.string.anotherRuleByThatName), Toast.LENGTH_LONG).show();
return false;
}
}
}
if(this.getTriggerSet().size() == 0)
{
@ -331,6 +336,15 @@ public class Rule implements Comparable<Rule>
{
if (oneTrigger.hasStateNotAppliedSinceLastRuleExecution())
return true;
/*
Workaround for repetition in TimeFrame triggers
*/
if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.timeFrame))
{
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
}
return false;

View File

@ -21,23 +21,23 @@ import java.util.List;
public class Rule implements Comparable<Rule>
{
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
protected static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
protected static List<Rule> ruleRunHistory = new ArrayList<Rule>();
public static List<Rule> getRuleRunHistory()
{
return ruleRunHistory;
}
private ArrayList<Trigger> triggerSet;
private ArrayList<Action> actionSet;
private String name;
private boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
private boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
private Calendar lastExecution;
protected ArrayList<Trigger> triggerSet;
protected ArrayList<Action> actionSet;
protected String name;
protected boolean ruleActive = true; // rules can be deactivated, so they won't fire if you don't want them temporarily
protected boolean ruleToggle = false; // rule will run again and do the opposite of its actions if applicable
protected Calendar lastExecution;
private static Date lastActivatedRuleActivationTime;
protected static Date lastActivatedRuleActivationTime;
public Calendar getLastExecution()
{
@ -185,6 +185,7 @@ public class Rule implements Comparable<Rule>
if(this.checkBeforeSaving(context, true))
{
Miscellaneous.logEvent("i", "Rule", "Changing rule: " + this.toString(), 3);
boolean returnValue = XmlFileInterface.writeFile();
if(returnValue)
@ -233,12 +234,16 @@ public class Rule implements Comparable<Rule>
}
if(!changeExistingRule)
{
for (Rule rule : Rule.ruleCollection)
{
if (rule.getName().equals(this.getName()))
{
Toast.makeText(context, context.getResources().getString(R.string.anotherRuleByThatName), Toast.LENGTH_LONG).show();
return false;
}
}
}
if(this.getTriggerSet().size() == 0)
{
@ -334,6 +339,15 @@ public class Rule implements Comparable<Rule>
{
if (oneTrigger.hasStateNotAppliedSinceLastRuleExecution())
return true;
/*
Workaround for repetition in TimeFrame triggers
*/
if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.timeFrame))
{
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
}
return false;

View File

@ -222,6 +222,10 @@ public class ActivityControlCenter extends Activity
}
Settings.readFromPersistentStorage(ActivityControlCenter.this);
AutomationService service = AutomationService.getInstance();
if(service != null && service.isRunning)
service.applySettingsAndRules();
}
else
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noFilesImported), Toast.LENGTH_LONG).show();
@ -342,13 +346,16 @@ public class ActivityControlCenter extends Activity
public static String getSystemInfo()
{
StringBuilder systemInfoText = new StringBuilder();
systemInfoText.append("App details" + Miscellaneous.lineSeparator);
systemInfoText.append("Version name: " + BuildConfig.VERSION_NAME + Miscellaneous.lineSeparator);
systemInfoText.append("Version code: " + BuildConfig.VERSION_CODE + Miscellaneous.lineSeparator);
systemInfoText.append("Flavor: " + BuildConfig.FLAVOR + Miscellaneous.lineSeparator);
systemInfoText.append("Device details" + Miscellaneous.lineSeparator);
systemInfoText.append("OS version: " + System.getProperty("os.version") + Miscellaneous.lineSeparator);
systemInfoText.append("API Level: " + android.os.Build.VERSION.SDK + Miscellaneous.lineSeparator);
systemInfoText.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
systemInfoText.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
systemInfoText.append("Product: " + android.os.Build.PRODUCT + Miscellaneous.lineSeparator);
systemInfoText.append("Flavor: " + BuildConfig.FLAVOR + Miscellaneous.lineSeparator);
systemInfoText.append("Country: " + Miscellaneous.getUserCountry(Miscellaneous.getAnyContext()) + Miscellaneous.lineSeparator);
systemInfoText.append("OS language: " + Locale.getDefault().getDisplayName());

View File

@ -25,6 +25,7 @@ import java.util.ArrayList;
public class ActivityMainRules extends ActivityGeneric
{
public static final String intentNameRuleName = "ruleName";
private ListView ruleListView;
ArrayList<Rule> ruleList = new ArrayList<>();
private ArrayAdapter<Rule> ruleListViewAdapter;
@ -207,8 +208,8 @@ public class ActivityMainRules extends ActivityGeneric
Toast.makeText(ActivityMainRules.this, getResources().getString(R.string.serviceHasToRunForThat), Toast.LENGTH_LONG).show();
break;
case 1:
ruleToEdit = ruleThisIsAbout;
Intent manageSpecificRuleIntent = new Intent (ActivityMainRules.this, ActivityManageRule.class);
manageSpecificRuleIntent.putExtra(intentNameRuleName, ruleThisIsAbout.getName());
startActivityForResult(manageSpecificRuleIntent, requestCodeChangeRule);
break;
case 2:
@ -251,15 +252,5 @@ public class ActivityMainRules extends ActivityGeneric
}
catch(NullPointerException e)
{}
try
{
if(AutomationService.isMyServiceRunning(this))
DateTimeListener.reloadAlarms();
}
catch(NullPointerException e)
{
// AlarmManager instance not prepared, yet.
}
}
}

View File

@ -378,7 +378,7 @@ public class ActivityManageActionStartActivity extends Activity
public void onClick(View v)
{
int targetSdkVersion = getApplicationContext().getApplicationInfo().targetSdkVersion;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && targetSdkVersion >= 30)
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && targetSdkVersion >= 30 && !ActivityPermissions.havePermission(Manifest.permission.QUERY_ALL_PACKAGES, ActivityManageActionStartActivity.this))// && shouldShowRequestPermissionRationale(Manifest.permission.QUERY_ALL_PACKAGES))
{
requestPermissions(new String[] {Manifest.permission.QUERY_ALL_PACKAGES}, requestCodeForRequestQueryAllPackagesPermission);
}

View File

@ -34,7 +34,6 @@ public class ActivityManagePoi extends Activity
public LocationManager myLocationManager;
MyLocationListenerGps myLocationListenerGps = new MyLocationListenerGps();
Location locationGps = null, locationNetwork = null;
// Location locationWifi = null;
MyLocationListenerNetwork myLocationListenerNetwork = new MyLocationListenerNetwork();
Button bGetPosition, bSavePoi;
ImageButton ibShowOnMap;

View File

@ -71,12 +71,13 @@ public class ActivityManageRule extends Activity
static double triggerSpeed;
static double triggerNoise;
static Rule ruleToEdit;
static boolean newRule;
static Trigger newTrigger;
static Action newAction;
Rule ruleToEdit = null;
ArrayAdapter<Trigger> triggerListViewAdapter;
ArrayAdapter<Action> actionListViewAdapter;
@ -130,10 +131,10 @@ public class ActivityManageRule extends Activity
@Override
protected void onCreate(Bundle savedInstanceState)
{
context = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_specific_rule);
context = this;
instance = this;
cmdTriggerAdd = (Button)findViewById(R.id.cmdTriggerAdd);
@ -147,7 +148,17 @@ public class ActivityManageRule extends Activity
imageHelpButton = (ImageView)findViewById(R.id.imageHelpButton);
//decide if it will be created anew or loaded to edit an existing one
if(ActivityMainRules.ruleToEdit == null)
if(getIntent().hasExtra(ActivityMainRules.intentNameRuleName))
{
// change existing rule
Miscellaneous.logEvent("i", "Rule", "Cache not empty, assuming change request.", 3);
newRule = false;
ruleToEdit = Rule.getByName(getIntent().getStringExtra(ActivityMainRules.intentNameRuleName));
triggerListViewAdapter = new ArrayAdapter<Trigger>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getTriggerSet());
actionListViewAdapter = new ArrayAdapter<Action>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getActionSet());
loadVariablesIntoGui();
}
else
{
// new rule
Miscellaneous.logEvent("i", "Rule", "Cache empty, assuming create request.", 3);
@ -158,16 +169,6 @@ public class ActivityManageRule extends Activity
triggerListViewAdapter = new ArrayAdapter<Trigger>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getTriggerSet());
actionListViewAdapter = new ArrayAdapter<Action>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getActionSet());
}
else
{
// change existing rule
Miscellaneous.logEvent("i", "Rule", "Cache not empty, assuming change request.", 3);
newRule = false;
ruleToEdit = ActivityMainRules.ruleToEdit;
triggerListViewAdapter = new ArrayAdapter<Trigger>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getTriggerSet());
actionListViewAdapter = new ArrayAdapter<Action>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ruleToEdit.getActionSet());
loadVariablesIntoGui();
}
cmdTriggerAdd.setOnClickListener(new OnClickListener()
{
@ -256,8 +257,9 @@ public class ActivityManageRule extends Activity
switch(selectedTrigger.getTriggerType())
{
case timeFrame:
ActivityManageTriggerTimeFrame.editedTimeFrameTrigger = selectedTrigger;
Intent timeFrameEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerTimeFrame.class);
timeFrameEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
timeFrameEditor.putExtra(intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
startActivityForResult(timeFrameEditor, requestCodeTriggerTimeframeEdit);
break;
case bluetoothConnection:
@ -1250,9 +1252,15 @@ public class ActivityManageRule extends Activity
else if(requestCode == requestCodeTriggerTimeframeEdit)
{
//edit TimeFrame
if(resultCode == RESULT_OK && ActivityManageTriggerTimeFrame.editedTimeFrameTrigger != null)
if(resultCode == RESULT_OK && data.hasExtra(intentNameTriggerParameter2))
{
ActivityManageTriggerTimeFrame.editedTimeFrameTrigger.setParentRule(ruleToEdit);
Trigger responseTimeFrame = new Trigger();
responseTimeFrame.setTriggerType(Trigger_Enum.timeFrame);
responseTimeFrame.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
responseTimeFrame.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
responseTimeFrame.setTimeFrame(new TimeFrame(data.getStringExtra(intentNameTriggerParameter2)));
responseTimeFrame.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().set(editIndex, responseTimeFrame);
this.refreshTriggerList();
}
else

View File

@ -1,6 +1,7 @@
package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
@ -27,7 +28,7 @@ public class ActivityManageTriggerTimeFrame extends Activity
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
EditText etRepeatEvery;
public static Trigger editedTimeFrameTrigger = null;
static Trigger editedTimeFrameTrigger = null;
@Override
protected void onCreate(Bundle savedInstanceState)
@ -152,8 +153,13 @@ public class ActivityManageTriggerTimeFrame extends Activity
}
editedTimeFrameTrigger.setTriggerParameter(radioTimeFrameEntering.isChecked());
editedTimeFrameTrigger.setTriggerParameter2(editedTimeFrameTrigger.getTimeFrame().toTriggerParameter2String());
setResult(RESULT_OK);
Intent response = new Intent();
response.putExtra(ActivityManageRule.intentNameTriggerParameter1, editedTimeFrameTrigger.getTriggerParameter());
response.putExtra(ActivityManageRule.intentNameTriggerParameter2, editedTimeFrameTrigger.getTriggerParameter2());
setResult(RESULT_OK, response);
finish();
}
});
@ -167,9 +173,15 @@ public class ActivityManageTriggerTimeFrame extends Activity
}
});
if(editedTimeFrameTrigger.getTimeFrame() != null)
if(getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter2))
{
editedTimeFrameTrigger = new Trigger();
editedTimeFrameTrigger.setTriggerParameter(getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
editedTimeFrameTrigger.setTriggerParameter2(getIntent().getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(editedTimeFrameTrigger.getTriggerParameter2()));
loadVariableIntoGui();
}
}
private void loadVariableIntoGui()
{
@ -219,5 +231,4 @@ public class ActivityManageTriggerTimeFrame extends Activity
etRepeatEvery.setText(String.valueOf(editedTimeFrameTrigger.getTimeFrame().getRepetition()));
}
}
}

View File

@ -904,6 +904,9 @@ public class ActivityPermissions extends Activity
case Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS:
usingElements.add(getResources().getString(R.string.recommendedForBetterReliability));
break;
case Manifest.permission.QUERY_ALL_PACKAGES:
usingElements.add(getResources().getString(R.string.queryAllPackages));
break;
}
return usingElements;

View File

@ -28,6 +28,7 @@ import androidx.core.app.NotificationManagerCompat;
import com.jens.automation2.Trigger.Trigger_Enum;
import com.jens.automation2.location.LocationProvider;
import com.jens.automation2.receivers.DateTimeListener;
import com.jens.automation2.receivers.PackageReplacedReceiver;
import com.jens.automation2.receivers.PhoneStatusListener;
@ -58,6 +59,8 @@ public class AutomationService extends Service implements OnInitListener
protected Calendar lockSoundChangesEnd = null;
protected boolean isRunning;
protected static AutomationService centralInstance = null;
public void nullLockSoundChangesEnd()
{
lockSoundChangesEnd = null;
@ -95,8 +98,6 @@ public class AutomationService extends Service implements OnInitListener
return myLocationProvider;
}
protected static AutomationService centralInstance = null;
public static AutomationService getInstance()
{
return centralInstance;
@ -288,6 +289,8 @@ public class AutomationService extends Service implements OnInitListener
myLocationProvider.applySettingsAndRules();
ReceiverCoordinator.applySettingsAndRules();
DateTimeListener.reloadAlarms();
}
@Override
@ -466,6 +469,8 @@ public class AutomationService extends Service implements OnInitListener
ttsEngine.shutdown();
PackageReplacedReceiver.setHasServiceBeenRunning(false, this);
centralInstance = null;
}
protected static Builder createDefaultNotificationBuilderOld()

View File

@ -1840,7 +1840,8 @@ public class Miscellaneous extends Service
* @param context Context reference to get the TelephonyManager instance from
* @return country code or null
*/
public static String getUserCountry(Context context) {
public static String getUserCountry(Context context)
{
try
{
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

View File

@ -80,6 +80,29 @@ public class TimeFrame
this.setRepetition(Long.parseLong(dateArray[3]));
}
public String toTriggerParameter2String()
{
StringBuilder response = new StringBuilder();
response.append(this.getTriggerTimeStart().getHours() + ":" + this.getTriggerTimeStart().getMinutes() + ":0");
response.append(separator);
response.append(this.getTriggerTimeStop().getHours() + ":" + this.getTriggerTimeStop().getMinutes() + ":0");
response.append(separator);
StringBuilder days = new StringBuilder();
for(int day : dayList)
days.append(String.valueOf(day));
response.append(days.toString());
if(this.repetition > 0)
{
response.append(separator + this.getRepetition());
}
return response.toString();
}
@Override
public String toString()
{

View File

@ -935,7 +935,7 @@ public class Trigger
Miscellaneous.compareTimes(tf.getTriggerTimeStart(), tf.getTriggerTimeStop()) < 0
&&
(Miscellaneous.compareTimes(tf.getTriggerTimeStart(), nowTime) >= 0
|
||
Miscellaneous.compareTimes(nowTime, tf.getTriggerTimeStop()) > 0)
)

View File

@ -254,8 +254,6 @@ public class XmlFileInterface
else
serializer.text("null");
}
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.timeFrame)
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTimeFrame().toString());
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.speed)
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getSpeed()));
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.noiseLevel)
@ -838,7 +836,6 @@ public class XmlFileInterface
private static Trigger readTrigger(XmlPullParser parser) throws IOException, XmlPullParserException
{
/* FILE EXAMPE:
* *****************
* <Automation>

View File

@ -41,6 +41,7 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
if(newWifiSsid.startsWith("\"") && newWifiSsid.endsWith("\""))
newWifiSsid = newWifiSsid.substring(1, newWifiSsid.length()-1);
if(newWifiSsid.length() > 0)
WifiBroadcastReceiver.lastWifiSsid = newWifiSsid;
}

View File

@ -27,12 +27,10 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
{
private static AutomationService automationServiceRef;
private static AlarmManager centralAlarmManagerInstance;
// private static Intent alarmIntent;
// private static PendingIntent alarmPendingIntent;
private static boolean alarmListenerActive=false;
private static ArrayList<ScheduleElement> alarmCandidates = new ArrayList<>();
private static ArrayList<Integer> requestCodeList = new ArrayList<Integer>();
static PendingIntent alarmPendingIntent = null;
public static void startAlarmListener(final AutomationService automationServiceRef)
{
@ -52,12 +50,8 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
public void onReceive(Context context, Intent intent)
{
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
Date now = new Date();
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
Time passTime = Time.valueOf(timeString);
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
// ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
for(int i=0; i < allRulesWithNowInTimeFrame.size(); i++)
{
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
@ -79,22 +73,6 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
int i=0;
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// // add 5 minutes to the calendar object
// cal.add(Calendar.SECOND, 10);
// String calSetWorkingCopyString2 = null;
// SimpleDateFormat sdf2 = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
// if (cal != null)
// {
// calSetWorkingCopyString2 = sdf2.format(cal.getTime());
// }
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
// requestCodeList.add(0);
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
allRulesWithTimeFrames = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
// allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
@ -264,11 +242,10 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
}
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate.time.getTimeInMillis(), alarmPendingIntent);
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(scheduleCandidate.time.getTimeInMillis());
Miscellaneous.logEvent("i", "AlarmManager", "Chose " + sdf.format(calendar.getTime()) + " as next scheduled alarm.", 4);
@ -280,7 +257,8 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
for(int requestCode : requestCodeList)
{
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
if(alarmPendingIntent == null)
alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
centralAlarmManagerInstance.cancel(alarmPendingIntent);
}
@ -316,7 +294,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
{
Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4);
clearAlarms();
// centralAlarmManagerInstance.cancel(alarmPendingIntent);
centralAlarmManagerInstance.cancel(alarmPendingIntent);
alarmListenerActive = false;
}
else
@ -403,8 +381,6 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
// if(this.applies(null))
// {
// If the starting time is a day ahead remove 1 day.
if(calSet.getTimeInMillis() > now.getTimeInMillis())
calSet.add(Calendar.DAY_OF_MONTH, -1);
@ -419,11 +395,8 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
* Das war mal aktiviert. Allerdings: Die ganze Funktion liefert zurück, wenn die Regel NOCH nicht
* zutrifft, aber wir z.B. gleich den zeitlichen Bereich betreten.
*/
// if(trigger.checkDateTime(calSchedule.getTime(), false))
// {
return calSchedule;
// }
// }
}
else
Miscellaneous.logEvent("i", "DateTimeListener", "Trigger " + trigger.toString() + " is not executed repeatedly.", 5);

View File

@ -57,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberSigned" />
android:inputType="text" />
</TableRow>
@ -78,7 +78,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberSigned" />
android:inputType="text" />
</TableRow>
<TableRow

View File

@ -700,6 +700,7 @@
<string name="locationNotWorkingOn12">Das Abrufen des Standorts scheint unter Android 12 derzeit nicht zu funktionieren. Wenn es bei Ihnen nicht klappt, tut mir das leid. Ich werde versuchen die Ursache zu beheben, sobald mir die Ursache bekannt ist. Wenn der Donut bei Ihnen also nicht aufhört sich zu drehen, wissen Sie warum.</string>
<string name="profileXrequiresThis">Profil \"%1$s\" benötigt dies.</string>
<string name="lastProfile">Letztes Profil:</string>
<string name="queryAllPackages">Liste von installierten Anwendungen auslesen</string>
<string name="serviceStarts">Dienst startet</string>
<string name="deviceStarts">Gerät startet</string>
<string name="deviceHasJustStarted">Gerät ist gerade gestartet</string>

View File

@ -699,6 +699,7 @@
<string name="locationNotWorkingOn12">Obtener la locación no parece estar funcionando en dispositivos Android 12 actualmente. Si no está funcionando para ti, lo siento. Intentaré arreglar esto tan pronto como conozca la causa. Así que si la rosquilla no deja de girar, ya sabes por qué.</string>
<string name="profileXrequiresThis">El perfil \"%1$s\" requiere esto.</string>
<string name="lastProfile">Último perfil:</string>
<string name="queryAllPackages">Obtener una lista de las aplicaciones instaladas</string>
<string name="deviceStarts">Dispositivo esta enciendo</string>
<string name="serviceStarts">Servicio esta enciendo</string>
<string name="deviceHasJustStarted">el dispositivo justamente ha encendido</string>

View File

@ -700,6 +700,7 @@
<string name="profileXrequiresThis">Questo è richiesto dal profilo \"%1$s\".</string>
<string name="locationNotWorkingOn12">Ottenere la posizione non sembra funzionare su dispositivi Android 12 al momento. Se non funziona per te, mi dispiace. Cercherò di risolvere questo problema non appena conoscerò la causa. Quindi, se cerchio rotante non smette di girare, sai perché.</string>
<string name="lastProfile">Ultimo profilo:</string>
<string name="queryAllPackages">Ottenere un elenco delle applicazioni installate</string>
<string name="deviceStarts">Device starts</string>
<string name="serviceStarts">Avvio del servizio</string>
<string name="deviceHasJustStarted">Il dispositivo è appena stato avviato</string>

View File

@ -698,6 +698,7 @@
<string name="locationNotWorkingOn12">Het verkrijgen van de locatie lijkt momenteel niet te werken op Android 12-apparaten. Als het niet voor je werkt, spijt het me. Ik zal proberen dit op te lossen zodra ik de oorzaak ken. Dus als de donut niet stopt met draaien, weet je waarom.</string>
<string name="profileXrequiresThis">Profiel \"%1$s\" vereist dit.</string>
<string name="lastProfile">Laatste profiel:</string>
<string name="queryAllPackages">Een lijst met geïnstalleerde toepassingen ophalen</string>
<string name="deviceHasJustStarted">apparaat is net gestart</string>
<string name="serviceHasJustStarted">service is net begonnen</string>
<string name="serviceStarts">Service start</string>

View File

@ -796,6 +796,7 @@
<string name="musicCheckFrequencySummary">Milliseconds between checks</string>
<string name="locationNotWorkingOn12">Getting the location does not seem to be working on Android 12 devices currently. If it isn\'t working for you, I\'m sorry. I\'ll try to fix this as soon as I know the cause. So if the donut doesn\'t stop spinning, you know why.</string>
<string name="lastProfile">Last profile:</string>
<string name="queryAllPackages">Get a list of installed applications</string>
<string name="deviceStarts">Device starts</string>
<string name="serviceStarts">Service starts</string>
<string name="deviceHasJustStarted">device has just started</string>

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -0,0 +1,14 @@
Neuer Auslöser:
* Bildschirmstatus (ein/aus)
Neue Aktionen:
* Benachrichtigung erstellen
* Benachrichtigung(en) schließen
* Medienwiedergabe steuern
Fehler behoben:
* Übersetzungsfehler im niederländischen Variablentext
* Variablen wurden beim Senden von Textnachrichten nicht ersetzt
* Der Dienst startete nicht immer, nachdem das Gerät eingeschaltet wurde
* Setzen von Klingeltönen auf Android 11 und höher
* Für das Ändern von Klingeltönen ist die Speicher-lesen-Berechtigung nötig
* Profil, das nicht verwendet wurde, konnte nicht gelöscht werden
* Orientierungssensor an Geräten ohne Magnet-Sensor

View File

@ -0,0 +1,5 @@
* Fehlerbehebung: Verwaltung von Zeitraum-Auslösern wurde manchmal falsch geladen, während der Dienst lief.
* Fehlerbehebung: Zeitraum-Auslöser: Wiederholte Ausführungen haben manchmal nicht funktioniert
* Fehlerbehebung: Zeitraum-Auslöser: Wiederholte Ausführungen liefen weiter, nachdem der Dienst bereits gestoppt wurde.
* Fehlerbehebung: Die Anwendung hatte sich nicht das zuletzt verbundene WLAN gemerkt.
* Fehlerbehebung: Programm starten: Liste zum Auswählen einer Anwendung konnte nicht erzeugt werden.

View File

@ -8,3 +8,4 @@
* Fixed: Set ringtones on Android 11 and above
* Fixed: Permission read storage required for changing ringtones
* Fixed: Profile that were not in use, could not be deleted.
* Fixed: Orientation sensor on devices that have no magnetic sensor.

View File

@ -1,2 +1,5 @@
* New trigger: device has just started
* New trigger: service has just started
* Fixed: Management of DateTimeTrigger was sometimes reloaded incorrectly while service was running
* Fixed: DateTimeTrigger: Repeated executions sometimes not working
* Fixed: DateTimeTrigger: Repeated executions continued to run after service was stopped
* Fixed: App did not memorize the most recent wifi name connected to
* Fixed: No app list displayed when trying to pick which app to start

View File

@ -0,0 +1,14 @@
Nuevo disparador:
* estado de la pantalla (encendido / apagado)
Nuevas acciones:
* Crear notificación
* Cerrar notificación(es)
* Controlar la reproducción de medios
Corregido:
* Error de traducción en texto de variables holandesas
* Las variables no fueron reemplazadas al enviar mensajes de texto
* El servicio no siempre se iniciaría después de que el dispositivo se haya encendido
* Establecer tonos de llamada en Android 11 y superior
* Se requiere almacenamiento de lectura de permisos para cambiar los tonos de llamada
* Perfil que no estaba en uso, no se pudo eliminar
* Sensor de orientación en dispositivos que no tienen sensor magnético

View File

@ -0,0 +1,5 @@
* Corregido: La administración de DateTimeTrigger a veces se recargaba incorrectamente mientras se ejecutaba el servicio
* Corregido: DateTimeTrigger: Ejecuciones repetidas a veces no funcionaban
* Corregido: DateTimeTrigger: Las ejecuciones repetidas continuaron ejecutándose después de que se detuvo el servicio
* Corregido: la aplicación no memorizó el nombre wifi más reciente conectado a
* Corregido: No se muestra ninguna lista de aplicaciones al intentar elegir qué aplicación iniciar

View File

@ -0,0 +1,14 @@
Nuovo trigger:
* stato dello schermo (on / off)
Nuove azioni:
* Crea notifica
* Chiudi notifica (s)
* Controlla la riproduzione multimediale
Fissato:
* Bug di traduzione nel testo delle variabili olandesi
* Le variabili non sono state sostituite durante l'invio di messaggi di testo
* Il servizio non si avvia sempre dopo l'accensione del dispositivo
* Imposta suonerie su Android 11 e versioni successive
* Autorizzazione di lettura necessaria per cambiare le suonerie
* Profilo che non era in uso, non poteva essere eliminato
* Sensore di orientamento su dispositivi che non hanno sensore mag.

View File

@ -0,0 +1,5 @@
* Risolto: la gestione di DateTimeTrigger a volte veniva ricaricata in modo errato durante l'esecuzione del servizio
* Risolto: DateTimeTrigger: esecuzioni ripetute a volte non funzionano
* Risolto: DateTimeTrigger: esecuzioni ripetute hanno continuato a funzionare dopo l'arresto del servizio
* Risolto: l'app non memorizzava il nome wifi più recente collegato a
* Risolto: nessun elenco di app visualizzato quando si tenta di scegliere quale app avviare

View File

@ -0,0 +1,11 @@
* Nieuwe trigger: schermstatus (aan / uit)
* Nieuwe actie: Melding maken
* Nieuwe actie: Sluit melding (en)
* Nieuwe actie: Bedien het afspelen van media
* Fixed: Vertaling bug in Nederlandse variabelen tekst
* Opgelost: Variabelen zijn niet vervangen bij het verzenden van sms-berichten
* Opgelost: service start niet altijd nadat het apparaat is ingeschakeld
* Opgelost: stel beltonen in op Android 11 en hoger
* Opgelost: Toestemming leesopslag vereist voor het wijzigen van beltonen
* Opgelost: Profiel dat niet in gebruik was, kon niet worden verwijderd.
* Vast: Oriëntatiesensor op apparaten die geen magnetische sensor hebben.

View File

@ -0,0 +1,5 @@
* Opgelost: beheer van DateTimeTrigger werd soms onjuist opnieuw geladen terwijl de service werd uitgevoerd
* Opgelost: DateTimeTrigger: Herhaalde uitvoeringen soms niet werken
* Opgelost: DateTimeTrigger: Herhaalde uitvoeringen bleven lopen nadat de service was gestopt
* Opgelost: app heeft de meest recente wifi-naam die is verbonden met
* Opgelost: er wordt geen app-lijst weergegeven wanneer u probeert te kiezen welke app u wilt starten