Merge branch 'dev' into insihgtfix

This commit is contained in:
Milos Kozak 2018-09-12 08:56:58 +02:00
commit 2fc9b40f9d
11 changed files with 64 additions and 64 deletions

View file

@ -89,7 +89,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
pref.setSummary("******"); pref.setSummary("******");
} else if (pref.getKey().equals(MainApp.gs(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, "")); pref.setSummary(SP.getString(R.string.key_danars_name, ""));
} else if (editTextPref.getText() != null ) { } else if (editTextPref.getText() != null) {
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage()); ((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
pref.setSummary(editTextPref.getText()); pref.setSummary(editTextPref.getText());
} else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) { } else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) {
@ -183,9 +183,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL);
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL);
if (!Config.NSCLIENT) {
addPreferencesFromResource(R.xml.pref_others); addPreferencesFromResource(R.xml.pref_others);
}
addPreferencesFromResource(R.xml.pref_datachoices); addPreferencesFromResource(R.xml.pref_datachoices);
addPreferencesFromResourceIfEnabled(WearPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(WearPlugin.getPlugin(), PluginType.GENERAL);

View file

@ -129,7 +129,7 @@ public class APSResult {
"<b>" + MainApp.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>"; "<b>" + MainApp.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>";
else else
ret = "<b>" + MainApp.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " + ret = "<b>" + MainApp.gs(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" + "(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100d) + "%) <br>" +
"<b>" + MainApp.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>"; "<b>" + MainApp.gs(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>";
// smb // smb
@ -334,22 +334,23 @@ public class APSResult {
} }
} }
// report change bigger than 30% // report change bigger than 30%
if (activeTemp != null) { double percentMinChangeChange = SP.getDouble(R.string.key_loop_openmode_min_change, 30d);
double percentToBeSmallChange = 30; percentMinChangeChange /= 100d;
percentToBeSmallChange /= 100; double lowThreshold = 1 - percentMinChangeChange;
double change = percent / (double) activeTemp.tempBasalConvertedToPercent(now, profile); double highThreshold = 1 + percentMinChangeChange;
double lowThreshold = 1 - percentToBeSmallChange; double change = percent / 100d;
double highThreshold = 1 + percentToBeSmallChange; if (activeTemp != null)
change = percent / (double) activeTemp.tempBasalConvertedToPercent(now, profile);
if (change < lowThreshold || change > highThreshold) { if (change < lowThreshold || change > highThreshold) {
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.debug("TRUE: Outside allowed range " + (change * 100) + "%"); log.debug("TRUE: Outside allowed range " + (change * 100d) + "%");
return true; return true;
} } else {
}
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.debug("FALSE"); log.debug("TRUE: Inside allowed range " + (change * 100d) + "%");
return false; return false;
}
} else { } else {
if (activeTemp == null && rate == pump.getBaseBasalRate()) { if (activeTemp == null && rate == pump.getBaseBasalRate()) {
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
@ -377,22 +378,23 @@ public class APSResult {
} }
} }
// report change bigger than 30% // report change bigger than 30%
if (activeTemp != null) {
double percentMinChangeChange = SP.getDouble(R.string.key_loop_openmode_min_change, 30d); double percentMinChangeChange = SP.getDouble(R.string.key_loop_openmode_min_change, 30d);
percentMinChangeChange /= 100; percentMinChangeChange /= 100d;
double change = rate / activeTemp.tempBasalConvertedToAbsolute(now, profile);
double lowThreshold = 1 - percentMinChangeChange; double lowThreshold = 1 - percentMinChangeChange;
double highThreshold = 1 + percentMinChangeChange; double highThreshold = 1 + percentMinChangeChange;
double change = rate / profile.getBasal();
if (activeTemp != null)
change = rate / activeTemp.tempBasalConvertedToAbsolute(now, profile);
if (change < lowThreshold || change > highThreshold) { if (change < lowThreshold || change > highThreshold) {
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.debug("TRUE: Outside allowed range " + (change * 100) + "%"); log.debug("TRUE: Outside allowed range " + (change * 100d) + "%");
return true; return true;
} } else {
}
if (L.isEnabled(L.APS)) if (L.isEnabled(L.APS))
log.debug("FALSE"); log.debug("TRUE: Inside allowed range " + (change * 100d) + "%");
return false; return false;
} }
} }
}
} }

View file

