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)
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
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
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,201 +4,205 @@
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.Overview.OverviewFragment">
<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/overview_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:gravity="center_vertical"
android:text="00.0"
android:textSize="80dp"
android:textStyle="bold" />
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/overview_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:gravity="center_vertical"
android:text="00.0"
android:textSize="80dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/overview_timeago"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/overview_apsmode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:background="@drawable/loopmodeborder"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<TextView
android:id="@+id/overview_timeago"
android:id="@+id/overview_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/overview_apsmode"
android:id="@+id/overview_runningtemp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:background="@drawable/loopmodeborder"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Medium Text"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<TextView
android:id="@+id/overview_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<TextView
android:id="@+id/overview_runningtemp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/overview_iob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<com.jjoe64.graphview.GraphView
android:id="@+id/overview_bggraph"
android:layout_width="match_parent"
android:layout_height="160dip" />
<LinearLayout
android:id="@+id/overview_accepttemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_accepttempbutton"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="Accept new temp\n0.25U/h"
android:textColor="@color/colorAcceptTempButton" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_canceltemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_canceltemp"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="Cancel temp basal"
android:textColor="@color/colorCancelTempButton" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_settemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_settempbasal"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_tempbasal_button"
android:textColor="@color/colorSetTempButton" />
<Button
android:id="@+id/overview_extendedbolus"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_extendedbolus_button"
android:textColor="@color/colorSetExtendedButton" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_treatment"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton" />
<Button
android:id="@+id/overview_wizard"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_calculator_label"
android:textColor="@color/colorWizardButton" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/overview_iob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<com.jjoe64.graphview.GraphView
android:id="@+id/overview_bggraph"
android:layout_width="match_parent"
android:layout_height="160dip" />
<LinearLayout
android:id="@+id/overview_accepttemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_accepttempbutton"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="Accept new temp\n0.25U/h"
android:textColor="@color/colorAcceptTempButton" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_canceltemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_canceltemp"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="Cancel temp basal"
android:textColor="@color/colorCancelTempButton" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_settemplayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_settempbasal"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_tempbasal_button"
android:textColor="@color/colorSetTempButton" />
<Button
android:id="@+id/overview_extendedbolus"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_extendedbolus_button"
android:textColor="@color/colorSetExtendedButton" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/overview_treatment"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton" />
<Button
android:id="@+id/overview_wizard"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/overview_calculator_label"
android:textColor="@color/colorWizardButton" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>