public class RecipeActivity extends Activity {
// ...
private ImageView ivThumb;
private TextView tvTitle;
private TextView tvReadyInValue;
private TextView tvCostPerServingValue;
private TextView tvIngredientsNumberValue;
private TextView tvLikesValue;
private TextView tvCaloriesValue;
private TextView tvProteinValue;
private TextView tvFatValue;
private TextView tvCarbsValue;
private TextView tvHealthScoreValue;
private ListView lvIngredients;
private ListView lvInstructions;
private RecipeInfo curRecipe;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assignWidgets();
}
@Override
private void assignWidgets() {
ivThumb = (ImageView) findViewById(R.id.ivThumb);
tvTitle = (TextView) findViewById(R.id.tvTitle);
tvReadyInValue = (TextView) findViewById(R.id.tvReadyInValue);
tvCostPerServingValue = (TextView) findViewById(R.id.tvCostPerServingValue);
tvIngredientsNumberValue = (TextView) findViewById(R.id.tvIngredientsNumberValue);
tvLikesValue = (TextView) findViewById(R.id.tvLikesValue);
tvCaloriesValue = (TextView) findViewById(R.id.tvCaloriesValue);
tvProteinValue = (TextView) findViewById(R.id.tvProteinValue);
tvFatValue = (TextView) findViewById(R.id.tvFatValue);
tvCarbsValue = (TextView) findViewById(R.id.tvCarbsValue);
tvHealthScoreValue = (TextView) findViewById(R.id.tvHealthScoreValue);
lvIngredients = (ListView) findViewById(R.id.lvIngredients);
lvInstructions = (ListView) findViewById(R.id.lvInstructions);
}
private void fillRecipeInfo() {
if (recipe == null) {
return
}
Picasso.with(this)
.load(curRecipe.getImageUrl())
.into(ivThumb);
tvTitle.setText(curRecipe.getName());
tvReadyInValue.setText(curRecipe.getReadyInMinutes());
tvCostPerServingValue.setText(curRecipe.getPricePerServing()));
tvIngredientsNumberValue.setText(curRecipe.getIngredients().size())));
tvLikesValue.setText(curRecipe.getLikes());
tvCaloriesValue.setText(curRecipe.getCalories());
tvProteinValue.setText(curRecipe.getProtein());
tvFatValue.setText(curRecipe.getFat());
tvCarbsValue.setText(curRecipe.getCarbs());
}
}