Search in sources :

Example 1 with StickyHintInputView

use of com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView in project Diaguard by Faltenreich.

the class FoodEditFragment method isValid.

private boolean isValid() {
    StickyHintInputView nameInput = getBinding().nameInput;
    boolean isValid = true;
    if (nameInput.getText().length() == 0) {
        nameInput.setError(getString(R.string.validator_value_empty));
        isValid = false;
    }
    return isValid;
}
Also used : StickyHintInputView(com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView)

Example 2 with StickyHintInputView

use of com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView in project Diaguard by Faltenreich.

the class CalculatorFragment method updateMealFactor.

private void updateMealFactor() {
    StickyHintInputView factorInput = getBinding().factorInput;
    int hourOfDay = DateTime.now().getHourOfDay();
    float mealFactor = PreferenceStore.getInstance().getMealFactorForHour(hourOfDay);
    factorInput.setText(mealFactor >= 0 ? FloatUtils.parseFloat(mealFactor) : null);
    factorInput.setHint(getString(PreferenceStore.getInstance().getMealFactorUnit().titleResId));
}
Also used : StickyHintInputView(com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView)

Example 3 with StickyHintInputView

use of com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView in project Diaguard by Faltenreich.

the class CalculatorFragment method getCorrectionFactor.

private float getCorrectionFactor() {
    StickyHintInputView input = getBinding().correctionInput;
    int hourOfDay = DateTime.now().getHourOfDay();
    return Validator.containsNumber(input.getText()) ? PreferenceStore.getInstance().formatCustomToDefaultUnit(Category.BLOODSUGAR, FloatUtils.parseNumber(input.getText())) : PreferenceStore.getInstance().getCorrectionFactorForHour(hourOfDay);
}
Also used : StickyHintInputView(com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView)

Aggregations

StickyHintInputView (com.faltenreich.diaguard.shared.view.edittext.StickyHintInputView)3