move set temp and set extended buttons to actions
This commit is contained in:
parent
3ac9811d9a
commit
45ffc18d25
|
@ -10,9 +10,10 @@ import android.view.ViewGroup;
|
|||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
|
@ -34,6 +35,8 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
|
|||
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
||||
|
||||
view.findViewById(R.id.actions_profileswitch).setOnClickListener(this);
|
||||
view.findViewById(R.id.actions_extendedbolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.actions_settempbasal).setOnClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -41,17 +44,22 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
switch (view.getId()) {
|
||||
case R.id.actions_profileswitch:
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch);
|
||||
newDialog.show(manager, "NewNSTreatmentDialog");
|
||||
break;
|
||||
default:
|
||||
newDialog = null;
|
||||
case R.id.actions_extendedbolus:
|
||||
NewExtendedBolusDialog newExtendedDialog = new NewExtendedBolusDialog();
|
||||
newExtendedDialog.show(manager, "NewExtendedDialog");
|
||||
break;
|
||||
case R.id.actions_settempbasal:
|
||||
NewTempBasalDialog newTempDialog = new NewTempBasalDialog();
|
||||
newTempDialog.show(manager, "NewTempDialog");
|
||||
break;
|
||||
}
|
||||
if (newDialog != null)
|
||||
newDialog.show(manager, "NewNSTreatmentDialog");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
|
@ -2,9 +2,7 @@ package info.nightscout.androidaps.plugins.Careportal.Dialogs;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -40,20 +38,13 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
|
|
|
@ -43,7 +43,7 @@ import info.nightscout.androidaps.plugins.Loop.DeviceStatus;
|
|||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResult;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.os.Handler;
|
|||
import android.os.HandlerThread;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -60,8 +59,6 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
|||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTempBasalDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension.PointsWithLabelGraphSeries;
|
||||
|
@ -70,7 +67,6 @@ import info.nightscout.utils.BolusWizard;
|
|||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
|
||||
public class OverviewFragment extends Fragment {
|
||||
|
@ -91,14 +87,11 @@ public class OverviewFragment extends Fragment {
|
|||
GraphView bgGraph;
|
||||
|
||||
LinearLayout cancelTempLayout;
|
||||
LinearLayout setTempLayout;
|
||||
LinearLayout acceptTempLayout;
|
||||
LinearLayout quickWizardLayout;
|
||||
Button cancelTempButton;
|
||||
Button treatmentButton;
|
||||
Button wizardButton;
|
||||
Button setTempButton;
|
||||
Button setExtenedButton;
|
||||
Button acceptTempButton;
|
||||
Button quickWizardButton;
|
||||
|
||||
|
@ -131,10 +124,7 @@ public class OverviewFragment extends Fragment {
|
|||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
|
||||
treatmentButton = (Button) view.findViewById(R.id.overview_treatment);
|
||||
wizardButton = (Button) view.findViewById(R.id.overview_wizard);
|
||||
setExtenedButton = (Button) view.findViewById(R.id.overview_extendedbolus);
|
||||
setTempButton = (Button) view.findViewById(R.id.overview_settempbasal);
|
||||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
|
||||
setTempLayout = (LinearLayout) view.findViewById(R.id.overview_settemplayout);
|
||||
cancelTempLayout = (LinearLayout) view.findViewById(R.id.overview_canceltemplayout);
|
||||
acceptTempButton = (Button) view.findViewById(R.id.overview_accepttempbutton);
|
||||
acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
|
||||
|
@ -183,23 +173,6 @@ public class OverviewFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
setTempButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewTempBasalDialog newTempDialog = new NewTempBasalDialog();
|
||||
newTempDialog.show(manager, "NewTempDialog");
|
||||
}
|
||||
});
|
||||
|
||||
setExtenedButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewExtendedBolusDialog newExtendedDialog = new NewExtendedBolusDialog();
|
||||
newExtendedDialog.show(manager, "NewExtendedDialog");
|
||||
}
|
||||
});
|
||||
|
||||
acceptTempButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -465,26 +438,20 @@ public class OverviewFragment extends Fragment {
|
|||
if (pump.isTempBasalInProgress()) {
|
||||
TempBasal activeTemp = pump.getTempBasal();
|
||||
cancelTempLayout.setVisibility(View.VISIBLE);
|
||||
setTempLayout.setVisibility(View.GONE);
|
||||
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + ": " + activeTemp.toString());
|
||||
runningTempView.setText(activeTemp.toString());
|
||||
} else {
|
||||
cancelTempLayout.setVisibility(View.GONE);
|
||||
setTempLayout.setVisibility(View.VISIBLE);
|
||||
Double currentBasal = pump.getBaseBasalRate();
|
||||
runningTempView.setText(DecimalFormatter.to2Decimal(currentBasal) + " U/h");
|
||||
}
|
||||
|
||||
if (profile == null) {
|
||||
// disable all treatment buttons because we are not able to check constraints without profile
|
||||
setExtenedButton.setVisibility(View.INVISIBLE);
|
||||
setTempLayout.setVisibility(View.INVISIBLE);
|
||||
wizardButton.setVisibility(View.INVISIBLE);
|
||||
treatmentButton.setVisibility(View.INVISIBLE);
|
||||
return;
|
||||
} else {
|
||||
setExtenedButton.setVisibility(View.VISIBLE);
|
||||
setTempLayout.setVisibility(View.VISIBLE);
|
||||
wizardButton.setVisibility(View.VISIBLE);
|
||||
treatmentButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/actions_profileswitch"
|
||||
|
@ -22,6 +22,32 @@
|
|||
android:text="@string/careportal_profileswitch"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/actions_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/actions_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>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -136,39 +136,6 @@
|
|||
|
||||
</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"
|
||||
|
|
Loading…
Reference in a new issue