lint & deprecation
This commit is contained in:
parent
9c472e4e05
commit
b7ef191003
11 changed files with 85 additions and 96 deletions
|
@ -7,7 +7,6 @@ import android.content.ServiceConnection;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.text.Html;
|
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
@ -42,6 +41,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientS
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI;
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
|
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper;
|
||||||
import info.nightscout.androidaps.utils.ToastUtils;
|
import info.nightscout.androidaps.utils.ToastUtils;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
@ -56,13 +56,14 @@ public class NSClientPlugin extends PluginBase {
|
||||||
private final RxBusWrapper rxBus;
|
private final RxBusWrapper rxBus;
|
||||||
private final ResourceHelper resourceHelper;
|
private final ResourceHelper resourceHelper;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
private final FabricPrivacy fabricPrivacy;
|
||||||
private final SP sp;
|
private final SP sp;
|
||||||
private final Config config;
|
private final Config config;
|
||||||
|
|
||||||
public Handler handler;
|
public Handler handler;
|
||||||
|
|
||||||
private final List<EventNSClientNewLog> listLog = new ArrayList<>();
|
private final List<EventNSClientNewLog> listLog = new ArrayList<>();
|
||||||
Spanned textLog = Html.fromHtml("");
|
Spanned textLog = HtmlHelper.INSTANCE.fromHtml("");
|
||||||
|
|
||||||
public boolean paused;
|
public boolean paused;
|
||||||
boolean autoscroll;
|
boolean autoscroll;
|
||||||
|
@ -80,6 +81,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
RxBusWrapper rxBus,
|
RxBusWrapper rxBus,
|
||||||
ResourceHelper resourceHelper,
|
ResourceHelper resourceHelper,
|
||||||
Context context,
|
Context context,
|
||||||
|
FabricPrivacy fabricPrivacy,
|
||||||
SP sp,
|
SP sp,
|
||||||
NsClientReceiverDelegate nsClientReceiverDelegate,
|
NsClientReceiverDelegate nsClientReceiverDelegate,
|
||||||
Config config
|
Config config
|
||||||
|
@ -98,6 +100,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
this.rxBus = rxBus;
|
this.rxBus = rxBus;
|
||||||
this.resourceHelper = resourceHelper;
|
this.resourceHelper = resourceHelper;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
this.fabricPrivacy = fabricPrivacy;
|
||||||
this.sp = sp;
|
this.sp = sp;
|
||||||
this.nsClientReceiverDelegate = nsClientReceiverDelegate;
|
this.nsClientReceiverDelegate = nsClientReceiverDelegate;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
@ -134,17 +137,17 @@ public class NSClientPlugin extends PluginBase {
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
status = event.getStatus(resourceHelper);
|
status = event.getStatus(resourceHelper);
|
||||||
rxBus.send(new EventNSClientUpdateGUI());
|
rxBus.send(new EventNSClientUpdateGUI());
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventNetworkChange.class)
|
.toObservable(EventNetworkChange.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventPreferenceChange.class)
|
.toObservable(EventPreferenceChange.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventAppExit.class)
|
.toObservable(EventAppExit.class)
|
||||||
|
@ -153,7 +156,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
if (nsClientService != null) {
|
if (nsClientService != null) {
|
||||||
context.unbindService(mConnection);
|
context.unbindService(mConnection);
|
||||||
}
|
}
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventNSClientNewLog.class)
|
.toObservable(EventNSClientNewLog.class)
|
||||||
|
@ -161,17 +164,17 @@ public class NSClientPlugin extends PluginBase {
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
addToLog(event);
|
addToLog(event);
|
||||||
aapsLogger.debug(LTag.NSCLIENT, event.getAction() + " " + event.getLogText());
|
aapsLogger.debug(LTag.NSCLIENT, event.getAction() + " " + event.getLogText());
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventChargingState.class)
|
.toObservable(EventChargingState.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(event -> nsClientReceiverDelegate.onStatusEvent(event), fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventNSClientResend.class)
|
.toObservable(EventNSClientResend.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(event -> resend(event.getReason()), exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(event -> resend(event.getReason()), fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +239,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
newTextLog.append(log.toPreparedHtml());
|
newTextLog.append(log.toPreparedHtml());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textLog = Html.fromHtml(newTextLog.toString());
|
textLog = HtmlHelper.INSTANCE.fromHtml(newTextLog.toString());
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error);
|
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,11 @@ package info.nightscout.androidaps.plugins.general.nsclient.acks;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart;
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
|
@ -16,16 +14,23 @@ import io.socket.client.Ack;
|
||||||
* Created by mike on 29.12.2015.
|
* Created by mike on 29.12.2015.
|
||||||
*/
|
*/
|
||||||
public class NSAddAck extends Event implements Ack {
|
public class NSAddAck extends Event implements Ack {
|
||||||
private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.NSCLIENT);
|
private final AAPSLogger aapsLogger;
|
||||||
|
private final RxBusWrapper rxBus;
|
||||||
|
|
||||||
public String _id = null;
|
public String _id = null;
|
||||||
public String nsClientID = null;
|
public String nsClientID = null;
|
||||||
public JSONObject json = null;
|
public JSONObject json = null;
|
||||||
|
|
||||||
|
public NSAddAck(AAPSLogger aapsLogger, RxBusWrapper rxBus) {
|
||||||
|
this.aapsLogger = aapsLogger;
|
||||||
|
this.rxBus = rxBus;
|
||||||
|
}
|
||||||
|
|
||||||
public void call(Object... args) {
|
public void call(Object... args) {
|
||||||
// Regular response
|
// Regular response
|
||||||
try {
|
try {
|
||||||
JSONArray responsearray = (JSONArray) (args[0]);
|
JSONArray responsearray = (JSONArray) (args[0]);
|
||||||
JSONObject response = null;
|
JSONObject response;
|
||||||
if (responsearray.length() > 0) {
|
if (responsearray.length() > 0) {
|
||||||
response = responsearray.getJSONObject(0);
|
response = responsearray.getJSONObject(0);
|
||||||
_id = response.getString("_id");
|
_id = response.getString("_id");
|
||||||
|
@ -34,10 +39,10 @@ public class NSAddAck extends Event implements Ack {
|
||||||
nsClientID = response.getString("NSCLIENT_ID");
|
nsClientID = response.getString("NSCLIENT_ID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RxBus.Companion.getINSTANCE().send(this);
|
rxBus.send(this);
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
// Check for not authorized
|
// Check for not authorized
|
||||||
try {
|
try {
|
||||||
|
@ -45,15 +50,13 @@ public class NSAddAck extends Event implements Ack {
|
||||||
if (response.has("result")) {
|
if (response.has("result")) {
|
||||||
_id = null;
|
_id = null;
|
||||||
if (response.getString("result").contains("Not")) {
|
if (response.getString("result").contains("Not")) {
|
||||||
RxBus.Companion.getINSTANCE().send(new EventNSClientRestart());
|
rxBus.send(new EventNSClientRestart());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (L.isEnabled(LTag.NSCLIENT))
|
aapsLogger.debug(LTag.NSCLIENT, "DBACCESS " + response.getString("result"));
|
||||||
log.debug("DBACCESS " + response.getString("result"));
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,11 +2,10 @@ package info.nightscout.androidaps.plugins.general.nsclient.acks;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import io.socket.client.Ack;
|
import io.socket.client.Ack;
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ import io.socket.client.Ack;
|
||||||
* Created by mike on 21.02.2016.
|
* Created by mike on 21.02.2016.
|
||||||
*/
|
*/
|
||||||
public class NSUpdateAck extends Event implements Ack {
|
public class NSUpdateAck extends Event implements Ack {
|
||||||
private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.NSCLIENT);
|
private final AAPSLogger aapsLogger;
|
||||||
public boolean result = false;
|
public boolean result = false;
|
||||||
public String _id;
|
public String _id;
|
||||||
public String action;
|
public String action;
|
||||||
|
@ -27,17 +26,18 @@ public class NSUpdateAck extends Event implements Ack {
|
||||||
result = true;
|
result = true;
|
||||||
else if (response.getString("result").equals("Missing _id")) {
|
else if (response.getString("result").equals("Missing _id")) {
|
||||||
result = true;
|
result = true;
|
||||||
log.debug("Internal error: Missing _id returned on dbUpdate ack");
|
aapsLogger.debug(LTag.NSCLIENT, "Internal error: Missing _id returned on dbUpdate ack");
|
||||||
}
|
}
|
||||||
RxBus.Companion.getINSTANCE().send(this);
|
RxBus.Companion.getINSTANCE().send(this);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NSUpdateAck(String action, String _id) {
|
public NSUpdateAck(String action, String _id, AAPSLogger aapsLogger) {
|
||||||
super();
|
super();
|
||||||
this.action = action;
|
this.action = action;
|
||||||
this._id = _id;
|
this._id = _id;
|
||||||
|
this.aapsLogger = aapsLogger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
import info.nightscout.androidaps.plugins.aps.loop.APSResult;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper;
|
||||||
import info.nightscout.androidaps.utils.Round;
|
import info.nightscout.androidaps.utils.Round;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
@ -158,7 +159,7 @@ public class NSDeviceStatus {
|
||||||
public Spanned getExtendedPumpStatus() {
|
public Spanned getExtendedPumpStatus() {
|
||||||
if (deviceStatusPumpData != null && deviceStatusPumpData.extended != null)
|
if (deviceStatusPumpData != null && deviceStatusPumpData.extended != null)
|
||||||
return deviceStatusPumpData.extended;
|
return deviceStatusPumpData.extended;
|
||||||
return Html.fromHtml("");
|
return HtmlHelper.INSTANCE.fromHtml("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spanned getPumpStatus() {
|
public Spanned getPumpStatus() {
|
||||||
|
@ -170,7 +171,7 @@ public class NSDeviceStatus {
|
||||||
string.append(": </span>");
|
string.append(": </span>");
|
||||||
|
|
||||||
if (deviceStatusPumpData == null)
|
if (deviceStatusPumpData == null)
|
||||||
return Html.fromHtml("");
|
return HtmlHelper.INSTANCE.fromHtml("");
|
||||||
|
|
||||||
// test warning level
|
// test warning level
|
||||||
int level = Levels.INFO;
|
int level = Levels.INFO;
|
||||||
|
@ -225,7 +226,7 @@ public class NSDeviceStatus {
|
||||||
|
|
||||||
string.append("</span>"); // color
|
string.append("</span>"); // color
|
||||||
|
|
||||||
return Html.fromHtml(string.toString());
|
return HtmlHelper.INSTANCE.fromHtml(string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DeviceStatusPumpData {
|
static class DeviceStatusPumpData {
|
||||||
|
@ -273,7 +274,7 @@ public class NSDeviceStatus {
|
||||||
String value = extendedJson.getString(key);
|
String value = extendedJson.getString(key);
|
||||||
exteneded.append("<b>").append(key).append(":</b> ").append(value).append("<br>");
|
exteneded.append("<b>").append(key).append(":</b> ").append(value).append("<br>");
|
||||||
}
|
}
|
||||||
deviceStatusPumpData.extended = Html.fromHtml(exteneded.toString());
|
deviceStatusPumpData.extended = HtmlHelper.INSTANCE.fromHtml(exteneded.toString());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
aapsLogger.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
|
@ -345,7 +346,7 @@ public class NSDeviceStatus {
|
||||||
}
|
}
|
||||||
string.append("</span>"); // color
|
string.append("</span>"); // color
|
||||||
|
|
||||||
return Html.fromHtml(string.toString());
|
return HtmlHelper.INSTANCE.fromHtml(string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getOpenApsTimestamp() {
|
public static long getOpenApsTimestamp() {
|
||||||
|
@ -365,11 +366,11 @@ public class NSDeviceStatus {
|
||||||
string.append("<b>").append(DateUtil.minAgo(resourceHelper, deviceStatusOpenAPSData.clockEnacted)).append("</b> ").append(deviceStatusOpenAPSData.enacted.getString("reason")).append("<br>");
|
string.append("<b>").append(DateUtil.minAgo(resourceHelper, deviceStatusOpenAPSData.clockEnacted)).append("</b> ").append(deviceStatusOpenAPSData.enacted.getString("reason")).append("<br>");
|
||||||
if (deviceStatusOpenAPSData.suggested != null)
|
if (deviceStatusOpenAPSData.suggested != null)
|
||||||
string.append("<b>").append(DateUtil.minAgo(resourceHelper, deviceStatusOpenAPSData.clockSuggested)).append("</b> ").append(deviceStatusOpenAPSData.suggested.getString("reason")).append("<br>");
|
string.append("<b>").append(DateUtil.minAgo(resourceHelper, deviceStatusOpenAPSData.clockSuggested)).append("</b> ").append(deviceStatusOpenAPSData.suggested.getString("reason")).append("<br>");
|
||||||
return Html.fromHtml(string.toString());
|
return HtmlHelper.INSTANCE.fromHtml(string.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
aapsLogger.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return Html.fromHtml("");
|
return HtmlHelper.INSTANCE.fromHtml("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********* Uploader data ***********
|
// ********* Uploader data ***********
|
||||||
|
@ -441,7 +442,7 @@ public class NSDeviceStatus {
|
||||||
|
|
||||||
string.append(minBattery);
|
string.append(minBattery);
|
||||||
string.append("%");
|
string.append("%");
|
||||||
return Html.fromHtml(string.toString());
|
return HtmlHelper.INSTANCE.fromHtml(string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spanned getExtendedUploaderStatus() {
|
public Spanned getExtendedUploaderStatus() {
|
||||||
|
@ -455,7 +456,7 @@ public class NSDeviceStatus {
|
||||||
string.append("<b>").append(device).append(":</b> ").append(uploader.battery).append("%<br>");
|
string.append("<b>").append(device).append(":</b> ").append(uploader.battery).append("%<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Html.fromHtml(string.toString());
|
return HtmlHelper.INSTANCE.fromHtml(string.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static APSResult getAPSResult(HasAndroidInjector injector) {
|
public static APSResult getAPSResult(HasAndroidInjector injector) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import com.j256.ormlite.dao.CloseableIterator;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -41,9 +40,7 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileStore;
|
import info.nightscout.androidaps.interfaces.ProfileStore;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.L;
|
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
|
||||||
|
@ -87,13 +84,13 @@ public class NSClientService extends DaggerService {
|
||||||
@Inject RxBusWrapper rxBus;
|
@Inject RxBusWrapper rxBus;
|
||||||
@Inject ResourceHelper resourceHelper;
|
@Inject ResourceHelper resourceHelper;
|
||||||
@Inject SP sp;
|
@Inject SP sp;
|
||||||
|
@Inject FabricPrivacy fabricPrivacy;
|
||||||
@Inject NSClientPlugin nsClientPlugin;
|
@Inject NSClientPlugin nsClientPlugin;
|
||||||
@Inject BuildHelper buildHelper;
|
@Inject BuildHelper buildHelper;
|
||||||
@Inject Config config;
|
@Inject Config config;
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
@Inject UploadQueue uploadQueue;
|
@Inject UploadQueue uploadQueue;
|
||||||
|
|
||||||
private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.NSCLIENT);
|
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
static public PowerManager.WakeLock mWakeLock;
|
static public PowerManager.WakeLock mWakeLock;
|
||||||
|
@ -157,7 +154,7 @@ public class NSClientService extends DaggerService {
|
||||||
destroy();
|
destroy();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventPreferenceChange.class)
|
.toObservable(EventPreferenceChange.class)
|
||||||
|
@ -171,17 +168,16 @@ public class NSClientService extends DaggerService {
|
||||||
destroy();
|
destroy();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventAppExit.class)
|
.toObservable(EventAppExit.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
if (L.isEnabled(LTag.NSCLIENT))
|
aapsLogger.debug(LTag.NSCLIENT, "EventAppExit received");
|
||||||
log.debug("EventAppExit received");
|
|
||||||
destroy();
|
destroy();
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventNSClientRestart.class)
|
.toObservable(EventNSClientRestart.class)
|
||||||
|
@ -189,22 +185,22 @@ public class NSClientService extends DaggerService {
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
latestDateInReceivedData = 0;
|
latestDateInReceivedData = 0;
|
||||||
restart();
|
restart();
|
||||||
}, exception -> FabricPrivacy.getInstance().logException(exception))
|
}, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(NSAuthAck.class)
|
.toObservable(NSAuthAck.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(this::processAuthAck, exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(this::processAuthAck, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(NSUpdateAck.class)
|
.toObservable(NSUpdateAck.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(this::processUpdateAck, exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(this::processUpdateAck, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(NSAddAck.class)
|
.toObservable(NSAddAck.class)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(this::processAddAck, exception -> FabricPrivacy.getInstance().logException(exception))
|
.subscribe(this::processAddAck, fabricPrivacy::logException)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +270,7 @@ public class NSClientService extends DaggerService {
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
dataCounter = 0;
|
dataCounter = 0;
|
||||||
|
|
||||||
|
@ -366,8 +363,7 @@ public class NSClientService extends DaggerService {
|
||||||
private Emitter.Listener onDisconnect = new Emitter.Listener() {
|
private Emitter.Listener onDisconnect = new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... args) {
|
public void call(Object... args) {
|
||||||
if (L.isEnabled(LTag.NSCLIENT))
|
aapsLogger.debug(LTag.NSCLIENT, "disconnect reason: {}", args);
|
||||||
log.debug("disconnect reason: {}", args);
|
|
||||||
rxBus.send(new EventNSClientNewLog("NSCLIENT", "disconnect event"));
|
rxBus.send(new EventNSClientNewLog("NSCLIENT", "disconnect event"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -401,7 +397,7 @@ public class NSClientService extends DaggerService {
|
||||||
authMessage.put("from", latestDateInReceivedData); // send data newer than
|
authMessage.put("from", latestDateInReceivedData); // send data newer than
|
||||||
authMessage.put("secret", nsAPIhashCode);
|
authMessage.put("secret", nsAPIhashCode);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rxBus.send(new EventNSClientNewLog("AUTH", "requesting auth"));
|
rxBus.send(new EventNSClientNewLog("AUTH", "requesting auth"));
|
||||||
|
@ -455,8 +451,7 @@ public class NSClientService extends DaggerService {
|
||||||
data = (JSONObject) args[0];
|
data = (JSONObject) args[0];
|
||||||
handleAnnouncement(data);
|
handleAnnouncement(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -482,8 +477,7 @@ public class NSClientService extends DaggerService {
|
||||||
data = (JSONObject) args[0];
|
data = (JSONObject) args[0];
|
||||||
handleAlarm(data);
|
handleAlarm(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -494,7 +488,7 @@ public class NSClientService extends DaggerService {
|
||||||
data = (JSONObject) args[0];
|
data = (JSONObject) args[0];
|
||||||
handleUrgentAlarm(data);
|
handleUrgentAlarm(data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -517,8 +511,7 @@ public class NSClientService extends DaggerService {
|
||||||
rxBus.send(new EventDismissNotification(Notification.NSURGENTALARM));
|
rxBus.send(new EventDismissNotification(Notification.NSURGENTALARM));
|
||||||
aapsLogger.debug(LTag.NSCLIENT, data.toString());
|
aapsLogger.debug(LTag.NSCLIENT, data.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -723,7 +716,7 @@ public class NSClientService extends DaggerService {
|
||||||
}
|
}
|
||||||
rxBus.send(new EventNSClientNewLog("LAST", dateUtil.dateAndTimeString(latestDateInReceivedData)));
|
rxBus.send(new EventNSClientNewLog("LAST", dateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
//rxBus.send(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
|
//rxBus.send(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -743,7 +736,7 @@ public class NSClientService extends DaggerService {
|
||||||
mSocket.emit("dbUpdate", message, ack);
|
mSocket.emit("dbUpdate", message, ack);
|
||||||
rxBus.send(new EventNSClientNewLog("DBUPDATE " + dbr.collection, "Sent " + dbr._id));
|
rxBus.send(new EventNSClientNewLog("DBUPDATE " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +750,7 @@ public class NSClientService extends DaggerService {
|
||||||
mSocket.emit("dbUpdateUnset", message, ack);
|
mSocket.emit("dbUpdateUnset", message, ack);
|
||||||
rxBus.send(new EventNSClientNewLog("DBUPDATEUNSET " + dbr.collection, "Sent " + dbr._id));
|
rxBus.send(new EventNSClientNewLog("DBUPDATEUNSET " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +763,7 @@ public class NSClientService extends DaggerService {
|
||||||
mSocket.emit("dbRemove", message, ack);
|
mSocket.emit("dbRemove", message, ack);
|
||||||
rxBus.send(new EventNSClientNewLog("DBREMOVE " + dbr.collection, "Sent " + dbr._id));
|
rxBus.send(new EventNSClientNewLog("DBREMOVE " + dbr.collection, "Sent " + dbr._id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +776,7 @@ public class NSClientService extends DaggerService {
|
||||||
mSocket.emit("dbAdd", message, ack);
|
mSocket.emit("dbAdd", message, ack);
|
||||||
rxBus.send(new EventNSClientNewLog("DBADD " + dbr.collection, "Sent " + dbr.nsClientID));
|
rxBus.send(new EventNSClientNewLog("DBADD " + dbr.collection, "Sent " + dbr.nsClientID));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,16 +811,16 @@ public class NSClientService extends DaggerService {
|
||||||
while (iterator.hasNext() && maxcount > 0) {
|
while (iterator.hasNext() && maxcount > 0) {
|
||||||
DbRequest dbr = iterator.next();
|
DbRequest dbr = iterator.next();
|
||||||
if (dbr.action.equals("dbAdd")) {
|
if (dbr.action.equals("dbAdd")) {
|
||||||
NSAddAck addAck = new NSAddAck();
|
NSAddAck addAck = new NSAddAck(aapsLogger, rxBus);
|
||||||
dbAdd(dbr, addAck);
|
dbAdd(dbr, addAck);
|
||||||
} else if (dbr.action.equals("dbRemove")) {
|
} else if (dbr.action.equals("dbRemove")) {
|
||||||
NSUpdateAck removeAck = new NSUpdateAck(dbr.action, dbr._id);
|
NSUpdateAck removeAck = new NSUpdateAck(dbr.action, dbr._id, aapsLogger);
|
||||||
dbRemove(dbr, removeAck);
|
dbRemove(dbr, removeAck);
|
||||||
} else if (dbr.action.equals("dbUpdate")) {
|
} else if (dbr.action.equals("dbUpdate")) {
|
||||||
NSUpdateAck updateAck = new NSUpdateAck(dbr.action, dbr._id);
|
NSUpdateAck updateAck = new NSUpdateAck(dbr.action, dbr._id, aapsLogger);
|
||||||
dbUpdate(dbr, updateAck);
|
dbUpdate(dbr, updateAck);
|
||||||
} else if (dbr.action.equals("dbUpdateUnset")) {
|
} else if (dbr.action.equals("dbUpdateUnset")) {
|
||||||
NSUpdateAck updateUnsetAck = new NSUpdateAck(dbr.action, dbr._id);
|
NSUpdateAck updateUnsetAck = new NSUpdateAck(dbr.action, dbr._id, aapsLogger);
|
||||||
dbUpdateUnset(dbr, updateUnsetAck);
|
dbUpdateUnset(dbr, updateUnsetAck);
|
||||||
}
|
}
|
||||||
maxcount--;
|
maxcount--;
|
||||||
|
@ -836,7 +829,7 @@ public class NSClientService extends DaggerService {
|
||||||
iterator.close();
|
iterator.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
rxBus.send(new EventNSClientNewLog("QUEUE", "Resend ended: " + reason));
|
rxBus.send(new EventNSClientNewLog("QUEUE", "Resend ended: " + reason));
|
||||||
|
@ -1038,7 +1031,7 @@ public class NSClientService extends DaggerService {
|
||||||
ret.add(newarr);
|
ret.add(newarr);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
aapsLogger.error("Unhandled exception", e);
|
||||||
ret = new ArrayList<>();
|
ret = new ArrayList<>();
|
||||||
ret.add(array);
|
ret.add(array);
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,7 @@ public class TDDStatsActivity extends NoSplashAppCompatActivity {
|
||||||
historyList = historyList.subList(0, Math.min(10, historyList.size()));
|
historyList = historyList.subList(0, Math.min(10, historyList.size()));
|
||||||
|
|
||||||
//fill single gaps
|
//fill single gaps
|
||||||
dummies = new LinkedList();
|
dummies = new LinkedList<>();
|
||||||
DateFormat df = new SimpleDateFormat("dd.MM.", Locale.getDefault());
|
DateFormat df = new SimpleDateFormat("dd.MM.", Locale.getDefault());
|
||||||
for (int i = 0; i < historyList.size() - 1; i++) {
|
for (int i = 0; i < historyList.size() - 1; i++) {
|
||||||
TDD elem1 = historyList.get(i);
|
TDD elem1 = historyList.get(i);
|
||||||
|
|
|
@ -2,19 +2,15 @@ package info.nightscout.androidaps.data;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.Round;
|
import info.nightscout.androidaps.utils.Round;
|
||||||
|
|
||||||
public class IobTotal implements DataPointWithLabelInterface {
|
public class IobTotal implements DataPointWithLabelInterface {
|
||||||
private static Logger log = StacktraceLoggerWrapper.getLogger(IobTotal.class);
|
|
||||||
|
|
||||||
public double iob;
|
public double iob;
|
||||||
public double activity;
|
public double activity;
|
||||||
|
@ -108,8 +104,7 @@ public class IobTotal implements DataPointWithLabelInterface {
|
||||||
json.put("basaliob", basaliob);
|
json.put("basaliob", basaliob);
|
||||||
json.put("activity", activity);
|
json.put("activity", activity);
|
||||||
json.put("time", DateUtil.toISOString(new Date()));
|
json.put("time", DateUtil.toISOString(new Date()));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException ignored) {
|
||||||
log.error("Unhandled exception", e);
|
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
@ -139,8 +134,7 @@ public class IobTotal implements DataPointWithLabelInterface {
|
||||||
JSONObject iwzt = iobWithZeroTemp.determineBasalJson();
|
JSONObject iwzt = iobWithZeroTemp.determineBasalJson();
|
||||||
json.put("iobWithZeroTemp", iwzt);
|
json.put("iobWithZeroTemp", iwzt);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException ignored) {
|
||||||
log.error("Unhandled exception", e);
|
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||||
// When no interval match the lastest record without duration is used
|
// When no interval match the lastest record without duration is used
|
||||||
|
|
||||||
public class ProfileIntervals<T extends Interval> {
|
public class ProfileIntervals<T extends Interval> {
|
||||||
private static Logger log = StacktraceLoggerWrapper.getLogger(ProfileIntervals.class);
|
|
||||||
|
|
||||||
private LongSparseArray<T> rawData; // oldest at index 0
|
private LongSparseArray<T> rawData; // oldest at index 0
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.androidaps.logging.LTag;
|
||||||
* Created by mike on 19.03.2018.
|
* Created by mike on 19.03.2018.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Constraint<T extends Comparable> {
|
public class Constraint<T extends Comparable<T>> {
|
||||||
private T value;
|
private T value;
|
||||||
private T originalValue;
|
private T originalValue;
|
||||||
|
|
||||||
|
@ -85,14 +85,12 @@ public class Constraint<T extends Comparable> {
|
||||||
return from.getClass().getSimpleName().replace("Plugin", "");
|
return from.getClass().getSimpleName().replace("Plugin", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Constraint addReason(String reason, Object from) {
|
public void addReason(String reason, Object from) {
|
||||||
reasons.add(translateFrom(from) + ": " + reason);
|
reasons.add(translateFrom(from) + ": " + reason);
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Constraint addMostLimingReason(String reason, Object from) {
|
private void addMostLimingReason(String reason, Object from) {
|
||||||
mostLimiting.add(translateFrom(from) + ": " + reason);
|
mostLimiting.add(translateFrom(from) + ": " + reason);
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReasons(AAPSLogger aapsLogger) {
|
public String getReasons(AAPSLogger aapsLogger) {
|
||||||
|
@ -102,7 +100,7 @@ public class Constraint<T extends Comparable> {
|
||||||
if (count++ != 0) sb.append("\n");
|
if (count++ != 0) sb.append("\n");
|
||||||
sb.append(r);
|
sb.append(r);
|
||||||
}
|
}
|
||||||
aapsLogger.debug(LTag.CONSTRAINTS, "Limiting origial value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
aapsLogger.debug(LTag.CONSTRAINTS, "Limiting original value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +115,7 @@ public class Constraint<T extends Comparable> {
|
||||||
if (count++ != 0) sb.append("\n");
|
if (count++ != 0) sb.append("\n");
|
||||||
sb.append(r);
|
sb.append(r);
|
||||||
}
|
}
|
||||||
aapsLogger.debug(LTag.CONSTRAINTS, "Limiting origial value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
aapsLogger.debug(LTag.CONSTRAINTS, "Limiting original value: " + originalValue + " to " + value + ". Reason: " + sb.toString());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,8 +124,6 @@ public class Constraint<T extends Comparable> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyReasons(Constraint<?> another) {
|
public void copyReasons(Constraint<?> another) {
|
||||||
for (String s : another.getReasonList()) {
|
reasons.addAll(another.getReasonList());
|
||||||
reasons.add(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.androidaps.plugins.aps.loop;
|
package info.nightscout.androidaps.plugins.aps.loop;
|
||||||
|
|
||||||
import android.text.Html;
|
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -20,14 +19,15 @@ import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ public class APSResult {
|
||||||
|
|
||||||
// reason
|
// reason
|
||||||
ret += "<b>" + resourceHelper.gs(R.string.reason) + "</b>: " + reason.replace("<", "<").replace(">", ">");
|
ret += "<b>" + resourceHelper.gs(R.string.reason) + "</b>: " + reason.replace("<", "<").replace(">", ">");
|
||||||
return Html.fromHtml(ret);
|
return HtmlHelper.INSTANCE.fromHtml(ret);
|
||||||
} else
|
} else
|
||||||
return Html.fromHtml(resourceHelper.gs(R.string.nochangerequested));
|
return HtmlHelper.INSTANCE.fromHtml(resourceHelper.gs(R.string.nochangerequested));
|
||||||
}
|
}
|
||||||
|
|
||||||
public APSResult newAndClone(HasAndroidInjector injector) {
|
public APSResult newAndClone(HasAndroidInjector injector) {
|
||||||
|
|
Loading…
Reference in a new issue