Browse Source

Minor fixes

master
Apostolos Fanakis 6 years ago
parent
commit
7925c11b42
  1. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
  2. 6
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodInfoFragment.java

4
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java

@ -240,11 +240,13 @@ public class FoodActivity extends BaseActivity {
avgRestaurantRating = jsonResponse.getJSONObject(JSON_TAG_FOOD_AVG_RATING_OBJ).getDouble(JSON_TAG_FOOD_AVG_RATING); avgRestaurantRating = jsonResponse.getJSONObject(JSON_TAG_FOOD_AVG_RATING_OBJ).getDouble(JSON_TAG_FOOD_AVG_RATING);
} }
String foodCaloriesString = jsonFoodInfo.getString(JSON_TAG_FOOD_CALORIES);
food = new Food(jsonFoodInfo.getInt(JSON_TAG_FOOD_ID), food = new Food(jsonFoodInfo.getInt(JSON_TAG_FOOD_ID),
jsonFoodInfo.getString(JSON_TAG_FOOD_NAME), jsonFoodInfo.getString(JSON_TAG_FOOD_NAME),
jsonResponse.getString(JSON_TAG_FOOD_RESTAURANT_NAME), jsonResponse.getString(JSON_TAG_FOOD_RESTAURANT_NAME),
jsonFoodInfo.getString(JSON_TAG_FOOD_DESCRIPTION), jsonFoodInfo.getString(JSON_TAG_FOOD_DESCRIPTION),
jsonFoodInfo.getInt(JSON_TAG_FOOD_CALORIES), foodCaloriesString.equals("null") ? -1 : Integer.parseInt(foodCaloriesString),
avgRestaurantRating); avgRestaurantRating);
JSONArray jsonIngredients = jsonResponse.getJSONArray(JSON_TAG_FOOD_INGREDIENTS); JSONArray jsonIngredients = jsonResponse.getJSONArray(JSON_TAG_FOOD_INGREDIENTS);

6
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodInfoFragment.java

@ -43,7 +43,11 @@ public class FoodInfoFragment extends Fragment {
TextView restaurantServing = rootView.findViewById(R.id.food_serving_restaurant); TextView restaurantServing = rootView.findViewById(R.id.food_serving_restaurant);
restaurantServing.setText(getString(R.string.food_serving_restaurant_placeholder, food.getRestaurantName())); restaurantServing.setText(getString(R.string.food_serving_restaurant_placeholder, food.getRestaurantName()));
TextView calories = rootView.findViewById(R.id.food_calories); TextView calories = rootView.findViewById(R.id.food_calories);
calories.setText(getString(R.string.food_calories_placeholder, food.getCalories())); if (food.getCalories() != -1) {
calories.setText(getString(R.string.food_calories_placeholder, food.getCalories()));
} else {
calories.setVisibility(View.GONE);
}
TextView rating = rootView.findViewById(R.id.food_rating); TextView rating = rootView.findViewById(R.id.food_rating);
if (food.getRating() != -1) { if (food.getRating() != -1) {
rating.setText(getString(R.string.food_rating_placeholder, food.getRating())); rating.setText(getString(R.string.food_rating_placeholder, food.getRating()));

Loading…
Cancel
Save