diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java index b764c62c94..82b6cc3cc8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/connector/Connector.java @@ -95,7 +95,7 @@ public class Connector { } else { log("PROTOCOL VERSION MISMATCH! local: " + COMPATIBILITY_VERSION + " remote: " + remoteVersion); statusCallback.onStatusChange(Status.INCOMPATIBLE, 0, 0); - compatabilityMessage = gs(R.string.insight_incompatible_compantion_app_we_need_version) + " " + getLocalVersion(); + compatabilityMessage = MainApp.gs(R.string.insight_incompatible_compantion_app_we_need_version) + " " + getLocalVersion(); serviceConnector.disconnectFromService(); } @@ -179,33 +179,29 @@ public class Connector { switch (status) { case EXCHANGING_KEYS: - return gs(R.string.connecting).toUpperCase(); + return MainApp.gs(R.string.connecting).toUpperCase(); case WAITING_FOR_CODE_CONFIRMATION: - return gs(R.string.insight_waiting_for_code).toUpperCase(); + return MainApp.gs(R.string.insight_waiting_for_code).toUpperCase(); case CODE_REJECTED: - return gs(R.string.insight_code_rejected).toUpperCase(); + return MainApp.gs(R.string.insight_code_rejected).toUpperCase(); case APP_BINDING: - return gs(R.string.insight_app_binding).toUpperCase(); + return MainApp.gs(R.string.insight_app_binding).toUpperCase(); case CONNECTING: - return gs(R.string.connecting).toUpperCase(); + return MainApp.gs(R.string.connecting).toUpperCase(); case CONNECTED: - return gs(R.string.connected).toUpperCase(); + return MainApp.gs(R.string.connected).toUpperCase(); case DISCONNECTED: - return gs(R.string.disconnected).toUpperCase(); + return MainApp.gs(R.string.disconnected).toUpperCase(); case NOT_AUTHORIZED: - return gs(R.string.insight_not_authorized).toUpperCase(); + return MainApp.gs(R.string.insight_not_authorized).toUpperCase(); case INCOMPATIBLE: - return gs(R.string.insight_incompatible).toUpperCase(); + return MainApp.gs(R.string.insight_incompatible).toUpperCase(); default: return status.toString(); } } - private static String gs(int id) { - return MainApp.instance().getString(id); - } - private static synchronized void extendKeepAliveIfActive() { if (keepAliveActive()) { if (Helpers.ratelimit("extend-insight-keepalive", 10)) { @@ -384,7 +380,7 @@ public class Connector { public String getLastStatusMessage() { if (!companionAppInstalled) { - return gs(R.string.insight_companion_app_not_installed); + return MainApp.gs(R.string.insight_companion_app_not_installed); } if (!isConnected()) { @@ -398,13 +394,13 @@ public class Connector { // if disconnected but previous state was incompatible return compatabilityMessage; } else { - return gs(R.string.insight_not_connected_to_companion_app); + return MainApp.gs(R.string.insight_not_connected_to_companion_app); } } } if (lastStatus == null) { - return gs(R.string.insight_unknown); + return MainApp.gs(R.string.insight_unknown); } switch (lastStatus) { @@ -414,16 +410,16 @@ public class Connector { } break; case INCOMPATIBLE: - return statusToString(lastStatus) + " " + gs(R.string.insight_needs) + " " + getLocalVersion(); + return statusToString(lastStatus) + " " + MainApp.gs(R.string.insight_needs) + " " + getLocalVersion(); } return statusToString(lastStatus); } public String getNiceLastStatusTime() { if (lastStatusTime < 1) { - return gs(R.string.insight_startup_uppercase); + return MainApp.gs(R.string.insight_startup_uppercase); } else { - return Helpers.niceTimeScalar(Helpers.msSince(lastStatusTime)) + " " + gs(R.string.ago); + return Helpers.niceTimeScalar(Helpers.msSince(lastStatusTime)) + " " + MainApp.gs(R.string.ago); } } @@ -516,7 +512,7 @@ public class Connector { } for (Map.Entry entry : statistics.entrySet()) { if ((long) entry.getValue() > 1000) { - l.add(new StatusItem(gs(R.string.statistics) + " " + Helpers.capitalize(entry.getKey().toString()), + l.add(new StatusItem(MainApp.gs(R.string.statistics) + " " + Helpers.capitalize(entry.getKey().toString()), new Formatter().format("%4s %12s", percentage(getEntryTime(entry), total) + "%", Helpers.niceTimeScalar(getEntryTime(entry))).toString()));