move cancel temp to actions
This commit is contained in:
parent
9596987b35
commit
34d4bec556
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
|
@ -49,6 +50,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
Button extendedBolus;
|
Button extendedBolus;
|
||||||
Button extendedBolusCancel;
|
Button extendedBolusCancel;
|
||||||
Button tempBasal;
|
Button tempBasal;
|
||||||
|
Button tempBasalCancel;
|
||||||
Button fill;
|
Button fill;
|
||||||
|
|
||||||
private static Handler sHandler;
|
private static Handler sHandler;
|
||||||
|
@ -74,6 +76,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
|
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
|
||||||
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
|
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||||
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
|
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
|
||||||
|
tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal);
|
||||||
fill = (Button) view.findViewById(R.id.actions_fill);
|
fill = (Button) view.findViewById(R.id.actions_fill);
|
||||||
|
|
||||||
profileSwitch.setOnClickListener(this);
|
profileSwitch.setOnClickListener(this);
|
||||||
|
@ -81,6 +84,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
extendedBolus.setOnClickListener(this);
|
extendedBolus.setOnClickListener(this);
|
||||||
extendedBolusCancel.setOnClickListener(this);
|
extendedBolusCancel.setOnClickListener(this);
|
||||||
tempBasal.setOnClickListener(this);
|
tempBasal.setOnClickListener(this);
|
||||||
|
tempBasalCancel.setOnClickListener(this);
|
||||||
fill.setOnClickListener(this);
|
fill.setOnClickListener(this);
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
@ -114,33 +118,59 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null)
|
if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null) {
|
||||||
|
tempTarget.setVisibility(View.GONE);
|
||||||
|
profileSwitch.setVisibility(View.GONE);
|
||||||
|
extendedBolus.setVisibility(View.GONE);
|
||||||
|
extendedBolusCancel.setVisibility(View.GONE);
|
||||||
|
tempBasal.setVisibility(View.GONE);
|
||||||
|
tempBasalCancel.setVisibility(View.GONE);
|
||||||
|
fill.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1;
|
boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1;
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !allowProfileSwitch)
|
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !allowProfileSwitch)
|
||||||
profileSwitch.setVisibility(View.GONE);
|
profileSwitch.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
profileSwitch.setVisibility(View.VISIBLE);
|
profileSwitch.setVisibility(View.VISIBLE);
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
|
|
||||||
|
|
||||||
|
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) {
|
||||||
extendedBolus.setVisibility(View.GONE);
|
extendedBolus.setVisibility(View.GONE);
|
||||||
else {
|
|
||||||
extendedBolus.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
|
|
||||||
extendedBolusCancel.setVisibility(View.GONE);
|
extendedBolusCancel.setVisibility(View.GONE);
|
||||||
else {
|
} else {
|
||||||
extendedBolusCancel.setVisibility(View.VISIBLE);
|
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||||
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
extendedBolus.setVisibility(View.GONE);
|
||||||
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
|
extendedBolusCancel.setVisibility(View.VISIBLE);
|
||||||
|
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||||
|
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
|
||||||
|
} else {
|
||||||
|
extendedBolus.setVisibility(View.VISIBLE);
|
||||||
|
extendedBolusCancel.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isTempBasalInProgress())
|
|
||||||
|
|
||||||
|
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
|
||||||
tempBasal.setVisibility(View.GONE);
|
tempBasal.setVisibility(View.GONE);
|
||||||
else
|
tempBasalCancel.setVisibility(View.GONE);
|
||||||
tempBasal.setVisibility(View.VISIBLE);
|
} else {
|
||||||
|
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||||
|
tempBasal.setVisibility(View.GONE);
|
||||||
|
tempBasalCancel.setVisibility(View.VISIBLE);
|
||||||
|
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||||
|
tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
|
||||||
|
} else {
|
||||||
|
tempBasal.setVisibility(View.VISIBLE);
|
||||||
|
tempBasalCancel.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
|
||||||
fill.setVisibility(View.GONE);
|
fill.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
fill.setVisibility(View.VISIBLE);
|
fill.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (!Config.APS)
|
if (!Config.APS)
|
||||||
tempTarget.setVisibility(View.GONE);
|
tempTarget.setVisibility(View.GONE);
|
||||||
else
|
else
|
||||||
|
|
|
@ -175,7 +175,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
LinearLayoutManager llm;
|
LinearLayoutManager llm;
|
||||||
|
|
||||||
LinearLayout acceptTempLayout;
|
LinearLayout acceptTempLayout;
|
||||||
Button cancelTempButton;
|
|
||||||
Button treatmentButton;
|
Button treatmentButton;
|
||||||
Button wizardButton;
|
Button wizardButton;
|
||||||
Button calibrationButton;
|
Button calibrationButton;
|
||||||
|
@ -269,9 +268,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
||||||
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
||||||
|
|
||||||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltempbutton);
|
|
||||||
if (cancelTempButton != null)
|
|
||||||
cancelTempButton.setOnClickListener(this);
|
|
||||||
treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton);
|
treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton);
|
||||||
treatmentButton.setOnClickListener(this);
|
treatmentButton.setOnClickListener(this);
|
||||||
wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton);
|
wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton);
|
||||||
|
@ -1020,15 +1016,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||||
if (cancelTempButton != null) {
|
|
||||||
if (activeTemp != null) {
|
|
||||||
cancelTempButton.setVisibility(View.VISIBLE);
|
|
||||||
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
|
|
||||||
} else {
|
|
||||||
cancelTempButton.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String basalText = "";
|
String basalText = "";
|
||||||
if (shorttextmode) {
|
if (shorttextmode) {
|
||||||
if (activeTemp != null) {
|
if (activeTemp != null) {
|
||||||
|
|
|
@ -52,6 +52,19 @@
|
||||||
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
||||||
android:text="@string/overview_tempbasal_button" />
|
android:text="@string/overview_tempbasal_button" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/actions_canceltempbasal"
|
||||||
|
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:drawableTop="@drawable/icon_cancelbasal"
|
||||||
|
android:text="Cancel temp basal" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/actions_extendedbolus"
|
android:id="@+id/actions_extendedbolus"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
|
|
|
@ -452,20 +452,6 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/overview_canceltempbutton"
|
|
||||||
style="?android:attr/buttonStyle"
|
|
||||||
android:layout_width="0px"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:drawableTop="@drawable/icon_cancelbasal"
|
|
||||||
android:paddingLeft="0dp"
|
|
||||||
android:paddingRight="0dp"
|
|
||||||
android:text="Cancel temp basal"
|
|
||||||
android:textColor="@color/colorCancelTempButton"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue