Merge branch 'fix-careportalevent' into dev-wip

This commit is contained in:
Nico Schmitz 2018-06-14 13:01:14 +02:00
commit d7db19bf2d
2 changed files with 6 additions and 8 deletions

View file

@ -87,7 +87,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
} }
public long getHoursFromStart() { public long getHoursFromStart() {
return (System.currentTimeMillis() - date) / (60 * 1000); return (System.currentTimeMillis() - date) / (60 * 60 * 1000);
} }
public String age() { public String age() {
@ -98,13 +98,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
return diff.get(TimeUnit.DAYS) + " " + MainApp.gs(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.gs(R.string.hours); return diff.get(TimeUnit.DAYS) + " " + MainApp.gs(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.gs(R.string.hours);
} }
public boolean isOlderThan(double hours) { public boolean isOlderThan(double hours) { return getHoursFromStart() > hours; }
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
if(diff.get(TimeUnit.DAYS)*24 + diff.get(TimeUnit.HOURS) > hours)
return true;
else
return false;
}
public String log() { public String log() {
return "CareportalEvent{" + return "CareportalEvent{" +

View file

@ -603,6 +603,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
String units = MainApp.getConfigBuilder().getProfileUnits(); String units = MainApp.getConfigBuilder().getProfileUnits();
FragmentManager manager = getFragmentManager(); FragmentManager manager = getFragmentManager();
// try to fix https://fabric.io/nightscout3/android/apps/info.nightscout.androidaps/issues/5aca7a1536c7b23527eb4be7?time=last-seven-days
// https://stackoverflow.com/questions/14860239/checking-if-state-is-saved-before-committing-a-fragmenttransaction
if (manager.isStateSaved())
return;
switch (v.getId()) { switch (v.getId()) {
case R.id.overview_accepttempbutton: case R.id.overview_accepttempbutton:
onClickAcceptTemp(); onClickAcceptTemp();