rename event to stay in compliance to naming conventions
This commit is contained in:
parent
147448afca
commit
9a7e57f0a0
3 changed files with 10 additions and 10 deletions
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.data.ProfileStore;
|
|||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.events.NsFoodEvent;
|
||||
import info.nightscout.androidaps.events.EventNsFood;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
|
||||
|
@ -477,13 +477,13 @@ public class DataService extends IntentService {
|
|||
|
||||
if (intent.getAction().equals(Intents.ACTION_NEW_FOOD)
|
||||
|| intent.getAction().equals(Intents.ACTION_CHANGED_FOOD)) {
|
||||
int mode = Intents.ACTION_NEW_FOOD.equals(intent.getAction()) ? NsFoodEvent.ADD : NsFoodEvent.UPDATE;
|
||||
NsFoodEvent evt = new NsFoodEvent(mode, bundles);
|
||||
int mode = Intents.ACTION_NEW_FOOD.equals(intent.getAction()) ? EventNsFood.ADD : EventNsFood.UPDATE;
|
||||
EventNsFood evt = new EventNsFood(mode, bundles);
|
||||
MainApp.bus().post(evt);
|
||||
}
|
||||
|
||||
if (intent.getAction().equals(Intents.ACTION_REMOVED_FOOD)) {
|
||||
NsFoodEvent evt = new NsFoodEvent(NsFoodEvent.REMOVE, bundles);
|
||||
EventNsFood evt = new EventNsFood(EventNsFood.REMOVE, bundles);
|
||||
MainApp.bus().post(evt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.os.Bundle;
|
|||
* subscriber.
|
||||
*/
|
||||
|
||||
public class NsFoodEvent extends Event {
|
||||
public class EventNsFood extends Event {
|
||||
|
||||
public static final int ADD = 0;
|
||||
public static final int UPDATE = 1;
|
||||
|
@ -20,7 +20,7 @@ public class NsFoodEvent extends Event {
|
|||
|
||||
private final Bundle payload;
|
||||
|
||||
public NsFoodEvent(int mode, Bundle payload) {
|
||||
public EventNsFood(int mode, Bundle payload) {
|
||||
this.mode = mode;
|
||||
this.payload = payload;
|
||||
}
|
|
@ -32,7 +32,7 @@ import info.nightscout.androidaps.db.DatabaseHelper;
|
|||
import info.nightscout.androidaps.db.ICallback;
|
||||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
|
||||
import info.nightscout.androidaps.events.NsFoodEvent;
|
||||
import info.nightscout.androidaps.events.EventNsFood;
|
||||
|
||||
/**
|
||||
* Created by mike on 24.09.2017.
|
||||
|
@ -79,14 +79,14 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleNsEvent(NsFoodEvent event) {
|
||||
public void handleNsEvent(EventNsFood event) {
|
||||
int mode = event.getMode();
|
||||
Bundle payload = event.getPayload();
|
||||
|
||||
try {
|
||||
if (payload.containsKey("food")) {
|
||||
JSONObject json = new JSONObject(payload.getString("food"));
|
||||
if (mode == NsFoodEvent.ADD || mode == NsFoodEvent.UPDATE) {
|
||||
if (mode == EventNsFood.ADD || mode == EventNsFood.UPDATE) {
|
||||
this.createFoodFromJsonIfNotExists(json);
|
||||
} else {
|
||||
this.deleteNS(json);
|
||||
|
@ -95,7 +95,7 @@ public class FoodService extends OrmLiteBaseService<DatabaseHelper> {
|
|||
|
||||
if (payload.containsKey("foods")) {
|
||||
JSONArray array = new JSONArray(payload.getString("foods"));
|
||||
if (mode == NsFoodEvent.ADD || mode == NsFoodEvent.UPDATE) {
|
||||
if (mode == EventNsFood.ADD || mode == EventNsFood.UPDATE) {
|
||||
this.createFoodFromJsonIfNotExists(array);
|
||||
} else {
|
||||
this.deleteNS(array);
|
||||
|
|
Loading…
Reference in a new issue