From 3216ff636a6c9444292cb0b505540ee04cad1179 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 17 Feb 2017 13:43:17 +0100 Subject: [PATCH] preference keys to strings --- .../NSClientInternal/services/NSClientService.java | 9 +++++---- app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/pref_nsclientinternal.xml | 14 +++----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java index 9aadc0d1dc..3c5e8aac82 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java @@ -29,6 +29,7 @@ import java.util.Map; import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService; @@ -252,10 +253,10 @@ public class NSClientService extends Service { public void readPreferences() { SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); nsEnabled = MainApp.getSpecificPlugin(NSClientInternalPlugin.class).isEnabled(PluginBase.GENERAL); - nsURL = SP.getString("nsclientinternal_url", ""); - nsAPISecret = SP.getString("nsclientinternal_api_secret", ""); - nsHours = SafeParse.stringToInt(SP.getString("nsclientinternal_hours", "3")); - nsDevice = SP.getString("nsclientinternal_devicename", ""); + nsURL = SP.getString(MainApp.sResources.getString(R.string.key_nsclientinternal_url), ""); + nsAPISecret = SP.getString(MainApp.sResources.getString(R.string.key_nsclientinternal_api_secret), ""); + nsHours = SafeParse.stringToInt(SP.getString(MainApp.sResources.getString(R.string.key_nsclientinternal_hours), "3")); + nsDevice = SP.getString("careportal_enteredby", ""); } private Emitter.Listener onPing = new Emitter.Listener() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d24240f5d..4038b83300 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -529,4 +529,7 @@ Queue: Status: Paused + nsclientinternal_url + nsclientinternal_api_secret + nsclientinternal_hours diff --git a/app/src/main/res/xml/pref_nsclientinternal.xml b/app/src/main/res/xml/pref_nsclientinternal.xml index e52bfa7516..5f7efd868d 100644 --- a/app/src/main/res/xml/pref_nsclientinternal.xml +++ b/app/src/main/res/xml/pref_nsclientinternal.xml @@ -12,23 +12,15 @@ android:inputType="textUri" android:title="@string/nsclientinternal_url_title" android:dialogMessage="@string/nsclientinternal_url_dialogmessage" - android:key="nsclientinternal_url" /> + android:key="@string/key_nsclientinternal_url" /> - - + android:key="@string/key_nsclientinternal_hours" /> \ No newline at end of file