Rename isActiveBgSource -> isFromActiveBgSource.
This commit is contained in:
parent
8849df639f
commit
a7ca483565
|
@ -366,14 +366,14 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
}
|
||||
// ------------------- BgReading handling -----------------------
|
||||
|
||||
public boolean createIfNotExists(BgReading bgReading, String from, boolean isActiveBgSource) {
|
||||
public boolean createIfNotExists(BgReading bgReading, String from, boolean isFromActiveBgSource) {
|
||||
try {
|
||||
bgReading.date = roundDateToSec(bgReading.date);
|
||||
BgReading old = getDaoBgReadings().queryForId(bgReading.date);
|
||||
if (old == null) {
|
||||
getDaoBgReadings().create(bgReading);
|
||||
log.debug("BG: New record from: " + from + " " + bgReading.toString());
|
||||
scheduleBgChange(bgReading, true, isActiveBgSource);
|
||||
scheduleBgChange(bgReading, true, isFromActiveBgSource);
|
||||
return true;
|
||||
}
|
||||
if (!old.isEqual(bgReading)) {
|
||||
|
@ -381,7 +381,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
old.copyFrom(bgReading);
|
||||
getDaoBgReadings().update(old);
|
||||
log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
|
||||
scheduleBgChange(bgReading, false, isActiveBgSource);
|
||||
scheduleBgChange(bgReading, false, isFromActiveBgSource);
|
||||
return false;
|
||||
}
|
||||
} 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 {
|
||||
public void run() {
|
||||
log.debug("Firing EventNewBg");
|
||||
MainApp.bus().post(new EventNewBG(bgReading, isNew, isActiveBgSource));
|
||||
MainApp.bus().post(new EventNewBG(bgReading, isNew, isFromActiveBgSource));
|
||||
scheduledBgPost = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ public class EventNewBG extends EventLoop {
|
|||
@Nullable
|
||||
public final BgReading bgReading;
|
||||
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.isNew = isNew;
|
||||
this.isActiveBgSource = isActiveBgSource;
|
||||
this.isFromActiveBgSource = isFromActiveBgSource;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
|
||||
@Subscribe
|
||||
public void onEventNewBG(EventNewBG ev) {
|
||||
if (!ev.isActiveBgSource)
|
||||
if (!ev.isFromActiveBgSource)
|
||||
return;
|
||||
if (this != getPlugin()) {
|
||||
log.debug("Ignoring event for non default instance");
|
||||
|
|
|
@ -161,9 +161,9 @@ public class LoopPlugin implements PluginBase {
|
|||
public void onStatusEvent(final EventAutosensCalculationFinished ev) {
|
||||
if (!(ev.cause instanceof EventNewBG))
|
||||
return;
|
||||
|
||||
|
||||
EventNewBG bgEv = (EventNewBG) ev.cause;
|
||||
if (bgEv.isNew && bgEv.isActiveBgSource) {
|
||||
if (bgEv.isNew && bgEv.isFromActiveBgSource) {
|
||||
invoke("New BG", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG e) {
|
||||
if (!e.isActiveBgSource || !e.isNew)
|
||||
if (!e.isFromActiveBgSource || !e.isNew)
|
||||
return;
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
|
|
|
@ -255,7 +255,7 @@ public class PersistentNotificationPlugin implements PluginBase {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
if (ev.isActiveBgSource && ev.isNew)
|
||||
if (ev.isFromActiveBgSource && ev.isNew)
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ public class WearPlugin implements PluginBase {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
if (ev.isActiveBgSource)
|
||||
if (ev.isFromActiveBgSource)
|
||||
sendDataToWatch(true, true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ public class StatuslinePlugin implements PluginBase {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
if (ev.isActiveBgSource && ev.isNew)
|
||||
if (ev.isFromActiveBgSource && ev.isNew)
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue