commit
044547b594
7 changed files with 49 additions and 13 deletions
|
@ -53,7 +53,7 @@ public class Constants {
|
||||||
// Very Hard Limits Ranges
|
// Very Hard Limits Ranges
|
||||||
// First value is the Lowest and second value is the Highest a Limit can define
|
// First value is the Lowest and second value is the Highest a Limit can define
|
||||||
public static final int[] VERY_HARD_LIMIT_MIN_BG = {72,180};
|
public static final int[] VERY_HARD_LIMIT_MIN_BG = {72,180};
|
||||||
public static final int[] VERY_HARD_LIMIT_MAX_BG = {99,270};
|
public static final int[] VERY_HARD_LIMIT_MAX_BG = {90,270};
|
||||||
public static final int[] VERY_HARD_LIMIT_TARGET_BG = {80,200};
|
public static final int[] VERY_HARD_LIMIT_TARGET_BG = {80,200};
|
||||||
|
|
||||||
// Very Hard Limits Ranges for Temp Targets
|
// Very Hard Limits Ranges for Temp Targets
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
if (Config.SMSCOMMUNICATORENABLED)
|
if (Config.SMSCOMMUNICATORENABLED)
|
||||||
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
||||||
addPreferencesFromResource(R.xml.pref_others);
|
addPreferencesFromResource(R.xml.pref_others);
|
||||||
|
addPreferencesFromResource(R.xml.pref_advanced);
|
||||||
initSummary(getPreferenceScreen());
|
initSummary(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.data;
|
package info.nightscout.androidaps.data;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -25,6 +27,7 @@ public class GlucoseStatus {
|
||||||
public double short_avgdelta = 0d;
|
public double short_avgdelta = 0d;
|
||||||
public double long_avgdelta = 0d;
|
public double long_avgdelta = 0d;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MainApp.sResources.getString(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" +
|
return MainApp.sResources.getString(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" +
|
||||||
|
@ -54,6 +57,8 @@ public class GlucoseStatus {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static GlucoseStatus getGlucoseStatusData() {
|
public static GlucoseStatus getGlucoseStatusData() {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainApp.instance());
|
||||||
|
|
||||||
// load 45min
|
// load 45min
|
||||||
long fromtime = (long) (new Date().getTime() - 60 * 1000L * 45);
|
long fromtime = (long) (new Date().getTime() - 60 * 1000L * 45);
|
||||||
List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
|
List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
|
||||||
|
@ -104,8 +109,15 @@ public class GlucoseStatus {
|
||||||
|
|
||||||
GlucoseStatus status = new GlucoseStatus();
|
GlucoseStatus status = new GlucoseStatus();
|
||||||
status.glucose = now.value;
|
status.glucose = now.value;
|
||||||
status.delta = average(last_deltas);
|
|
||||||
status.short_avgdelta = average(short_deltas);
|
status.short_avgdelta = average(short_deltas);
|
||||||
|
|
||||||
|
if(prefs.getBoolean("always_use_shortavg",false) || last_deltas.isEmpty()){
|
||||||
|
status.delta = status.short_avgdelta;
|
||||||
|
} else {
|
||||||
|
status.delta = average(last_deltas);
|
||||||
|
}
|
||||||
|
|
||||||
status.long_avgdelta = average(long_deltas);
|
status.long_avgdelta = average(long_deltas);
|
||||||
status.avgdelta = status.short_avgdelta; // for OpenAPS MA
|
status.avgdelta = status.short_avgdelta; // for OpenAPS MA
|
||||||
|
|
||||||
|
|
|
@ -448,4 +448,8 @@
|
||||||
<string name="wear_shortname">WEAR</string>
|
<string name="wear_shortname">WEAR</string>
|
||||||
<string name="smscommunicator_shortname">SMS</string>
|
<string name="smscommunicator_shortname">SMS</string>
|
||||||
<string name="short_tabtitles">Shorten tab titles</string>
|
<string name="short_tabtitles">Shorten tab titles</string>
|
||||||
|
<string name="prefs_delta_title">Delta Settings</string>
|
||||||
|
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
|
||||||
|
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
|
||||||
|
<string name="advancedsettings_title">Advanced Settings</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
30
app/src/main/res/xml/pref_advanced.xml
Normal file
30
app/src/main/res/xml/pref_advanced.xml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="advanced"
|
||||||
|
android:title="@string/advancedsettings_title">
|
||||||
|
<PreferenceScreen
|
||||||
|
android:title="@string/advancedsettings_title">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/nightscout">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="ns_upload_only"
|
||||||
|
android:title="@string/ns_upload_only"
|
||||||
|
android:summary="@string/ns_upload_only_summary"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="ns_sync_use_absolute"
|
||||||
|
android:title="@string/ns_sync_use_absolute_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/openapsma">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="always_use_shortavg"
|
||||||
|
android:title="@string/always_use_shortavg"
|
||||||
|
android:summary="@string/always_use_shortavg_summary"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
|
@ -8,16 +8,6 @@
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="syncprofiletopump"
|
android:key="syncprofiletopump"
|
||||||
android:title="@string/syncprofiletopump_title" />
|
android:title="@string/syncprofiletopump_title" />
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="ns_upload_only"
|
|
||||||
android:title="@string/ns_upload_only"
|
|
||||||
android:summary="@string/ns_upload_only_summary"/>
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="ns_sync_use_absolute"
|
|
||||||
android:title="@string/ns_sync_use_absolute_title" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -31,5 +31,4 @@
|
||||||
android:numeric="decimal"
|
android:numeric="decimal"
|
||||||
android:title="@string/openapsma_maxiob_summary" />
|
android:title="@string/openapsma_maxiob_summary" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in a new issue