From 796b7ecdf27333b4fdd3577fa0c7cc514a757f9e Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sat, 22 Jul 2017 21:59:44 +0200 Subject: [PATCH 01/13] rename package lowercase --- .../plugins/SmsCommunicator/{Events => events}/EventNewSMS.java | 0 .../{Events => events}/EventSmsCommunicatorUpdateGui.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/{Events => events}/EventNewSMS.java (100%) rename app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/{Events => events}/EventSmsCommunicatorUpdateGui.java (100%) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/Events/EventNewSMS.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/events/EventNewSMS.java similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/Events/EventNewSMS.java rename to app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/events/EventNewSMS.java diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/Events/EventSmsCommunicatorUpdateGui.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/events/EventSmsCommunicatorUpdateGui.java similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/Events/EventSmsCommunicatorUpdateGui.java rename to app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/events/EventSmsCommunicatorUpdateGui.java From 38100e758ee17aad3e258a642dbfdc4b15389636 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 01:50:27 +0200 Subject: [PATCH 02/13] nsclient treatments local --- app/src/main/AndroidManifest.xml | 3 - .../info/nightscout/androidaps/MainApp.java | 17 +++ .../broadcasts/BroadcastTreatment.java | 108 ++++++++++++++---- 3 files changed, 101 insertions(+), 27 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 74271acb90..25a88a5939 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -58,9 +58,6 @@ - - - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 9dff7b0b5a..dec4f1c932 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -2,8 +2,10 @@ package info.nightscout.androidaps; import android.app.Application; import android.content.Intent; +import android.content.IntentFilter; import android.content.res.Resources; import android.support.annotation.Nullable; +import android.support.v4.content.LocalBroadcastManager; import com.crashlytics.android.Crashlytics; import com.crashlytics.android.answers.Answers; @@ -17,6 +19,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.interfaces.InsulinInterface; import info.nightscout.androidaps.interfaces.PluginBase; @@ -59,6 +62,7 @@ import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment; import info.nightscout.androidaps.plugins.Wear.WearFragment; import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin; +import info.nightscout.androidaps.receivers.DataReceiver; import info.nightscout.androidaps.receivers.KeepAliveReceiver; import info.nightscout.utils.NSUpload; import io.fabric.sdk.android.Fabric; @@ -77,6 +81,9 @@ public class MainApp extends Application { private static ArrayList pluginsList = null; + private static DataReceiver dataReceiver = new DataReceiver(); + private LocalBroadcastManager lbm; + @Override public void onCreate() { super.onCreate(); @@ -92,6 +99,8 @@ public class MainApp extends Application { sInstance = this; sResources = getResources(); + registerLocalBroadcastReceiver(); + if (pluginsList == null) { pluginsList = new ArrayList<>(); // Register all tabs in app here @@ -155,6 +164,14 @@ public class MainApp extends Application { } }); t.start(); + + } + + private void registerLocalBroadcastReceiver() { + lbm = LocalBroadcastManager.getInstance(this); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_CHANGED_TREATMENT)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT)); } private void startKeepAliveService() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java index 60540d7613..b6711b75e0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.os.TransactionTooLargeException; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONException; @@ -15,9 +16,11 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment; import info.nightscout.utils.SP; +import info.nightscout.utils.ToastUtils; /** * Created by mike on 20.02.2016. @@ -27,21 +30,27 @@ public class BroadcastTreatment { public static void handleNewTreatment(NSTreatment treatment, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("treatment", treatment.getData().toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("treatment", treatment.getData().toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } public static void handleNewTreatment(JSONArray treatments, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - List splitted = splitArray(treatments); for (JSONArray part: splitted) { Bundle bundle = new Bundle(); @@ -50,42 +59,73 @@ public class BroadcastTreatment { Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + } + + if(SP.getBoolean("nsclient_localbroadcasts", true)){ + splitted = splitArray(treatments); + for (JSONArray part: splitted) { + Bundle bundle = new Bundle(); + bundle.putString("treatments", part.toString()); + bundle.putBoolean("delta", isDelta); + Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } public void handleChangedTreatment(JSONObject treatment, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("treatment", treatment.toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); - } + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - public static void handleChangedTreatment(JSONArray treatments, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - - List splitted = splitArray(treatments); - for (JSONArray part: splitted) { - Bundle bundle = new Bundle(); - bundle.putString("treatments", part.toString()); + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("treatment", treatment.toString()); bundle.putBoolean("delta", isDelta); - Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT); + intent = new Intent(Intents.ACTION_CHANGED_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); context.sendBroadcast(intent); } } - public static void handleRemovedTreatment(JSONObject treatment, Context context, boolean isDelta) { + public static void handleChangedTreatment(JSONArray treatments, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; + List splitted = splitArray(treatments); + for (JSONArray part : splitted) { + Bundle bundle = new Bundle(); + bundle.putString("treatments", part.toString()); + bundle.putBoolean("delta", isDelta); + Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + } + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + splitted = splitArray(treatments); + for (JSONArray part : splitted) { + Bundle bundle = new Bundle(); + bundle.putString("treatments", part.toString()); + bundle.putBoolean("delta", isDelta); + Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } + } + } + + public static void handleRemovedTreatment(JSONObject treatment, Context context, boolean isDelta) { Bundle bundle = new Bundle(); bundle.putString("treatment", treatment.toString()); @@ -93,20 +133,40 @@ public class BroadcastTreatment { Intent intent = new Intent(Intents.ACTION_REMOVED_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("treatment", treatment.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_REMOVED_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } public static void handleRemovedTreatment(JSONArray treatments, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("treatments", treatments.toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_REMOVED_TREATMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("treatments", treatments.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_REMOVED_TREATMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } From 7a171bd94910123e73f2d54b9805cc32e67bd688 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 01:55:01 +0200 Subject: [PATCH 03/13] nsclient sgv local --- app/src/main/AndroidManifest.xml | 1 - .../info/nightscout/androidaps/MainApp.java | 2 ++ .../broadcasts/BroadcastSgvs.java | 28 ++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 25a88a5939..d667029085 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,6 @@ android:exported="true"> - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index dec4f1c932..e471252635 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -172,6 +172,8 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_CHANGED_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_SGV)); + } private void startKeepAliveService() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java index 29e2031869..f114e57d96 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONObject; @@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -23,15 +25,23 @@ public class BroadcastSgvs { public static void handleNewSgv(JSONObject sgv, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("sgv", sgv.toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_NEW_SGV); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("sgv", sgv.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_SGV); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } public static void handleNewSgv(JSONArray sgvs, Context context, boolean isDelta) { @@ -41,7 +51,17 @@ public class BroadcastSgvs { Intent intent = new Intent(Intents.ACTION_NEW_SGV); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("sgvs", sgvs.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_SGV); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From 759154e578420046aa6973a4168aa157f75bae7f Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 01:58:23 +0200 Subject: [PATCH 04/13] nsclient profile local --- app/src/main/AndroidManifest.xml | 1 - .../java/info/nightscout/androidaps/MainApp.java | 2 ++ .../broadcasts/BroadcastProfile.java | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d667029085..be292d21c4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,6 @@ android:exported="true"> - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index e471252635..8f68a70a11 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -173,6 +173,8 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_CHANGED_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_SGV)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_PROFILE)); + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java index ec62ccbf6f..e910c54205 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java @@ -4,12 +4,14 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.utils.SP; @@ -23,15 +25,23 @@ public class BroadcastProfile { public static void handleNewTreatment(ProfileStore profile, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("profile", profile.getData().toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_NEW_PROFILE); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("profile", profile.getData().toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_PROFILE); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From 82b99e1708eb32ac4dc4ca47b5f2a8050e20af67 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:00:46 +0200 Subject: [PATCH 05/13] nsclient status local --- app/src/main/AndroidManifest.xml | 1 - .../info/nightscout/androidaps/MainApp.java | 2 ++ .../broadcasts/BroadcastStatus.java | 23 ++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index be292d21c4..fa3e1501e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,6 @@ android:exported="true"> - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 8f68a70a11..7e7d0ea030 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -174,6 +174,8 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_SGV)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_PROFILE)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_STATUS)); + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java index 026658afc0..965b24073f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,8 +26,6 @@ public class BroadcastStatus { public static void handleNewStatus(NSSettingsStatus status, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); try { bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName); @@ -41,6 +40,24 @@ public class BroadcastStatus { Intent intent = new Intent(Intents.ACTION_NEW_STATUS); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + try { + bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName); + bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName); + bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode); + bundle.putString("status", status.getData().toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_STATUS); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From fe57d4a61da9df2ff4c45949b91cf2a9cbc8a46a Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:02:54 +0200 Subject: [PATCH 06/13] nsclient mbg local --- app/src/main/AndroidManifest.xml | 1 - .../java/info/nightscout/androidaps/MainApp.java | 2 ++ .../broadcasts/BroadcastMbgs.java | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fa3e1501e1..df95cda596 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,6 @@ android:exported="true"> - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 7e7d0ea030..c0d517673f 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -175,6 +175,8 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_SGV)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_PROFILE)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_STATUS)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_MBG)); + diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java index f45ade6b32..f857166f7d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -22,14 +24,22 @@ public class BroadcastMbgs { public static void handleNewMbg(JSONArray mbgs, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("mbgs", mbgs.toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_NEW_MBG); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("mbgs", mbgs.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_MBG); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From 194a8173327a26ff1264a29d06eda9926a2f813f Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:06:05 +0200 Subject: [PATCH 07/13] nsclient devicestatus local --- app/src/main/AndroidManifest.xml | 1 - .../info/nightscout/androidaps/MainApp.java | 5 +-- .../broadcasts/BroadcastDeviceStatus.java | 33 +++++++++++++++---- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index df95cda596..04dc024524 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,6 @@ android:exported="true"> - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index c0d517673f..28505a84d6 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -176,10 +176,7 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_PROFILE)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_STATUS)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_MBG)); - - - - + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS)); } private void startKeepAliveService() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java index 9053c6becb..c0b92f8683 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONObject; @@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -26,14 +28,20 @@ public class BroadcastDeviceStatus { Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("devicestatus", status.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } public static void handleNewDeviceStatus(JSONArray statuses, Context context, boolean isDelta) { - - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - - List splitted = BroadcastTreatment.splitArray(statuses); for (JSONArray part: splitted) { Bundle bundle = new Bundle(); @@ -42,7 +50,20 @@ public class BroadcastDeviceStatus { Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + } + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + splitted = BroadcastTreatment.splitArray(statuses); + for (JSONArray part : splitted) { + Bundle bundle = new Bundle(); + bundle.putString("devicestatuses", part.toString()); + bundle.putBoolean("delta", isDelta); + Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } } From a4864c3d069362e6e24a4b57f766ed98c2207b19 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:09:26 +0200 Subject: [PATCH 08/13] nsclient cal local --- app/src/main/AndroidManifest.xml | 2 -- .../java/info/nightscout/androidaps/MainApp.java | 2 ++ .../broadcasts/BroadcastCals.java | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 04dc024524..46327d28de 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -56,8 +56,6 @@ android:enabled="true" android:exported="true"> - - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 28505a84d6..9e47a2f494 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -177,6 +177,8 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_STATUS)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_MBG)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS)); + lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL)); + } private void startKeepAliveService() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java index 7a7772357c..340aa17199 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -22,14 +24,22 @@ public class BroadcastCals { public static void handleNewCal(JSONArray cals, Context context, boolean isDelta) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("cals", cals.toString()); bundle.putBoolean("delta", isDelta); Intent intent = new Intent(Intents.ACTION_NEW_CAL); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("cals", cals.toString()); + bundle.putBoolean("delta", isDelta); + intent = new Intent(Intents.ACTION_NEW_CAL); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From d60321b4d144a3df210ca29a8c22279c3c93ac8e Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:27:16 +0200 Subject: [PATCH 09/13] nsclient alarms local --- app/src/main/AndroidManifest.xml | 14 -------------- .../java/info/nightscout/androidaps/MainApp.java | 12 ++++++++++++ .../broadcasts/BroadcastAlarm.java | 16 ++++++++++++---- .../broadcasts/BroadcastAnnouncement.java | 16 ++++++++++++---- .../broadcasts/BroadcastClearAlarm.java | 16 ++++++++++++---- .../broadcasts/BroadcastUrgentAlarm.java | 16 ++++++++++++---- 6 files changed, 60 insertions(+), 30 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 46327d28de..125d4107ed 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -66,20 +66,6 @@ - - - - - - - - - - - diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 9e47a2f494..001cb41222 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -64,6 +64,7 @@ import info.nightscout.androidaps.plugins.Wear.WearFragment; import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin; import info.nightscout.androidaps.receivers.DataReceiver; import info.nightscout.androidaps.receivers.KeepAliveReceiver; +import info.nightscout.androidaps.receivers.NSAlarmReceiver; import info.nightscout.utils.NSUpload; import io.fabric.sdk.android.Fabric; @@ -82,6 +83,8 @@ public class MainApp extends Application { private static ArrayList pluginsList = null; private static DataReceiver dataReceiver = new DataReceiver(); + private static NSAlarmReceiver alarmReciever = new NSAlarmReceiver(); + private LocalBroadcastManager lbm; @Override @@ -179,6 +182,15 @@ public class MainApp extends Application { lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS)); lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL)); + //register alarms + lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM)); + lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT)); + lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM)); + lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM)); + + + //register ack alarm + } private void startKeepAliveService() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java index 03fe04f8fe..685bf1d7cb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONObject; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -21,14 +23,20 @@ public class BroadcastAlarm { private static Logger log = LoggerFactory.getLogger(BroadcastAlarm.class); public static void handleAlarm(JSONObject alarm, Context context) { - - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("data", alarm.toString()); Intent intent = new Intent(Intents.ACTION_ALARM); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("data", alarm.toString()); + intent = new Intent(Intents.ACTION_ALARM); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java index 3f9a43a14a..834b47eb1e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONObject; @@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -22,14 +24,20 @@ public class BroadcastAnnouncement { private static Logger log = LoggerFactory.getLogger(BroadcastAnnouncement.class); public static void handleAnnouncement(JSONObject announcement, Context context) { - - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("data", announcement.toString()); Intent intent = new Intent(Intents.ACTION_ANNOUNCEMENT); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("data", announcement.toString()); + intent = new Intent(Intents.ACTION_ANNOUNCEMENT); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java index 4f2716cf85..bc1b9978e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONObject; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -21,14 +23,20 @@ public class BroadcastClearAlarm { private static Logger log = LoggerFactory.getLogger(BroadcastClearAlarm.class); public static void handleClearAlarm(JSONObject clearalarm, Context context) { - - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("data", clearalarm.toString()); Intent intent = new Intent(Intents.ACTION_CLEAR_ALARM); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("data", clearalarm.toString()); + intent = new Intent(Intents.ACTION_CLEAR_ALARM); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java index 442eb729c0..449fdd1398 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; import org.json.JSONObject; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; +import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -21,14 +23,20 @@ public class BroadcastUrgentAlarm { private static Logger log = LoggerFactory.getLogger(BroadcastUrgentAlarm.class); public static void handleUrgentAlarm(JSONObject urgentalarm, Context context) { - - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; - Bundle bundle = new Bundle(); bundle.putString("data", urgentalarm.toString()); Intent intent = new Intent(Intents.ACTION_URGENT_ALARM); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); + LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); + + if(SP.getBoolean("nsclient_localbroadcasts", true)) { + bundle = new Bundle(); + bundle.putString("data", urgentalarm.toString()); + intent = new Intent(Intents.ACTION_URGENT_ALARM); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + } } } From 3500e92a4152d2db6390cba35e441d090cd72c7c Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 24 Jul 2017 02:33:29 +0200 Subject: [PATCH 10/13] nsclient ackAlarm local --- app/src/main/AndroidManifest.xml | 8 -------- .../info/nightscout/androidaps/MainApp.java | 6 +++--- .../broadcasts/BroadcastAckAlarm.java | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 125d4107ed..7d792556b7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -96,14 +96,6 @@ - - - - - Date: Tue, 25 Jul 2017 19:18:51 +0200 Subject: [PATCH 11/13] check for existing value --- .../java/info/nightscout/androidaps/Services/DataService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java index 40cbbf3c52..3b04c30d94 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -506,7 +506,7 @@ public class DataService extends IntentService { MainApp.getDbHelper().createCareportalEventFromJsonIfNotExists(trJson); } - if (trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) { + if (trJson.has("eventType") && trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) { long date = trJson.getLong("mills"); long now = System.currentTimeMillis(); if (date > now - 15 * 60 * 1000L && trJson.has("notes")) { From f1e21053b546a4ac512e791575657db34f511eae Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 25 Jul 2017 19:24:51 +0200 Subject: [PATCH 12/13] use key instead of string --- .../broadcasts/BroadcastAckAlarm.java | 3 ++- .../NSClientInternal/broadcasts/BroadcastAlarm.java | 3 ++- .../broadcasts/BroadcastAnnouncement.java | 3 ++- .../NSClientInternal/broadcasts/BroadcastCals.java | 3 ++- .../broadcasts/BroadcastClearAlarm.java | 3 ++- .../broadcasts/BroadcastDeviceStatus.java | 5 +++-- .../NSClientInternal/broadcasts/BroadcastMbgs.java | 3 ++- .../broadcasts/BroadcastProfile.java | 3 ++- .../broadcasts/BroadcastQueueStatus.java | 3 ++- .../NSClientInternal/broadcasts/BroadcastSgvs.java | 5 +++-- .../broadcasts/BroadcastStatus.java | 3 ++- .../broadcasts/BroadcastTreatment.java | 13 +++++++------ .../broadcasts/BroadcastUrgentAlarm.java | 3 ++- app/src/main/res/values/strings.xml | 1 + 14 files changed, 34 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAckAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAckAlarm.java index a7e3f27adb..216fa3d19a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAckAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAckAlarm.java @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSAlarm; import info.nightscout.utils.SP; @@ -34,7 +35,7 @@ public class BroadcastAckAlarm { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putInt("level", originalAlarm.getLevel()); bundle.putString("group", originalAlarm.getGroup()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java index 685bf1d7cb..0fee6600bd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAlarm.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -30,7 +31,7 @@ public class BroadcastAlarm { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("data", alarm.toString()); intent = new Intent(Intents.ACTION_ALARM); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java index 834b47eb1e..9b133c2551 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastAnnouncement.java @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -31,7 +32,7 @@ public class BroadcastAnnouncement { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("data", announcement.toString()); intent = new Intent(Intents.ACTION_ANNOUNCEMENT); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java index 340aa17199..7580a00088 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastCals.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -32,7 +33,7 @@ public class BroadcastCals { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("cals", cals.toString()); bundle.putBoolean("delta", isDelta); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java index bc1b9978e6..23406837a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastClearAlarm.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -30,7 +31,7 @@ public class BroadcastClearAlarm { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("data", clearalarm.toString()); intent = new Intent(Intents.ACTION_CLEAR_ALARM); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java index c0b92f8683..a912fc5d3c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -30,7 +31,7 @@ public class BroadcastDeviceStatus { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("devicestatus", status.toString()); bundle.putBoolean("delta", isDelta); @@ -53,7 +54,7 @@ public class BroadcastDeviceStatus { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); } - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { splitted = BroadcastTreatment.splitArray(statuses); for (JSONArray part : splitted) { Bundle bundle = new Bundle(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java index f857166f7d..a715747791 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastMbgs.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -32,7 +33,7 @@ public class BroadcastMbgs { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("mbgs", mbgs.toString()); bundle.putBoolean("delta", isDelta); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java index e910c54205..3802b09657 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastProfile.java @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.utils.SP; @@ -33,7 +34,7 @@ public class BroadcastProfile { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("profile", profile.getData().toString()); bundle.putBoolean("delta", isDelta); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastQueueStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastQueueStatus.java index eedeb4574d..abc49be18a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastQueueStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastQueueStatus.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.os.Bundle; import android.os.PowerManager; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -14,7 +15,7 @@ import info.nightscout.utils.SP; public class BroadcastQueueStatus { public static void handleNewStatus(int size, Context context) { - if(!SP.getBoolean("nsclient_localbroadcasts", true)) return; + if(!SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) return; PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java index f114e57d96..d4193f3cb7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastSgvs.java @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -33,7 +34,7 @@ public class BroadcastSgvs { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("sgv", sgv.toString()); bundle.putBoolean("delta", isDelta); @@ -53,7 +54,7 @@ public class BroadcastSgvs { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("sgvs", sgvs.toString()); bundle.putBoolean("delta", isDelta); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java index 965b24073f..7c6862cb14 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastStatus.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus; import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService; @@ -42,7 +43,7 @@ public class BroadcastStatus { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); try { bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java index b6711b75e0..0d998a2bcd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment; import info.nightscout.utils.SP; @@ -38,7 +39,7 @@ public class BroadcastTreatment { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("treatment", treatment.getData().toString()); bundle.putBoolean("delta", isDelta); @@ -62,7 +63,7 @@ public class BroadcastTreatment { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); } - if(SP.getBoolean("nsclient_localbroadcasts", true)){ + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)){ splitted = splitArray(treatments); for (JSONArray part: splitted) { Bundle bundle = new Bundle(); @@ -87,7 +88,7 @@ public class BroadcastTreatment { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("treatment", treatment.toString()); bundle.putBoolean("delta", isDelta); @@ -111,7 +112,7 @@ public class BroadcastTreatment { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); } - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { splitted = splitArray(treatments); for (JSONArray part : splitted) { Bundle bundle = new Bundle(); @@ -136,7 +137,7 @@ public class BroadcastTreatment { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("treatment", treatment.toString()); bundle.putBoolean("delta", isDelta); @@ -158,7 +159,7 @@ public class BroadcastTreatment { LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("treatments", treatments.toString()); bundle.putBoolean("delta", isDelta); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java index 449fdd1398..c332be03af 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastUrgentAlarm.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.utils.SP; @@ -30,7 +31,7 @@ public class BroadcastUrgentAlarm { intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent); - if(SP.getBoolean("nsclient_localbroadcasts", true)) { + if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) { bundle = new Bundle(); bundle.putString("data", urgentalarm.toString()); intent = new Intent(Intents.ACTION_URGENT_ALARM); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 97eb1dea80..a022df6ecc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -649,6 +649,7 @@ Interval for autosens [h] Amount of hours in the past for sensitivity detection (carbs absorption time is excluded) openapsama_autosens_period + nsclient_localbroadcasts RAT do_not_track_profile_switch Ignore profile switch events From 0914e67c11f3950ff1dc44ce00deb215e12f610d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 25 Jul 2017 19:25:58 +0200 Subject: [PATCH 13/13] typo --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a022df6ecc..8fe3621541 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -687,7 +687,7 @@ Values not stored! Overview Notifications Pass the Overview Notifications through as wear confirmation messages. - Enable loacal broadcasts to other apps (like xDrip). + Enable broadcasts to other apps (like xDrip). Enable local Broadcasts. ACTIVITY & FEEDBACK CARBS & BOLUS