allow to view profile from overview
This commit is contained in:
parent
c79b750a9c
commit
547f09ffbd
2 changed files with 39 additions and 35 deletions
|
@ -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.PointsWithLabelGraphSeries;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
|
||||||
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog;
|
||||||
import info.nightscout.utils.BolusWizard;
|
import info.nightscout.utils.BolusWizard;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
@ -350,6 +351,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
if (v == apsModeView) {
|
||||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
if (activeloop == null)
|
if (activeloop == null)
|
||||||
return;
|
return;
|
||||||
|
@ -371,6 +373,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
if (!activeloop.isEnabled(PluginBase.LOOP))
|
if (!activeloop.isEnabled(PluginBase.LOOP))
|
||||||
menu.add(MainApp.sResources.getString(R.string.enableloop));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -554,6 +561,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
});
|
});
|
||||||
NSUpload.uploadOpenAPSOffline(180);
|
NSUpload.uploadOpenAPSOffline(180);
|
||||||
return true;
|
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);
|
return super.onContextItemSelected(item);
|
||||||
|
@ -738,6 +755,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
MainApp.bus().unregister(this);
|
MainApp.bus().unregister(this);
|
||||||
sLoopHandler.removeCallbacksAndMessages(null);
|
sLoopHandler.removeCallbacksAndMessages(null);
|
||||||
unregisterForContextMenu(apsModeView);
|
unregisterForContextMenu(apsModeView);
|
||||||
|
unregisterForContextMenu(activeProfileView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -753,6 +771,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
};
|
};
|
||||||
sLoopHandler.postDelayed(sRefreshLoop, 60 * 1000L);
|
sLoopHandler.postDelayed(sRefreshLoop, 60 * 1000L);
|
||||||
registerForContextMenu(apsModeView);
|
registerForContextMenu(apsModeView);
|
||||||
|
registerForContextMenu(activeProfileView);
|
||||||
updateGUI("onResume");
|
updateGUI("onResume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,21 +1107,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
activeProfileView.setText(MainApp.getConfigBuilder().getProfileName());
|
activeProfileView.setText(MainApp.getConfigBuilder().getProfileName());
|
||||||
activeProfileView.setBackgroundColor(Color.GRAY);
|
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() {
|
tempTargetView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ProfileViewerDialog extends DialogFragment {
|
||||||
private TextView dateTextView;
|
private TextView dateTextView;
|
||||||
private Button refreshButton;
|
private Button refreshButton;
|
||||||
|
|
||||||
static ProfileViewerDialog newInstance(long time) {
|
public static ProfileViewerDialog newInstance(long time) {
|
||||||
ProfileViewerDialog dialog = new ProfileViewerDialog();
|
ProfileViewerDialog dialog = new ProfileViewerDialog();
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|
Loading…
Reference in a new issue