nsclient preferences cleanup

This commit is contained in:
Milos Kozak 2018-04-21 20:46:55 +02:00
parent 3d7cdd3819
commit ea59458383
2 changed files with 45 additions and 44 deletions

View file

@ -67,7 +67,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
MainApp.bus().post(new EventRefreshGui());
}
if (key.equals(MainApp.gs(R.string.key_openapsama_useautosens)) && SP.getBoolean(R.string.key_openapsama_useautosens, false)) {
OKDialog.show(this, MainApp.sResources.getString(R.string.configbuilder_sensitivity), MainApp.sResources.getString(R.string.sensitivity_warning), null);
OKDialog.show(this, MainApp.gs(R.string.configbuilder_sensitivity), MainApp.gs(R.string.sensitivity_warning), null);
}
updatePrefSummary(myPreferenceFragment.getPreference(key));
}
@ -81,13 +81,13 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
EditTextPreference editTextPref = (EditTextPreference) pref;
if (pref.getKey().contains("password") || pref.getKey().contains("secret")) {
pref.setSummary("******");
} else if (pref.getKey().equals(MainApp.sResources.getString(R.string.key_danars_name))) {
} else if (pref.getKey().equals(MainApp.gs(R.string.key_danars_name))) {
pref.setSummary(SP.getString(R.string.key_danars_name, ""));
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
pref.setSummary(editTextPref.getText());
} else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) {
pref.setSummary(MainApp.sResources.getString(R.string.smscommunicator_allowednumbers_summary));
pref.setSummary(MainApp.gs(R.string.smscommunicator_allowednumbers_summary));
}
}
}
@ -127,7 +127,6 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
if (id != -1) {
addPreferencesFromResource(id);
addPreferencesFromResource(R.xml.pref_advanced);
} else {
addPreferencesFromResource(R.xml.pref_overview);

View file

@ -2,7 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="ns_api"
android:title="@string/nsclientinternal_title">
<com.andreabaccega.widget.ValidatingEditTextPreference
@ -22,86 +21,89 @@
android:key="@string/key_nsclientinternal_api_secret"
android:title="@string/nsclientinternal_secret_title" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_autobackfill"
android:title="@string/ns_autobackfill" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_logappstartedevent"
android:title="@string/ns_logappstartedevent" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_create_announcements_from_errors"
android:title="@string/ns_create_announcements_from_errors_title"
android:summary="@string/ns_create_announcements_from_errors_summary"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_localbroadcasts"
android:title="@string/ns_localbroadcasts_title"
android:summary="@string/ns_localbroadcasts"/>
<PreferenceScreen android:title="@string/ns_alarmoptions">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_urgent_high"
android:title="@string/nsalarm_urgenthigh"/>
android:title="@string/nsalarm_urgenthigh" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_high"
android:title="@string/nsalarm_high"/>
android:title="@string/nsalarm_high" />
<SwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_low"
android:title="@string/nsalarm_low"/>
android:title="@string/nsalarm_low" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_urgent_low"
android:title="@string/nsalarm_urgentlow"/>
android:title="@string/nsalarm_urgentlow" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_staledata"
android:title="@string/nsalarm_staledata"/>
android:title="@string/nsalarm_staledata" />
<com.andreabaccega.widget.ValidatingEditTextPreference
validate:testType="numericRange"
validate:minNumber="15"
validate:maxNumber="120"
android:digits="0123456789"
android:defaultValue="16"
android:digits="0123456789"
android:inputType="number"
android:key="@string/key_nsalarm_staledatavalue"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="number"
android:maxLines="20"
android:title="@string/nsalarm_staledatavalue_label"
android:key="@string/key_nsalarm_staledatavalue" />
validate:maxNumber="120"
validate:minNumber="15"
validate:testType="numericRange" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_nsalarm_urgent_staledata"
android:title="@string/nsalarm_urgentstaledata"/>
android:title="@string/nsalarm_urgentstaledata" />
<com.andreabaccega.widget.ValidatingEditTextPreference
validate:testType="numericRange"
validate:minNumber="30"
validate:maxNumber="180"
android:digits="0123456789"
android:defaultValue="31"
android:digits="0123456789"
android:inputType="number"
android:key="@string/key_nsalarm_urgent_staledatavalue"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:inputType="number"
android:maxLines="20"
android:title="@string/nsalarm_urgent_staledatavalue_label"
android:key="@string/key_nsalarm_urgent_staledatavalue" />
validate:maxNumber="180"
validate:minNumber="30"
validate:testType="numericRange" />
</PreferenceScreen>
<PreferenceScreen android:title="@string/advancedsettings_title">
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_autobackfill"
android:title="@string/ns_autobackfill" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_create_announcements_from_errors"
android:summary="@string/ns_create_announcements_from_errors_summary"
android:title="@string/ns_create_announcements_from_errors_title" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_ns_localbroadcasts"
android:summary="@string/ns_localbroadcasts"
android:title="@string/ns_localbroadcasts_title" />
</PreferenceScreen>