Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class RecipeActivity extends Activity {
  2.  
  3. //  ...
  4.  
  5.     private ImageView ivThumb;
  6.     private TextView tvTitle;
  7.     private TextView tvReadyInValue;
  8.     private TextView tvCostPerServingValue;
  9.     private TextView tvIngredientsNumberValue;
  10.     private TextView tvLikesValue;
  11.     private TextView tvCaloriesValue;
  12.     private TextView tvProteinValue;
  13.     private TextView tvFatValue;
  14.     private TextView tvCarbsValue;
  15.     private TextView tvHealthScoreValue;
  16.     private ListView lvIngredients;
  17.     private ListView lvInstructions;
  18.  
  19.     private RecipeInfo curRecipe;
  20.  
  21.     @Override
  22.     protected void onCreate(Bundle savedInstanceState) {
  23.         super.onCreate(savedInstanceState);
  24.         assignWidgets();
  25.     }
  26.  
  27.     @Override
  28.     private void assignWidgets() {
  29.         ivThumb = (ImageView) findViewById(R.id.ivThumb);
  30.         tvTitle = (TextView) findViewById(R.id.tvTitle);
  31.         tvReadyInValue = (TextView) findViewById(R.id.tvReadyInValue);
  32.         tvCostPerServingValue = (TextView) findViewById(R.id.tvCostPerServingValue);
  33.         tvIngredientsNumberValue = (TextView) findViewById(R.id.tvIngredientsNumberValue);
  34.         tvLikesValue = (TextView) findViewById(R.id.tvLikesValue);
  35.         tvCaloriesValue = (TextView) findViewById(R.id.tvCaloriesValue);
  36.         tvProteinValue = (TextView) findViewById(R.id.tvProteinValue);
  37.         tvFatValue = (TextView) findViewById(R.id.tvFatValue);
  38.         tvCarbsValue = (TextView) findViewById(R.id.tvCarbsValue);
  39.         tvHealthScoreValue = (TextView) findViewById(R.id.tvHealthScoreValue);
  40.         lvIngredients = (ListView) findViewById(R.id.lvIngredients);
  41.         lvInstructions = (ListView) findViewById(R.id.lvInstructions);
  42.     }
  43.  
  44.  
  45.     private void fillRecipeInfo() {
  46.         if (recipe == null) {
  47.             return
  48.         }
  49.         Picasso.with(this)
  50.                 .load(curRecipe.getImageUrl())
  51.                 .into(ivThumb);
  52.         tvTitle.setText(curRecipe.getName());
  53.         tvReadyInValue.setText(curRecipe.getReadyInMinutes());
  54.         tvCostPerServingValue.setText(curRecipe.getPricePerServing()));
  55.         tvIngredientsNumberValue.setText(curRecipe.getIngredients().size())));
  56.         tvLikesValue.setText(curRecipe.getLikes());
  57.         tvCaloriesValue.setText(curRecipe.getCalories());
  58.         tvProteinValue.setText(curRecipe.getProtein());
  59.         tvFatValue.setText(curRecipe.getFat());
  60.         tvCarbsValue.setText(curRecipe.getCarbs());
  61.     }
  62. }