update buttons correctly

This commit is contained in:
Roumen Georgiev 2019-09-16 09:37:48 +03:00
parent 68b6591f42
commit d66eb78415

View file

@ -53,7 +53,7 @@ public class TriggerTimeRange extends Trigger {
@Override @Override
public boolean shouldRun() { public boolean shouldRun() {
int currentMinSinceMidnight = getMinSinceMidnight(System.currentTimeMillis()); int currentMinSinceMidnight = getMinSinceMidnight(DateUtil.now());
if (lastRun > DateUtil.now() - T.mins(5).msecs()) if (lastRun > DateUtil.now() - T.mins(5).msecs())
return false; return false;
@ -147,7 +147,7 @@ public class TriggerTimeRange extends Trigger {
return minutesSinceMidnight*60*1000; return minutesSinceMidnight*60*1000;
} }
int getMinSinceMidnight(long time) { public int getMinSinceMidnight(long time) {
// if passed argument is smaller than 1440 ( 24 h * 60 min ) that value is already converted // if passed argument is smaller than 1440 ( 24 h * 60 min ) that value is already converted
if (time < 1441) if (time < 1441)
return (int) time; return (int) time;
@ -182,7 +182,7 @@ public class TriggerTimeRange extends Trigger {
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay); calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.MINUTE, minute);
start = getMinSinceMidnight(calendar.getTimeInMillis()); start = getMinSinceMidnight(calendar.getTimeInMillis());
startButton.setText(DateUtil.timeString(start)); startButton.setText(DateUtil.timeString(toMilis(start)));
}, },
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE), calendar.get(Calendar.MINUTE),
@ -202,7 +202,7 @@ public class TriggerTimeRange extends Trigger {
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay); calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.MINUTE, minute);
end = getMinSinceMidnight(calendar.getTimeInMillis()); end = getMinSinceMidnight(calendar.getTimeInMillis());
endButton.setText(MainApp.gs(R.string.and) + " " + DateUtil.timeString(end)); endButton.setText(MainApp.gs(R.string.and) + " " + DateUtil.timeString(toMilis(end)));
}, },
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE), calendar.get(Calendar.MINUTE),