use of com.health.openscale.gui.views.DateMeasurementView in project openScale by oliexdev.
the class DataEntryActivity method setViewMode.
private void setViewMode(MeasurementView.MeasurementViewMode viewMode) {
measurementViewMode = viewMode;
int dateTimeVisibility = View.VISIBLE;
switch(viewMode) {
case VIEW:
saveButton.setVisible(false);
editButton.setVisible(true);
expandButton.setVisible(true);
deleteButton.setVisible(true);
((LinearLayout) txtDataNr.getParent()).setVisibility(View.VISIBLE);
btnLeft.setVisibility(View.VISIBLE);
btnRight.setVisibility(View.VISIBLE);
btnLeft.setEnabled(previousMeasurement != null);
btnRight.setEnabled(nextMeasurement != null);
dateTimeVisibility = View.GONE;
break;
case EDIT:
saveButton.setVisible(true);
editButton.setVisible(false);
expandButton.setVisible(true);
deleteButton.setVisible(true);
((LinearLayout) txtDataNr.getParent()).setVisibility(View.VISIBLE);
btnLeft.setVisibility(View.VISIBLE);
btnRight.setVisibility(View.VISIBLE);
btnLeft.setEnabled(false);
btnRight.setEnabled(false);
break;
case ADD:
saveButton.setVisible(true);
editButton.setVisible(false);
expandButton.setVisible(false);
deleteButton.setVisible(false);
((LinearLayout) txtDataNr.getParent()).setVisibility(View.GONE);
break;
}
for (MeasurementView measurement : dataEntryMeasurements) {
if (measurement instanceof DateMeasurementView || measurement instanceof TimeMeasurementView) {
measurement.setVisibility(dateTimeVisibility);
}
measurement.setEditMode(viewMode);
}
}
Aggregations