Improve NSClient preferences in NSC mode
This commit is contained in:
parent
ab41ffa83e
commit
6c19edbf1c
|
@ -10,6 +10,7 @@ import android.os.IBinder;
|
|||
import android.text.Spanned;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -190,7 +191,21 @@ public class NSClientPlugin extends PluginBase {
|
|||
super.preprocessPreferences(preferenceFragment);
|
||||
|
||||
if (config.getNSCLIENT()) {
|
||||
preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_overview_advanced));
|
||||
SwitchPreference key_ns_uploadlocalprofile = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_uploadlocalprofile));
|
||||
if (key_ns_uploadlocalprofile != null) key_ns_uploadlocalprofile.setVisible(false);
|
||||
SwitchPreference key_ns_autobackfill = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_autobackfill));
|
||||
if (key_ns_autobackfill != null) key_ns_autobackfill.setVisible(false);
|
||||
SwitchPreference key_ns_create_announcements_from_errors = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_create_announcements_from_errors));
|
||||
if (key_ns_create_announcements_from_errors != null) key_ns_create_announcements_from_errors.setVisible(false);
|
||||
SwitchPreference key_ns_create_announcements_from_carbs_req = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_create_announcements_from_carbs_req));
|
||||
if (key_ns_create_announcements_from_carbs_req != null) key_ns_create_announcements_from_carbs_req.setVisible(false);
|
||||
SwitchPreference key_ns_upload_only = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_upload_only));
|
||||
if (key_ns_upload_only != null) {
|
||||
key_ns_upload_only.setVisible(false);
|
||||
key_ns_upload_only.setEnabled(false);
|
||||
}
|
||||
SwitchPreference key_ns_sync_use_absolute = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_sync_use_absolute));
|
||||
if (key_ns_sync_use_absolute != null) key_ns_sync_use_absolute.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="ns_sync_use_absolute"
|
||||
android:key="@string/key_ns_sync_use_absolute"
|
||||
android:title="@string/ns_sync_use_absolute_title" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
|
|
@ -106,7 +106,7 @@ public class NSUpload {
|
|||
|
||||
public void uploadTempBasalStartPercent(TemporaryBasal temporaryBasal, Profile profile) {
|
||||
try {
|
||||
boolean useAbsolute = sp.getBoolean("ns_sync_use_absolute", false);
|
||||
boolean useAbsolute = sp.getBoolean(R.string.key_ns_sync_use_absolute, false);
|
||||
double absoluteRate = 0;
|
||||
if (profile != null) {
|
||||
absoluteRate = profile.getBasal(temporaryBasal.date) * temporaryBasal.percentRate / 100d;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<string name="key_pump_unreachable_threshold_minutes" translatable="false">pump_unreachable_threshold</string>
|
||||
<string name="key_missed_bg_readings_threshold_minutes" translatable="false">missed_bg_readings_threshold</string>
|
||||
<string name="key_gradually_increase_notification_volume" translatable="false">gradually_increase_notification_volume</string>
|
||||
<string name="key_ns_sync_use_absolute" translatable="false">ns_sync_use_absolute</string>
|
||||
|
||||
<!-- General-->
|
||||
<string name="error">Error</string>
|
||||
|
|
Loading…
Reference in a new issue