overview scroll, determinebasal fix

This commit is contained in:
Milos Kozak 2016-08-08 14:47:24 +02:00
parent 88698576a2
commit 267e0220c0
4 changed files with 193 additions and 172 deletions

View file

@ -23,11 +23,14 @@ public class APSResult implements Parcelable {
@Override
public String toString() {
if (changeRequested)
if (changeRequested) {
if (rate == 0 && duration == 0)
return MainApp.sResources.getString(R.string.canceltemp);
else
return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h\n" +
MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to0Decimal(duration) + " min\n" +
MainApp.sResources.getString(R.string.reason) + ": " + reason;
else
} else
return MainApp.sResources.getString(R.string.nochangerequested);
}

View file

@ -172,6 +172,9 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();
// Fix bug determine basal
if (determineBasalResult.rate == 0d && determineBasalResult.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) determineBasalResult.changeRequested = false;
determineBasalResult.iob = iobTotal;
determineBasalAdapterJS.release();

View file

@ -202,7 +202,7 @@ public class OverviewFragment extends Fragment {
sHandler.post(new Runnable() {
@Override
public void run() {
acceptTempLayout.setVisibility(View.GONE);
hideTempRecommendation();
PumpEnactResult applyResult = MainApp.getConfigBuilder().applyAPSRequest(finalLastRun.constraintsProcessed);
if (applyResult.enacted) {
finalLastRun.setByPump = applyResult;
@ -282,6 +282,17 @@ public class OverviewFragment extends Fragment {
updateGUIIfVisible();
}
private void hideTempRecommendation() {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
acceptTempLayout.setVisibility(View.GONE);
}
});
}
private void updateGUIIfVisible() {
Activity activity = getActivity();
if (activity != null)

View file

@ -4,6 +4,9 @@
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.Overview.OverviewFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@ -198,7 +201,8 @@
android:textColor="@color/colorWizardButton" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>