forked from jens/Automation
full day time window
This commit is contained in:
parent
5786c1bfd4
commit
7e12a0f3e5
@ -10,13 +10,13 @@ import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
@ -27,6 +27,7 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday, chkRepeat;
|
||||
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
|
||||
EditText etRepeatEvery;
|
||||
TextView tvDaysHint;
|
||||
|
||||
static Trigger editedTimeFrameTrigger = null;
|
||||
|
||||
@ -53,6 +54,7 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
radioTimeFrameLeaving = (RadioButton)findViewById(R.id.radioTimeFrameLeaving);
|
||||
chkRepeat = (CheckBox)findViewById(R.id.chkRepeat);
|
||||
etRepeatEvery = (EditText)findViewById(R.id.etRepeatEvery);
|
||||
tvDaysHint = (TextView)findViewById(R.id.tvDaysHint);
|
||||
|
||||
bSaveTimeFrame.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@ -181,6 +183,31 @@ public class ActivityManageTriggerTimeFrame extends Activity
|
||||
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(editedTimeFrameTrigger.getTriggerParameter2()));
|
||||
loadVariableIntoGui();
|
||||
}
|
||||
|
||||
TimePicker.OnTimeChangedListener pickerListener = new TimePicker.OnTimeChangedListener()
|
||||
{
|
||||
@Override
|
||||
public void onTimeChanged(TimePicker timePicker, int i, int i1)
|
||||
{
|
||||
if(
|
||||
startPicker.getCurrentHour() > stopPicker.getCurrentHour()
|
||||
||
|
||||
(
|
||||
startPicker.getCurrentHour() == stopPicker.getCurrentHour()
|
||||
&&
|
||||
startPicker.getCurrentMinute() >= stopPicker.getCurrentMinute()
|
||||
)
|
||||
)
|
||||
tvDaysHint.setText(getResources().getString(R.string.timeFrameDaysHint));
|
||||
else
|
||||
tvDaysHint.setText("");
|
||||
}
|
||||
};
|
||||
startPicker.setOnTimeChangedListener(pickerListener);
|
||||
stopPicker.setOnTimeChangedListener(pickerListener);
|
||||
|
||||
// Perform check once
|
||||
pickerListener.onTimeChanged(null, 0, 0);
|
||||
}
|
||||
|
||||
private void loadVariableIntoGui()
|
||||
|
@ -78,6 +78,13 @@
|
||||
android:text="@string/timeFrameWhichDays"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDaysHint"
|
||||
android:layout_marginVertical="@dimen/default_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkMonday"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -701,4 +701,5 @@
|
||||
<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="timeFrameDaysHint">Wenn Sie ein Zeitfenster verwenden, das sich über Mitternacht erstreckt, müssen Sie auch den Folgetag auswählen, wenn der Auslöser auch nach Mitternacht noch auslösen soll.</string>
|
||||
</resources>
|
@ -700,4 +700,5 @@
|
||||
<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="timeFrameDaysHint">Si utiliza un marco de tiempo que se extiende más allá de la medianoche, también debe seleccionar el día siguiente si desea que la condición se aplique después de la medianoche.</string>
|
||||
</resources>
|
@ -701,4 +701,5 @@
|
||||
<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="timeFrameDaysHint">Se si utilizza un intervallo di tempo che si estende oltre la mezzanotte, è necessario selezionare anche il giorno successivo se si desidera che il trigger venga applicato dopo la mezzanotte.</string>
|
||||
</resources>
|
||||
|
@ -699,4 +699,5 @@
|
||||
<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="timeFrameDaysHint">Als u een tijdsbestek gebruikt dat zich uitstrekt over middernacht, moet u ook de volgende dag selecteren als u wilt dat de trigger na middernacht van toepassing is.</string>
|
||||
</resources>
|
||||
|
@ -797,4 +797,5 @@
|
||||
<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="timeFrameDaysHint">If you use a timeframe that stretches over midnight you need to select the following day as well if you want the trigger to apply after midnight.</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user