preference keys to strings

This commit is contained in:
Milos Kozak 2017-02-17 13:43:17 +01:00
parent 71112a90e2
commit 3216ff636a
3 changed files with 11 additions and 15 deletions

View file

@ -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() {

View file

@ -529,4 +529,7 @@
<string name="queue">Queue:</string>
<string name="status">Status:</string>
<string name="paused">Paused</string>
<string name="key_nsclientinternal_url" translatable="false">nsclientinternal_url</string>
<string name="key_nsclientinternal_api_secret" translatable="false">nsclientinternal_api_secret</string>
<string name="key_nsclientinternal_hours" translatable="false">nsclientinternal_hours</string>
</resources>

View file

@ -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" />
<EditTextPreference
android:title="@string/nsclientinternal_secret_title"
android:key="nsclientinternal_api_secret"
android:key="@string/key_nsclientinternal_api_secret"
android:dialogTitle="@string/nsclientinternal_secret_dialogtitle"
android:dialogMessage="@string/nsclientinternal_secret_dialogmessage"
android:defaultValue=""
android:inputType="textPassword">
</EditTextPreference>
<EditTextPreference
android:title="@string/nsclientinternal_devicename_title"
android:key="nsclientinternal_devicename"
android:dialogTitle="@string/nsclientinternal_devicename_dialogtitle"
android:dialogMessage="@string/nsclientinternal_devicename_dialogmessage"
android:defaultValue=""
android:inputType="text">
</EditTextPreference>
<com.andreabaccega.widget.ValidatingEditTextPreference
validate:testType="numericRange"
validate:minNumber="1"
@ -40,7 +32,7 @@
android:maxLines="20"
android:title="@string/nsclientinternal_hours"
android:dialogMessage="@string/nsclientinternal_hours_message"
android:key="nsclientinternal_hours" />
android:key="@string/key_nsclientinternal_hours" />
</PreferenceCategory>
</PreferenceScreen>