Rework to use already existing method

This commit is contained in:
Markus M. May 2018-07-01 13:50:37 +02:00
parent 468b645486
commit 6bc60cd8a8
2 changed files with 5 additions and 9 deletions

View file

@ -119,6 +119,7 @@ import info.nightscout.utils.OKDialog;
import info.nightscout.utils.Profiler;
import info.nightscout.utils.SP;
import info.nightscout.utils.SingleClickButton;
import info.nightscout.utils.T;
import info.nightscout.utils.ToastUtils;
import static info.nightscout.utils.DateUtil.now;
@ -839,7 +840,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (wizard.superBolus) {
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
if (loopPlugin.isEnabled(PluginType.LOOP)) {
loopPlugin.superBolusTo(System.currentTimeMillis() + DateUtil.hourToMs(2));
loopPlugin.superBolusTo(System.currentTimeMillis() + T.hours(2).msecs());
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
@ -1426,12 +1427,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
predHours = Math.max(0, predHours);
hoursToFetch = rangeToDisplay - predHours;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - DateUtil.hourToMs(hoursToFetch);
endTime = toTime + DateUtil.hourToMs(predHours);
fromTime = toTime - T.hours(hoursToFetch).msecs();
endTime = toTime + T.hours(predHours).msecs();
} else {
hoursToFetch = rangeToDisplay;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - DateUtil.hourToMs(hoursToFetch);
fromTime = toTime - T.hours(hoursToFetch).msecs();
endTime = toTime;
}

View file

@ -179,9 +179,4 @@ public class DateUtil {
public static long roundDateToSec(long date) {
return date - date % 1000;
}
public static long hourToMs(long hour) {
return hour * 60 * 60 * 1000L;
}
}