Search in sources :

Example 1 with TimeMeasurementView

use of com.health.openscale.gui.views.TimeMeasurementView 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);
    }
}
Also used : TimeMeasurementView(com.health.openscale.gui.views.TimeMeasurementView) WeightMeasurementView(com.health.openscale.gui.views.WeightMeasurementView) DateMeasurementView(com.health.openscale.gui.views.DateMeasurementView) MeasurementView(com.health.openscale.gui.views.MeasurementView) TimeMeasurementView(com.health.openscale.gui.views.TimeMeasurementView) DateMeasurementView(com.health.openscale.gui.views.DateMeasurementView) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1 DateMeasurementView (com.health.openscale.gui.views.DateMeasurementView)1 MeasurementView (com.health.openscale.gui.views.MeasurementView)1 TimeMeasurementView (com.health.openscale.gui.views.TimeMeasurementView)1 WeightMeasurementView (com.health.openscale.gui.views.WeightMeasurementView)1