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;
}
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));
}
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);
}
Aggregations