Search in sources :

Example 1 with InsulinInputView

use of com.faltenreich.diaguard.feature.entry.edit.input.InsulinInputView in project Diaguard by Faltenreich.

the class MeasurementView method init.

private void init() {
    binding = ListItemMeasurementBinding.inflate(LayoutInflater.from(getContext()), this);
    View inputView;
    Category category = measurement.getCategory();
    switch(category) {
        case INSULIN:
            inputView = new InsulinInputView(getContext(), (Insulin) measurement);
            break;
        case MEAL:
            inputView = new MealInputView(getContext(), (Meal) measurement);
            break;
        case PRESSURE:
            inputView = new PressureInputView(getContext(), (Pressure) measurement);
            break;
        default:
            inputView = new GenericInputView<>(getContext(), category.toClass(), measurement);
    }
    // noinspection unchecked
    this.inputView = (MeasurementInputView<?, T>) inputView;
}
Also used : PressureInputView(com.faltenreich.diaguard.feature.entry.edit.input.PressureInputView) Category(com.faltenreich.diaguard.shared.data.database.entity.Category) InsulinInputView(com.faltenreich.diaguard.feature.entry.edit.input.InsulinInputView) Meal(com.faltenreich.diaguard.shared.data.database.entity.Meal) GenericInputView(com.faltenreich.diaguard.feature.entry.edit.input.GenericInputView) PressureInputView(com.faltenreich.diaguard.feature.entry.edit.input.PressureInputView) ImageView(android.widget.ImageView) InsulinInputView(com.faltenreich.diaguard.feature.entry.edit.input.InsulinInputView) View(android.view.View) CardView(androidx.cardview.widget.CardView) MeasurementInputView(com.faltenreich.diaguard.feature.entry.edit.input.MeasurementInputView) MealInputView(com.faltenreich.diaguard.feature.entry.edit.input.MealInputView) TextView(android.widget.TextView) Insulin(com.faltenreich.diaguard.shared.data.database.entity.Insulin) Pressure(com.faltenreich.diaguard.shared.data.database.entity.Pressure) MealInputView(com.faltenreich.diaguard.feature.entry.edit.input.MealInputView)

Aggregations

View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 CardView (androidx.cardview.widget.CardView)1 GenericInputView (com.faltenreich.diaguard.feature.entry.edit.input.GenericInputView)1 InsulinInputView (com.faltenreich.diaguard.feature.entry.edit.input.InsulinInputView)1 MealInputView (com.faltenreich.diaguard.feature.entry.edit.input.MealInputView)1 MeasurementInputView (com.faltenreich.diaguard.feature.entry.edit.input.MeasurementInputView)1 PressureInputView (com.faltenreich.diaguard.feature.entry.edit.input.PressureInputView)1 Category (com.faltenreich.diaguard.shared.data.database.entity.Category)1 Insulin (com.faltenreich.diaguard.shared.data.database.entity.Insulin)1 Meal (com.faltenreich.diaguard.shared.data.database.entity.Meal)1 Pressure (com.faltenreich.diaguard.shared.data.database.entity.Pressure)1