reoccuring time
This commit is contained in:
parent
604ab0eb43
commit
6588443459
@ -132,7 +132,7 @@
|
|||||||
android:scheme="package" />-->
|
android:scheme="package" />-->
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".receivers.AlarmListener" />
|
<receiver android:name=".receivers.DateTimeListener" />
|
||||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||||
<receiver android:name=".receivers.TimeZoneListener" />
|
<receiver android:name=".receivers.TimeZoneListener" />
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
android:scheme="package" />-->
|
android:scheme="package" />-->
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".receivers.AlarmListener" />
|
<receiver android:name=".receivers.DateTimeListener" />
|
||||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||||
<receiver android:name=".receivers.TimeZoneListener" />
|
<receiver android:name=".receivers.TimeZoneListener" />
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
android:scheme="package" />-->
|
android:scheme="package" />-->
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".receivers.AlarmListener" />
|
<receiver android:name=".receivers.DateTimeListener" />
|
||||||
<receiver android:name=".receivers.ConnectivityReceiver" />
|
<receiver android:name=".receivers.ConnectivityReceiver" />
|
||||||
<receiver android:name=".receivers.TimeZoneListener" />
|
<receiver android:name=".receivers.TimeZoneListener" />
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.jens.automation2.AutomationService.serviceCommands;
|
import com.jens.automation2.AutomationService.serviceCommands;
|
||||||
import com.jens.automation2.receivers.AlarmListener;
|
import com.jens.automation2.receivers.DateTimeListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ public class ActivityMainRules extends ActivityGeneric
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(AutomationService.isMyServiceRunning(this))
|
if(AutomationService.isMyServiceRunning(this))
|
||||||
AlarmListener.reloadAlarms();
|
DateTimeListener.reloadAlarms();
|
||||||
}
|
}
|
||||||
catch(NullPointerException e)
|
catch(NullPointerException e)
|
||||||
{
|
{
|
||||||
|
@ -6,11 +6,16 @@ import android.view.View;
|
|||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
@ -18,8 +23,9 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
{
|
{
|
||||||
Button bSaveTimeFrame;
|
Button bSaveTimeFrame;
|
||||||
TimePicker startPicker, stopPicker;
|
TimePicker startPicker, stopPicker;
|
||||||
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday;
|
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday, chkRepeat;
|
||||||
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
|
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
|
||||||
|
EditText etRepeatEvery;
|
||||||
|
|
||||||
public static Trigger editedTimeFrameTrigger = null;
|
public static Trigger editedTimeFrameTrigger = null;
|
||||||
|
|
||||||
@ -44,6 +50,8 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
checkSunday = (CheckBox)findViewById(R.id.checkSunday);
|
checkSunday = (CheckBox)findViewById(R.id.checkSunday);
|
||||||
radioTimeFrameEntering = (RadioButton)findViewById(R.id.radioTimeFrameEntering);
|
radioTimeFrameEntering = (RadioButton)findViewById(R.id.radioTimeFrameEntering);
|
||||||
radioTimeFrameLeaving = (RadioButton)findViewById(R.id.radioTimeFrameLeaving);
|
radioTimeFrameLeaving = (RadioButton)findViewById(R.id.radioTimeFrameLeaving);
|
||||||
|
chkRepeat = (CheckBox)findViewById(R.id.chkRepeat);
|
||||||
|
etRepeatEvery = (EditText)findViewById(R.id.etRepeatEvery);
|
||||||
|
|
||||||
bSaveTimeFrame.setOnClickListener(new OnClickListener()
|
bSaveTimeFrame.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
@ -94,9 +102,41 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean goOn = false;
|
||||||
|
if(chkRepeat.isChecked())
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEmpty(etRepeatEvery.getText().toString()))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
long value = Long.parseLong(etRepeatEvery.getText().toString());
|
||||||
|
if(value > 0)
|
||||||
|
{
|
||||||
|
goOn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
goOn = true;
|
||||||
|
|
||||||
|
if(!goOn)
|
||||||
|
{
|
||||||
|
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterRepetitionTime), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(editedTimeFrameTrigger.getTimeFrame() == null)
|
if(editedTimeFrameTrigger.getTimeFrame() == null)
|
||||||
|
{
|
||||||
// add new one
|
// add new one
|
||||||
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList));
|
if(chkRepeat.isChecked())
|
||||||
|
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, Long.parseLong(etRepeatEvery.getText().toString())));
|
||||||
|
else
|
||||||
|
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, 0));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// edit one
|
// edit one
|
||||||
@ -104,6 +144,11 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
editedTimeFrameTrigger.getTimeFrame().setTriggerTimeStop(stopTime);
|
editedTimeFrameTrigger.getTimeFrame().setTriggerTimeStop(stopTime);
|
||||||
editedTimeFrameTrigger.getTimeFrame().getDayList().clear();
|
editedTimeFrameTrigger.getTimeFrame().getDayList().clear();
|
||||||
editedTimeFrameTrigger.getTimeFrame().setDayList(dayList);
|
editedTimeFrameTrigger.getTimeFrame().setDayList(dayList);
|
||||||
|
|
||||||
|
if(chkRepeat.isChecked())
|
||||||
|
editedTimeFrameTrigger.getTimeFrame().setRepetition(Long.parseLong(etRepeatEvery.getText().toString()));
|
||||||
|
else
|
||||||
|
editedTimeFrameTrigger.getTimeFrame().setRepetition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
editedTimeFrameTrigger.setTriggerParameter(radioTimeFrameEntering.isChecked());
|
editedTimeFrameTrigger.setTriggerParameter(radioTimeFrameEntering.isChecked());
|
||||||
@ -113,6 +158,15 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
chkRepeat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||||
|
{
|
||||||
|
etRepeatEvery.setEnabled(isChecked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if(editedTimeFrameTrigger.getTimeFrame() != null)
|
if(editedTimeFrameTrigger.getTimeFrame() != null)
|
||||||
loadVariableIntoGui();
|
loadVariableIntoGui();
|
||||||
}
|
}
|
||||||
@ -158,6 +212,12 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(editedTimeFrameTrigger.getTimeFrame().getRepetition() > 0)
|
||||||
|
{
|
||||||
|
chkRepeat.setChecked(true);
|
||||||
|
etRepeatEvery.setText(String.valueOf(editedTimeFrameTrigger.getTimeFrame().getRepetition()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.jens.automation2.location.CellLocationChangedReceiver;
|
import com.jens.automation2.location.CellLocationChangedReceiver;
|
||||||
import com.jens.automation2.location.WifiBroadcastReceiver;
|
import com.jens.automation2.location.WifiBroadcastReceiver;
|
||||||
import com.jens.automation2.receivers.AlarmListener;
|
import com.jens.automation2.receivers.DateTimeListener;
|
||||||
import com.jens.automation2.receivers.AutomationListenerInterface;
|
import com.jens.automation2.receivers.AutomationListenerInterface;
|
||||||
import com.jens.automation2.receivers.BatteryReceiver;
|
import com.jens.automation2.receivers.BatteryReceiver;
|
||||||
import com.jens.automation2.receivers.BluetoothReceiver;
|
import com.jens.automation2.receivers.BluetoothReceiver;
|
||||||
@ -42,7 +42,7 @@ public class ReceiverCoordinator
|
|||||||
Class adClass = Class.forName("ActivityDetectionReceiver");
|
Class adClass = Class.forName("ActivityDetectionReceiver");
|
||||||
allImplementers = new Class[] {
|
allImplementers = new Class[] {
|
||||||
adClass,
|
adClass,
|
||||||
AlarmListener.class,
|
DateTimeListener.class,
|
||||||
BatteryReceiver.class,
|
BatteryReceiver.class,
|
||||||
BluetoothReceiver.class,
|
BluetoothReceiver.class,
|
||||||
ConnectivityReceiver.class,
|
ConnectivityReceiver.class,
|
||||||
@ -59,7 +59,7 @@ public class ReceiverCoordinator
|
|||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
|
||||||
allImplementers = new Class[] {
|
allImplementers = new Class[] {
|
||||||
AlarmListener.class,
|
DateTimeListener.class,
|
||||||
BatteryReceiver.class,
|
BatteryReceiver.class,
|
||||||
BluetoothReceiver.class,
|
BluetoothReceiver.class,
|
||||||
ConnectivityReceiver.class,
|
ConnectivityReceiver.class,
|
||||||
@ -155,7 +155,7 @@ public class ReceiverCoordinator
|
|||||||
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
|
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
|
||||||
|
|
||||||
// startAlarmListener
|
// startAlarmListener
|
||||||
AlarmListener.startAlarmListener(AutomationService.getInstance());
|
DateTimeListener.startAlarmListener(AutomationService.getInstance());
|
||||||
TimeZoneListener.startTimeZoneListener(AutomationService.getInstance());
|
TimeZoneListener.startTimeZoneListener(AutomationService.getInstance());
|
||||||
|
|
||||||
// startNoiseListener
|
// startNoiseListener
|
||||||
@ -199,7 +199,7 @@ public class ReceiverCoordinator
|
|||||||
WifiBroadcastReceiver.stopWifiReceiver();
|
WifiBroadcastReceiver.stopWifiReceiver();
|
||||||
BatteryReceiver.stopBatteryReceiver();
|
BatteryReceiver.stopBatteryReceiver();
|
||||||
TimeZoneListener.stopTimeZoneListener();
|
TimeZoneListener.stopTimeZoneListener();
|
||||||
AlarmListener.stopAlarmListener(AutomationService.getInstance());
|
DateTimeListener.stopAlarmListener(AutomationService.getInstance());
|
||||||
NoiseListener.stopNoiseListener();
|
NoiseListener.stopNoiseListener();
|
||||||
ProcessListener.stopProcessListener(AutomationService.getInstance());
|
ProcessListener.stopProcessListener(AutomationService.getInstance());
|
||||||
|
|
||||||
|
@ -6,8 +6,11 @@ import java.util.ArrayList;
|
|||||||
public class TimeFrame
|
public class TimeFrame
|
||||||
{
|
{
|
||||||
// Defines a timeframe
|
// Defines a timeframe
|
||||||
private Time triggerTimeStart;
|
protected Time triggerTimeStart;
|
||||||
private Time triggerTimeStop;
|
protected Time triggerTimeStop;
|
||||||
|
protected long repetition;
|
||||||
|
|
||||||
|
protected final static String separator = "/";
|
||||||
|
|
||||||
private ArrayList<Integer> dayList = new ArrayList<Integer>();
|
private ArrayList<Integer> dayList = new ArrayList<Integer>();
|
||||||
public ArrayList<Integer> getDayList()
|
public ArrayList<Integer> getDayList()
|
||||||
@ -31,7 +34,6 @@ public class TimeFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Time getTriggerTimeStart()
|
public Time getTriggerTimeStart()
|
||||||
{
|
{
|
||||||
return triggerTimeStart;
|
return triggerTimeStart;
|
||||||
@ -40,6 +42,7 @@ public class TimeFrame
|
|||||||
{
|
{
|
||||||
this.triggerTimeStart = triggerTimeStart;
|
this.triggerTimeStart = triggerTimeStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Time getTriggerTimeStop()
|
public Time getTriggerTimeStop()
|
||||||
{
|
{
|
||||||
return triggerTimeStop;
|
return triggerTimeStop;
|
||||||
@ -49,27 +52,43 @@ public class TimeFrame
|
|||||||
this.triggerTimeStop = triggerTimeStop;
|
this.triggerTimeStop = triggerTimeStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2)
|
public long getRepetition()
|
||||||
|
{
|
||||||
|
return repetition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepetition(long repetition)
|
||||||
|
{
|
||||||
|
this.repetition = repetition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2, long repetition)
|
||||||
{
|
{
|
||||||
this.setTriggerTimeStart(timeStart);
|
this.setTriggerTimeStart(timeStart);
|
||||||
this.setTriggerTimeStop(timeEnd);
|
this.setTriggerTimeStop(timeEnd);
|
||||||
this.setDayList(dayList2);
|
this.setDayList(dayList2);
|
||||||
|
this.setRepetition(repetition);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeFrame (String fileContent)
|
TimeFrame (String fileContent)
|
||||||
{
|
{
|
||||||
String[] dateArray = fileContent.split("/"); // example: timestart/timestop/days[int]
|
String[] dateArray = fileContent.split(separator); // example: timestart/timestop/days[int]/repetition
|
||||||
this.setTriggerTimeStart(Time.valueOf(dateArray[0]));
|
this.setTriggerTimeStart(Time.valueOf(dateArray[0]));
|
||||||
this.setTriggerTimeStop(Time.valueOf(dateArray[1]));
|
this.setTriggerTimeStop(Time.valueOf(dateArray[1]));
|
||||||
this.setDayListFromString(dateArray[2]);
|
this.setDayListFromString(dateArray[2]);
|
||||||
|
this.setRepetition(Long.parseLong(dateArray[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
String returnString = this.getTriggerTimeStart().toString() + "/" + this.getTriggerTimeStop().toString() + "/";
|
String returnString = this.getTriggerTimeStart().toString() + separator + this.getTriggerTimeStop().toString() + separator;
|
||||||
|
|
||||||
for(Integer oneDay : this.getDayList())
|
for(Integer oneDay : this.getDayList())
|
||||||
returnString += String.valueOf(oneDay);
|
returnString += String.valueOf(oneDay);
|
||||||
|
|
||||||
|
returnString += separator + String.valueOf(repetition);
|
||||||
|
|
||||||
return returnString;
|
return returnString;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -294,7 +294,11 @@ public class Trigger
|
|||||||
else
|
else
|
||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.leaving) + " ");
|
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.leaving) + " ");
|
||||||
|
|
||||||
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());
|
String repeat = ", no repetition";
|
||||||
|
if(this.getTimeFrame().getRepetition() > 0)
|
||||||
|
repeat = ", " + String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.repeatEveryXsecondsWithVariable), 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);
|
||||||
break;
|
break;
|
||||||
case speed:
|
case speed:
|
||||||
if(getTriggerParameter())
|
if(getTriggerParameter())
|
||||||
|
@ -18,7 +18,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class AlarmListener extends BroadcastReceiver implements AutomationListenerInterface
|
public class DateTimeListener extends BroadcastReceiver implements AutomationListenerInterface
|
||||||
{
|
{
|
||||||
private static AutomationService automationServiceRef;
|
private static AutomationService automationServiceRef;
|
||||||
private static AlarmManager centralAlarmManagerInstance;
|
private static AlarmManager centralAlarmManagerInstance;
|
||||||
@ -31,11 +31,11 @@ public class AlarmListener extends BroadcastReceiver implements AutomationListen
|
|||||||
|
|
||||||
public static void startAlarmListener(final AutomationService automationServiceRef)
|
public static void startAlarmListener(final AutomationService automationServiceRef)
|
||||||
{
|
{
|
||||||
AlarmListener.startAlarmListenerInternal(automationServiceRef);
|
DateTimeListener.startAlarmListenerInternal(automationServiceRef);
|
||||||
}
|
}
|
||||||
public static void stopAlarmListener(Context context)
|
public static void stopAlarmListener(Context context)
|
||||||
{
|
{
|
||||||
AlarmListener.stopAlarmListenerInternal();
|
DateTimeListener.stopAlarmListenerInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlarmListenerActive()
|
public static boolean isAlarmListenerActive()
|
||||||
@ -207,7 +207,7 @@ public class AlarmListener extends BroadcastReceiver implements AutomationListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
|
||||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate, alarmPendingIntent);
|
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate, alarmPendingIntent);
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ public class AlarmListener extends BroadcastReceiver implements AutomationListen
|
|||||||
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
|
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
|
||||||
for(int requestCode : requestCodeList)
|
for(int requestCode : requestCodeList)
|
||||||
{
|
{
|
||||||
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
|
||||||
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
|
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
|
||||||
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
|
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
|
||||||
centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
centralAlarmManagerInstance.cancel(alarmPendingIntent);
|
||||||
@ -237,13 +237,13 @@ public class AlarmListener extends BroadcastReceiver implements AutomationListen
|
|||||||
if(!alarmListenerActive)
|
if(!alarmListenerActive)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
|
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
|
||||||
AlarmListener.automationServiceRef = givenAutomationServiceRef;
|
DateTimeListener.automationServiceRef = givenAutomationServiceRef;
|
||||||
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
|
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
|
||||||
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
|
||||||
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
|
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
|
||||||
alarmListenerActive = true;
|
alarmListenerActive = true;
|
||||||
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
|
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
|
||||||
AlarmListener.setAlarms();
|
DateTimeListener.setAlarms();
|
||||||
|
|
||||||
// // get a Calendar object with current time
|
// // get a Calendar object with current time
|
||||||
// Calendar cal = Calendar.getInstance();
|
// Calendar cal = Calendar.getInstance();
|
||||||
@ -269,17 +269,17 @@ public class AlarmListener extends BroadcastReceiver implements AutomationListen
|
|||||||
}
|
}
|
||||||
public static void reloadAlarms()
|
public static void reloadAlarms()
|
||||||
{
|
{
|
||||||
AlarmListener.setAlarms();
|
DateTimeListener.setAlarms();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void startListener(AutomationService automationService)
|
public void startListener(AutomationService automationService)
|
||||||
{
|
{
|
||||||
AlarmListener.startAlarmListener(automationService);
|
DateTimeListener.startAlarmListener(automationService);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void stopListener(AutomationService automationService)
|
public void stopListener(AutomationService automationService)
|
||||||
{
|
{
|
||||||
AlarmListener.stopAlarmListener(automationService);
|
DateTimeListener.stopAlarmListener(automationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean haveAllPermission()
|
public static boolean haveAllPermission()
|
@ -77,12 +77,12 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
|
|||||||
if(action.equals(Intent.ACTION_TIMEZONE_CHANGED))
|
if(action.equals(Intent.ACTION_TIMEZONE_CHANGED))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "TimeZoneListener", "Device timezone changed. Reloading alarms.", 3);
|
Miscellaneous.logEvent("i", "TimeZoneListener", "Device timezone changed. Reloading alarms.", 3);
|
||||||
AlarmListener.reloadAlarms();
|
DateTimeListener.reloadAlarms();
|
||||||
}
|
}
|
||||||
else if(action.equals(Intent.ACTION_TIME_CHANGED))
|
else if(action.equals(Intent.ACTION_TIME_CHANGED))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 4);
|
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 4);
|
||||||
AlarmListener.reloadAlarms();
|
DateTimeListener.reloadAlarms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,6 +120,34 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/sunday" />
|
android:text="@string/sunday" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="#aa000000" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/chkRepeat"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/repeatEveryXseconds" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etRepeatEvery"
|
||||||
|
android:layout_marginLeft="@dimen/default_margin"
|
||||||
|
android:minWidth="75dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:enabled="false"
|
||||||
|
android:inputType="numberSigned" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bSaveTimeFrame"
|
android:id="@+id/bSaveTimeFrame"
|
||||||
android:layout_marginTop="@dimen/default_margin"
|
android:layout_marginTop="@dimen/default_margin"
|
||||||
|
@ -690,7 +690,7 @@
|
|||||||
<string name="bottom">Bottom</string>
|
<string name="bottom">Bottom</string>
|
||||||
<string name="tabsPlacement">Position of tab bar</string>
|
<string name="tabsPlacement">Position of tab bar</string>
|
||||||
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
|
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
|
||||||
<string name="wifiApi30">Because Google screwd up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</string>
|
<string name="wifiApi30">Because Google screwed up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</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.</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.</string>
|
||||||
<string name="silentTriggersDnd">REMARK: The silent mode often triggers Do-Not-Disturb on newer devices. If that happens on your device, I recommend using the normal mode instead and lowering all volumes to zero.</string>
|
<string name="silentTriggersDnd">REMARK: The silent mode often triggers Do-Not-Disturb on newer devices. If that happens on your device, I recommend using the normal mode instead and lowering all volumes to zero.</string>
|
||||||
<string name="tones">Tones</string>
|
<string name="tones">Tones</string>
|
||||||
@ -703,4 +703,7 @@
|
|||||||
<string name="dndRemarks">Fine tuning (like allowing phone calls, picking specific numbers, etc.) can only be done from the system\'s settings.</string>
|
<string name="dndRemarks">Fine tuning (like allowing phone calls, picking specific numbers, etc.) can only be done from the system\'s settings.</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="automationNotificationsIgnored">If you do not choose a specific app, but choose \"Any app\" notifications from Automation will be ignored to avoid loops.</string>
|
<string name="automationNotificationsIgnored">If you do not choose a specific app, but choose \"Any app\" notifications from Automation will be ignored to avoid loops.</string>
|
||||||
|
<string name="repeatEveryXseconds">Repeat every x seconds</string>
|
||||||
|
<string name="repeatEveryXsecondsWithVariable">repeat every %1$o seconds</string>
|
||||||
|
<string name="enterRepetitionTime">You need to enter a positive non-decimal value for reptition time.</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user