serialize reload of treatments

This commit is contained in:
Milos Kozak 2017-10-04 18:04:34 +02:00
parent 96c1a18a66
commit 9f6962cee5
3 changed files with 8 additions and 4 deletions

View file

@ -663,8 +663,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
class PostRunnable implements Runnable { class PostRunnable implements Runnable {
public void run() { public void run() {
log.debug("Firing EventTreatmentChange"); log.debug("Firing EventTreatmentChange");
MainApp.bus().post(new EventReloadTreatmentData()); MainApp.bus().post(new EventReloadTreatmentData(new EventTreatmentChange()));
MainApp.bus().post(new EventTreatmentChange());
if (earliestDataChange != null) if (earliestDataChange != null)
MainApp.bus().post(new EventNewHistoryData(earliestDataChange)); MainApp.bus().post(new EventNewHistoryData(earliestDataChange));
earliestDataChange = null; earliestDataChange = null;
@ -1365,8 +1364,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
class PostRunnable implements Runnable { class PostRunnable implements Runnable {
public void run() { public void run() {
log.debug("Firing EventExtendedBolusChange"); log.debug("Firing EventExtendedBolusChange");
MainApp.bus().post(new EventReloadTreatmentData()); MainApp.bus().post(new EventReloadTreatmentData(new EventExtendedBolusChange()));
MainApp.bus().post(new EventExtendedBolusChange());
if (earliestDataChange != null) if (earliestDataChange != null)
MainApp.bus().post(new EventNewHistoryData(earliestDataChange)); MainApp.bus().post(new EventNewHistoryData(earliestDataChange));
earliestDataChange = null; earliestDataChange = null;

View file

@ -5,4 +5,9 @@ package info.nightscout.androidaps.events;
*/ */
public class EventReloadTreatmentData { public class EventReloadTreatmentData {
public Object next;
public EventReloadTreatmentData(Object next) {
this.next = next;
}
} }

View file

@ -291,6 +291,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
initializeTreatmentData(); initializeTreatmentData();
initializeExtendedBolusData(); initializeExtendedBolusData();
updateTotalIOBTreatments(); updateTotalIOBTreatments();
MainApp.bus().post(ev.next);
} }
@Subscribe @Subscribe