allow to view profile from overview
This commit is contained in:
parent
c79b750a9c
commit
547f09ffbd
|
@ -120,6 +120,7 @@ import info.nightscout.androidaps.plugins.Overview.graphExtensions.FixedLineGrap
|
|||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
|
||||
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
||||
import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog;
|
||||
import info.nightscout.utils.BolusWizard;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
@ -350,27 +351,33 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
if (activeloop == null)
|
||||
return;
|
||||
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
|
||||
if (activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
menu.add(MainApp.sResources.getString(R.string.disableloop));
|
||||
if (!activeloop.isSuspended()) {
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor1h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
|
||||
} else {
|
||||
menu.add(MainApp.sResources.getString(R.string.resume));
|
||||
if (v == apsModeView) {
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
if (activeloop == null)
|
||||
return;
|
||||
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
|
||||
if (activeloop.isEnabled(PluginBase.LOOP)) {
|
||||
menu.add(MainApp.sResources.getString(R.string.disableloop));
|
||||
if (!activeloop.isSuspended()) {
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor1h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
|
||||
} else {
|
||||
menu.add(MainApp.sResources.getString(R.string.resume));
|
||||
}
|
||||
}
|
||||
if (!activeloop.isEnabled(PluginBase.LOOP))
|
||||
menu.add(MainApp.sResources.getString(R.string.enableloop));
|
||||
} else if (v == activeProfileView) {
|
||||
menu.setHeaderTitle(MainApp.sResources.getString(R.string.profile));
|
||||
menu.add(MainApp.sResources.getString(R.string.danar_viewprofile));
|
||||
menu.add(MainApp.sResources.getString(R.string.careportal_profileswitch));
|
||||
}
|
||||
if (!activeloop.isEnabled(PluginBase.LOOP))
|
||||
menu.add(MainApp.sResources.getString(R.string.enableloop));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -554,6 +561,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
});
|
||||
NSUpload.uploadOpenAPSOffline(180);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.careportal_profileswitch))) {
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.danar_viewprofile))) {
|
||||
ProfileViewerDialog pvd = ProfileViewerDialog.newInstance(System.currentTimeMillis());
|
||||
FragmentManager manager = getFragmentManager();
|
||||
pvd.show(manager, "ProfileViewDialog");
|
||||
}
|
||||
|
||||
return super.onContextItemSelected(item);
|
||||
|
@ -738,6 +755,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
MainApp.bus().unregister(this);
|
||||
sLoopHandler.removeCallbacksAndMessages(null);
|
||||
unregisterForContextMenu(apsModeView);
|
||||
unregisterForContextMenu(activeProfileView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -753,6 +771,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
};
|
||||
sLoopHandler.postDelayed(sRefreshLoop, 60 * 1000L);
|
||||
registerForContextMenu(apsModeView);
|
||||
registerForContextMenu(activeProfileView);
|
||||
updateGUI("onResume");
|
||||
}
|
||||
|
||||
|
@ -1088,21 +1107,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
activeProfileView.setText(MainApp.getConfigBuilder().getProfileName());
|
||||
activeProfileView.setBackgroundColor(Color.GRAY);
|
||||
|
||||
activeProfileView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
|
||||
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
activeProfileView.setLongClickable(true);
|
||||
|
||||
|
||||
tempTargetView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ProfileViewerDialog extends DialogFragment {
|
|||
private TextView dateTextView;
|
||||
private Button refreshButton;
|
||||
|
||||
static ProfileViewerDialog newInstance(long time) {
|
||||
public static ProfileViewerDialog newInstance(long time) {
|
||||
ProfileViewerDialog dialog = new ProfileViewerDialog();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
|
Loading…
Reference in a new issue