Android Open Source - RecipeBook Instruction






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  ww  . j av  a  2 s .  co  m*/
import android.content.ContentValues;

import com.ianhanniballake.recipebook.provider.RecipeContract;

/**
 * Class that manages the information associated with an instruction
 */
public class Instruction
{
  private String instruction;

  /**
   * Creates a new, empty instruction
   */
  public Instruction()
  {
  }

  /**
   * Creates a new instruction with the given text
   * 
   * @param instruction
   *            Instruction text
   */
  public Instruction(final String instruction)
  {
    this.instruction = instruction;
  }

  /**
   * Setter for the instruction text
   * 
   * @param instruction
   *            Instruction text
   */
  public void setInstruction(final String instruction)
  {
    this.instruction = instruction;
  }

  /**
   * Converts this instruction into appropriate ContentValues for insertion into the RecipeProvider
   * 
   * @param recipeId
   *            Mandatory recipeId to be associated with this instruction
   * @return ContentValues usable by the RecipeProvider
   */
  public ContentValues toContentValues(final long recipeId)
  {
    final ContentValues contentValues = new ContentValues();
    contentValues.put(RecipeContract.Instructions.COLUMN_NAME_RECIPE_ID, recipeId);
    contentValues.put(RecipeContract.Instructions.COLUMN_NAME_INSTRUCTION, instruction);
    return contentValues;
  }

  @Override
  public String toString()
  {
    return instruction;
  }
}




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