Rename isActiveBgSource -> isFromActiveBgSource.

This commit is contained in:
Johannes Mockenhaupt 2018-03-17 13:36:52 +01:00
parent 8849df639f
commit a7ca483565
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
8 changed files with 15 additions and 15 deletions

View file

@ -366,14 +366,14 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
} }
// ------------------- BgReading handling ----------------------- // ------------------- BgReading handling -----------------------
public boolean createIfNotExists(BgReading bgReading, String from, boolean isActiveBgSource) { public boolean createIfNotExists(BgReading bgReading, String from, boolean isFromActiveBgSource) {
try { try {
bgReading.date = roundDateToSec(bgReading.date); bgReading.date = roundDateToSec(bgReading.date);
BgReading old = getDaoBgReadings().queryForId(bgReading.date); BgReading old = getDaoBgReadings().queryForId(bgReading.date);
if (old == null) { if (old == null) {
getDaoBgReadings().create(bgReading); getDaoBgReadings().create(bgReading);
log.debug("BG: New record from: " + from + " " + bgReading.toString()); log.debug("BG: New record from: " + from + " " + bgReading.toString());
scheduleBgChange(bgReading, true, isActiveBgSource); scheduleBgChange(bgReading, true, isFromActiveBgSource);
return true; return true;
} }
if (!old.isEqual(bgReading)) { if (!old.isEqual(bgReading)) {
@ -381,7 +381,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
old.copyFrom(bgReading); old.copyFrom(bgReading);
getDaoBgReadings().update(old); getDaoBgReadings().update(old);
log.debug("BG: Updating record from: " + from + " New data: " + old.toString()); log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
scheduleBgChange(bgReading, false, isActiveBgSource); scheduleBgChange(bgReading, false, isFromActiveBgSource);
return false; return false;
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -399,11 +399,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
} }
} }
private static void scheduleBgChange(@Nullable final BgReading bgReading, boolean isNew, boolean isActiveBgSource) { private static void scheduleBgChange(@Nullable final BgReading bgReading, boolean isNew, boolean isFromActiveBgSource) {
class PostRunnable implements Runnable { class PostRunnable implements Runnable {
public void run() { public void run() {
log.debug("Firing EventNewBg"); log.debug("Firing EventNewBg");
MainApp.bus().post(new EventNewBG(bgReading, isNew, isActiveBgSource)); MainApp.bus().post(new EventNewBG(bgReading, isNew, isFromActiveBgSource));
scheduledBgPost = null; scheduledBgPost = null;
} }
} }

View file

@ -11,11 +11,11 @@ public class EventNewBG extends EventLoop {
@Nullable @Nullable
public final BgReading bgReading; public final BgReading bgReading;
public final boolean isNew; public final boolean isNew;
public final boolean isActiveBgSource; public final boolean isFromActiveBgSource;
public EventNewBG(@Nullable BgReading bgReading, boolean isNew, boolean isActiveBgSource) { public EventNewBG(@Nullable BgReading bgReading, boolean isNew, boolean isFromActiveBgSource) {
this.bgReading = bgReading; this.bgReading = bgReading;
this.isNew = isNew; this.isNew = isNew;
this.isActiveBgSource = isActiveBgSource; this.isFromActiveBgSource = isFromActiveBgSource;
} }
} }

View file

@ -531,7 +531,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
@Subscribe @Subscribe
public void onEventNewBG(EventNewBG ev) { public void onEventNewBG(EventNewBG ev) {
if (!ev.isActiveBgSource) if (!ev.isFromActiveBgSource)
return; return;
if (this != getPlugin()) { if (this != getPlugin()) {
log.debug("Ignoring event for non default instance"); log.debug("Ignoring event for non default instance");

View file

@ -161,9 +161,9 @@ public class LoopPlugin implements PluginBase {
public void onStatusEvent(final EventAutosensCalculationFinished ev) { public void onStatusEvent(final EventAutosensCalculationFinished ev) {
if (!(ev.cause instanceof EventNewBG)) if (!(ev.cause instanceof EventNewBG))
return; return;
EventNewBG bgEv = (EventNewBG) ev.cause; EventNewBG bgEv = (EventNewBG) ev.cause;
if (bgEv.isNew && bgEv.isActiveBgSource) { if (bgEv.isNew && bgEv.isFromActiveBgSource) {
invoke("New BG", true); invoke("New BG", true);
} }
} }

View file

@ -142,7 +142,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG e) { public void onStatusEvent(final EventNewBG e) {
if (!e.isActiveBgSource || !e.isNew) if (!e.isFromActiveBgSource || !e.isNew)
return; return;
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) if (activity != null)

View file

@ -255,7 +255,7 @@ public class PersistentNotificationPlugin implements PluginBase {
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
if (ev.isActiveBgSource && ev.isNew) if (ev.isFromActiveBgSource && ev.isNew)
updateNotification(); updateNotification();
} }

View file

@ -182,7 +182,7 @@ public class WearPlugin implements PluginBase {
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
if (ev.isActiveBgSource) if (ev.isFromActiveBgSource)
sendDataToWatch(true, true, true); sendDataToWatch(true, true, true);
} }

View file

@ -235,7 +235,7 @@ public class StatuslinePlugin implements PluginBase {
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
if (ev.isActiveBgSource && ev.isNew) if (ev.isFromActiveBgSource && ev.isNew)
sendStatus(); sendStatus();
} }