diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/NanoStatus.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/NanoStatus.java index 5716b0ba10..9f49212838 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/NanoStatus.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/NanoStatus.java @@ -51,6 +51,9 @@ public class NanoStatus { public final ObservableField watch = new ObservableField<>(); public final ObservableField color_watch = new ObservableField<>(); + public static String debugStringStatic = null; + public String debugString = null; + private static String lastException = ""; public NanoStatus(final String parameter, final int freqMs) { @@ -61,6 +64,9 @@ public NanoStatus(final String parameter, final int freqMs) { running = true; startRefresh(); } + if (debugStringStatic != null) { + debugString = debugStringStatic + " " + parameter; + } } public void setRunning(final boolean state) { @@ -141,6 +147,9 @@ private static SpannableString getLocalOrRemoteSensorExpiry() { static SpannableString collectorNano(final Class service) { if (service != null) { + if (debugStringStatic != null) { + return new SpannableString(debugStringStatic + " " + service.getSimpleName()); + } try { try { return (SpannableString) cache.get(service).invoke(null); @@ -203,6 +212,10 @@ public static SpannableString getRemote() { } public static SpannableString getRemote(final String prefix) { + if (debugStringStatic != null) { + return new SpannableString(debugStringStatic + " " + prefix); + } + // TODO apply timeout? try { val result = PersistentStore.getString(REMOTE_COLLECTOR_STATUS_STORE + prefix); diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 6a91459da7..169c84ba1f 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -535,7 +535,7 @@ android:layout_gravity="center_horizontal" android:gravity="center_horizontal" android:orientation="horizontal" - app:showIfTrue="@{safeUnbox(vs.included[`collector_nano_status`])}"> + app:showIfTrue="@{(safeUnbox(vs.included[`collector_nano_status`]) || safeUnbox(vs.included[`sensor_expiry`]))}"> + app:showIfTrue="@{(safeUnbox(vs.included[`collector_nano_status`] && nano.color_watch.length() > 0))}"/> + app:showIfTrue="@{(safeUnbox(vs.included[`sensor_expiry`]) && (expiry.color_watch.length() > 0))}"/>