@ -210,6 +210,9 @@ public class MaintenancePlugin extends PluginBase {
public static Intent sendMail(Uri attachementUri, String recipient, String subject) { public static Intent sendMail(Uri attachementUri, String recipient, String subject) {
StringBuilder builder =new StringBuilder(); StringBuilder builder =new StringBuilder();
builder.append("ADD TIME OF EVENT HERE: " + System.lineSeparator());
builder.append("ADD ISSUE DESCRIPTION OR GITHUB ISSUE REFERENCE NUMBER: " + System.lineSeparator());
builder.append("-------------------------------------------------------" + System.lineSeparator());
builder.append(MainApp.gs(R.string.app_name) + " " + BuildConfig.VERSION + System.lineSeparator()); builder.append(MainApp.gs(R.string.app_name) + " " + BuildConfig.VERSION + System.lineSeparator());
if (Config.NSCLIENT) if (Config.NSCLIENT)
builder.append("NSCLIENT" + System.lineSeparator()); builder.append("NSCLIENT" + System.lineSeparator());

View file

@ -288,17 +288,12 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) { public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
PumpEnactResult result = new PumpEnactResult();
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
result = cancelTempBasal(false);
if (!result.success)
return result;
}
TemporaryBasal tempBasal = new TemporaryBasal() TemporaryBasal tempBasal = new TemporaryBasal()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.percent(percent) .percent(percent)
.duration(durationInMinutes) .duration(durationInMinutes)
.source(Source.USER); .source(Source.USER);
PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
result.percent = percent; result.percent = percent;

View file

@ -1,8 +1,6 @@
package info.nightscout.androidaps.tabs; package info.nightscout.androidaps.tabs;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -14,8 +12,10 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.utils.SP;
/** /**
* Created by mike on 30.05.2016. * Created by mike on 30.05.2016.
@ -57,8 +57,7 @@ public class TabPageAdapter extends FragmentPagerAdapter {
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (SP.getBoolean(R.string.key_short_tabtitles, false)) {
if (preferences.getBoolean("short_tabtitles", false)) {
return visibleFragmentList.get(position).getNameShort(); return visibleFragmentList.get(position).getNameShort();
} }
return visibleFragmentList.get(position).getName(); return visibleFragmentList.get(position).getName();

View file

@ -110,9 +110,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginTop="-15dp" android:layout_marginTop="-5dp"
android:paddingLeft="-5dp" android:paddingLeft="-2dp"
android:paddingRight="-5dp" android:paddingRight="-2dp"
android:text="→" android:text="→"
android:textSize="20dp" android:textSize="20dp"
android:textStyle="bold" /> android:textStyle="bold" />

View file

@ -116,9 +116,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginTop="-15dp" android:layout_marginTop="-5dp"
android:paddingLeft="-5dp" android:paddingLeft="-2dp"
android:paddingRight="-5dp" android:paddingRight="-2dp"
android:text="→" android:text="→"
android:textSize="50sp" android:textSize="50sp"
android:textStyle="bold" /> android:textStyle="bold" />

View file

@ -52,23 +52,25 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="horizontal">
<Button <Button
android:id="@+id/treatments_reshreshfromnightscout" android:id="@+id/treatments_reshreshfromnightscout"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:text="@string/nav_refreshtreatments"/> android:layout_weight="1"
android:text="@string/nav_refreshtreatments" />
<Button <Button
android:id="@+id/treatments_delete_future_treatments" android:id="@+id/treatments_delete_future_treatments"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="@string/deletefuturetreatments" /> android:text="@string/deletefuturetreatments" />
</LinearLayout> </LinearLayout>

View file

@ -11,14 +11,14 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
android:id="@+id/careportal_refreshfromnightscout" android:id="@+id/careportal_refreshfromnightscout"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/refresheventsfromnightscout" /> android:text="@string/refresheventsfromnightscout" />
@ -27,7 +27,7 @@
android:id="@+id/careportal_removeandroidapsstartedevents" android:id="@+id/careportal_removeandroidapsstartedevents"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/careportal_removestartedevents" /> android:text="@string/careportal_removestartedevents" />

View file

@ -1202,7 +1202,8 @@
<string name="insulinlimitviolation">Insulin limit violation</string> <string name="insulinlimitviolation">Insulin limit violation</string>
<string name="key_loop_openmode_min_change" translatable="false">loop_openmode_min_change</string> <string name="key_loop_openmode_min_change" translatable="false">loop_openmode_min_change</string>
<string name="loop_openmode_min_change">Minimal request change [%]</string> <string name="loop_openmode_min_change">Minimal request change [%]</string>
<string name="loop_openmode_min_change_summary">Loop will popup new change request only if change is bigger than this value. Default value is 30%</string> <string name="loop_openmode_min_change_summary">Loop will popup new change request only if change is bigger than this value. Default value is 20%</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>

View file

@ -69,7 +69,7 @@
</PreferenceScreen> </PreferenceScreen>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="short_tabtitles" android:key="@string/key_short_tabtitles"
android:title="@string/short_tabtitles" /> android:title="@string/short_tabtitles" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceScreen android:title="@string/localalertsettings_title"> <PreferenceScreen android:title="@string/localalertsettings_title">