Skip to content

Commit

Permalink
Carbohydrates instead of custom unit for food edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Faltenreich committed Nov 30, 2016
1 parent 0a2a17a commit 243801e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FoodEditFragment extends BaseFoodFragment {
@BindView(R.id.food_edit_name) StickyHintInput nameInput;
@BindView(R.id.food_edit_brand) StickyHintInput brandInput;
@BindView(R.id.food_edit_ingredients) StickyHintInput ingredientsInput;
@BindView(R.id.food_edit_value) StickyHintInput valueInput;
@BindView(R.id.food_edit_carbohydrates) StickyHintInput valueInput;

public FoodEditFragment() {
super(R.layout.fragment_food_edit, R.string.food_new);
Expand Down Expand Up @@ -69,9 +69,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
}

private void init() {

valueInput.setHint(PreferenceHelper.getInstance().getUnitName(Measurement.Category.MEAL));

Food food = getFood();
if (food != null) {
setTitle(R.string.food_edit);
Expand Down Expand Up @@ -110,9 +107,7 @@ private void store() {
food.setName(nameInput.getText());
food.setBrand(brandInput.getText());
food.setIngredients(ingredientsInput.getText());
food.setCarbohydrates(PreferenceHelper.getInstance().formatCustomToDefaultUnit(
Measurement.Category.MEAL,
NumberUtils.parseNumber(valueInput.getText())));
food.setCarbohydrates(NumberUtils.parseNumber(valueInput.getText()));

FoodDao.getInstance().createOrUpdate(food);
Events.post(new FoodSavedEvent(food));
Expand Down
3 changes: 2 additions & 1 deletion Diaguard/src/main/res/layout/fragment_food_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@
app:tintColor="@color/gray_darker" />

<com.faltenreich.diaguard.ui.view.StickyHintInput
android:id="@+id/food_edit_value"
android:id="@+id/food_edit_carbohydrates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/carbohydrates_per_100g"
android:inputType="numberDecimal"/>

</LinearLayout>
Expand Down
1 change: 1 addition & 0 deletions Diaguard/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
<string name="change_every_hour">Ändert sich jede Stunde</string>

<string name="carbohydrates">Kohlenhydrate</string>
<string name="carbohydrates_per_100g">Kohlenhydrate pro 100 g</string>
<string name="energy">Kalorien</string>
<string name="fat">Fett</string>
<string name="fat_saturated">Gesättigte Fettsäuren</string>
Expand Down
1 change: 1 addition & 0 deletions Diaguard/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,6 @@
<string name="fat">Grasa</string>
<string name="fat_saturated">Grasa saturada</string>
<string name="fiber">Fibra</string>
<string name="carbohydrates_per_100g">Carbohidratos por 100 g</string>

</resources>
1 change: 1 addition & 0 deletions Diaguard/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,6 @@
<string name="fat">Graisse</string>
<string name="fat_saturated">Graisses saturées</string>
<string name="fiber">Fibra</string>
<string name="carbohydrates_per_100g">Glucides par 100 g</string>

</resources>
1 change: 1 addition & 0 deletions Diaguard/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<string name="change_every_hour">Changes every hour</string>

<string name="carbohydrates">Carbohydrates</string>
<string name="carbohydrates_per_100g">Carbohydrates per 100 g</string>
<string name="energy">Energy</string>
<string name="fat">Fat</string>
<string name="fat_saturated">Saturated fat</string>
Expand Down

0 comments on commit 243801e

Please sign in to comment.