Android Open Source - RecipeBook Recipe






From Project

Back to project page RecipeBook.

License

The source code is released under:

Copyright (c) 2013, Ian Lake All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Red...

If you think the Android project RecipeBook listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ianhanniballake.recipebook.model;
/* w w  w  .ja  v  a  2  s. co  m*/
import java.util.List;

import android.database.Cursor;

import com.ianhanniballake.recipebook.provider.RecipeContract;

/**
 * Class that manages the information associated with a recipe
 */
public class Recipe
{
  private String description;
  private transient String driveId;
  private List<Ingredient> ingredients;
  private List<Instruction> instructions;
  private String title;

  /**
   * Creates a new, empty recipe
   */
  public Recipe()
  {
  }

  /**
   * Creates a new Recipe from a cursor representation
   * 
   * @param cursor
   *            Cursor representation to load from
   * @param ingredients
   *            ingredients for this recipe
   * @param instructions
   *            instructions for this recipe
   */
  public Recipe(final Cursor cursor, final List<Ingredient> ingredients, final List<Instruction> instructions)
  {
    title = cursor.getString(cursor.getColumnIndex(RecipeContract.Recipes.COLUMN_NAME_TITLE));
    description = cursor.getString(cursor.getColumnIndex(RecipeContract.Recipes.COLUMN_NAME_DESCRIPTION));
    driveId = cursor.getString(cursor.getColumnIndex(RecipeContract.Recipes.COLUMN_NAME_DRIVE_ID));
    this.ingredients = ingredients;
    this.instructions = instructions;
  }

  /**
   * Getter for the Drive Id
   * 
   * @return drive Id of this recipe
   */
  public String getDriveId()
  {
    return driveId;
  }

  /**
   * Getter for the title
   * 
   * @return title of this recipe
   */
  public String getTitle()
  {
    return title;
  }

  @Override
  public String toString()
  {
    return title + ": " + description + "; Drive ID: " + driveId + "; Ingredients: " + ingredients
        + ", Instructions: " + instructions;
  }
}




Java Source Code List

com.ianhanniballake.recipebook.auth.AuthorizedActivity.java
com.ianhanniballake.recipebook.auth.SyncDriveAsyncTask.java
com.ianhanniballake.recipebook.model.Ingredient.java
com.ianhanniballake.recipebook.model.Instruction.java
com.ianhanniballake.recipebook.model.Recipe.java
com.ianhanniballake.recipebook.provider.RecipeContract.java
com.ianhanniballake.recipebook.provider.RecipeProvider.java
com.ianhanniballake.recipebook.sync.SyncAdapter.java
com.ianhanniballake.recipebook.sync.SyncService.java
com.ianhanniballake.recipebook.ui.RecipeDetailActivity.java
com.ianhanniballake.recipebook.ui.RecipeDetailIngredientFragment.java
com.ianhanniballake.recipebook.ui.RecipeDetailInstructionFragment.java
com.ianhanniballake.recipebook.ui.RecipeDetailSummaryFragment.java
com.ianhanniballake.recipebook.ui.RecipeEditActivity.java
com.ianhanniballake.recipebook.ui.RecipeListActivity.java