use key instead of string
This commit is contained in:
parent
d6cb8ef6bc
commit
f1e21053b5
14 changed files with 34 additions and 20 deletions
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -649,6 +649,7 @@
|
|||
<string name="openapsama_autosens_period">Interval for autosens [h]</string>
|
||||
<string name="openapsama_autosens_period_summary">Amount of hours in the past for sensitivity detection (carbs absorption time is excluded)</string>
|
||||
<string name="key_openapsama_autosens_period" translatable="false">openapsama_autosens_period</string>
|
||||
<string name="key_nsclient_localbroadcasts" translatable="false">nsclient_localbroadcasts</string>
|
||||
<string name="ratio_short">RAT</string>
|
||||
<string name="key_do_not_track_profile_switch">do_not_track_profile_switch</string>
|
||||
<string name="do_not_track_profile_switch">Ignore profile switch events</string>
|
||||
|
|
Loading…
Reference in a new issue