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.R;
|
||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
|
@ -49,6 +50,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
Button extendedBolus;
|
||||
Button extendedBolusCancel;
|
||||
Button tempBasal;
|
||||
Button tempBasalCancel;
|
||||
Button fill;
|
||||
|
||||
private static Handler sHandler;
|
||||
|
@ -74,6 +76,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
|
||||
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
|
||||
tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal);
|
||||
fill = (Button) view.findViewById(R.id.actions_fill);
|
||||
|
||||
profileSwitch.setOnClickListener(this);
|
||||
|
@ -81,6 +84,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
extendedBolus.setOnClickListener(this);
|
||||
extendedBolusCancel.setOnClickListener(this);
|
||||
tempBasal.setOnClickListener(this);
|
||||
tempBasalCancel.setOnClickListener(this);
|
||||
fill.setOnClickListener(this);
|
||||
|
||||
updateGUI();
|
||||
|
@ -114,33 +118,59 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1;
|
||||
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !allowProfileSwitch)
|
||||
profileSwitch.setVisibility(View.GONE);
|
||||
else
|
||||
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);
|
||||
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);
|
||||
else {
|
||||
extendedBolusCancel.setVisibility(View.VISIBLE);
|
||||
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
|
||||
} else {
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
extendedBolus.setVisibility(View.GONE);
|
||||
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);
|
||||
else
|
||||
tempBasal.setVisibility(View.VISIBLE);
|
||||
tempBasalCancel.setVisibility(View.GONE);
|
||||
} 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())
|
||||
fill.setVisibility(View.GONE);
|
||||
else
|
||||
fill.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!Config.APS)
|
||||
tempTarget.setVisibility(View.GONE);
|
||||
else
|
||||
|
|
|
@ -175,7 +175,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
LinearLayoutManager llm;
|
||||
|
||||
LinearLayout acceptTempLayout;
|
||||
Button cancelTempButton;
|
||||
Button treatmentButton;
|
||||
Button wizardButton;
|
||||
Button calibrationButton;
|
||||
|
@ -269,9 +268,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
||||
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.setOnClickListener(this);
|
||||
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());
|
||||
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 = "";
|
||||
if (shorttextmode) {
|
||||
if (activeTemp != null) {
|
||||
|
|
|
@ -52,6 +52,19 @@
|
|||
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
||||
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
|
||||
android:id="@+id/actions_extendedbolus"
|
||||
style="?android:attr/buttonStyle"
|
||||
|
|
|
@ -452,20 +452,6 @@
|
|||
android:textSize="10sp"
|
||||
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>
|
||||
|
|
Loading…
Reference in a new issue