예제 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    logger.v(
        "onCreateView",
        "inflater=%s, container=%s, savedInstanceState=%s",
        inflater,
        container,
        savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_recipe, container, false);
    if (getArguments() == null) {
      logger.e("onCreateView", "no Arguments");
      return view;
    }
    mRecipeId = getArguments().getLong(ARG_RECIPE_ID);
    mRecipe = mDbOpenHelper.getDaoSession().getRecipeDao().load(mRecipeId);
    logger.v("onCreateView", "mRecipe=%s", mRecipe);

    AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.fragment_test_image_id);
    imageView.setUrl("http://dummyimage.com/380x380");
    Loader loader = getActivity().getLoaderManager().initLoader(0, null, imageView);
    loader.forceLoad();

    return view;
  }
예제 #2
0
 /**
  * Use this factory method to create a new instance of this fragment using the provided
  * parameters.
  *
  * @param recipeId
  * @return
  */
 public static RecipeFragment newInstance(Long recipeId) {
   logger.v("newInstance", "recipeId=%s", recipeId);
   RecipeFragment fragment = new RecipeFragment();
   Bundle args = new Bundle();
   args.putLong(ARG_RECIPE_ID, recipeId);
   fragment.setArguments(args);
   return fragment;
 }
예제 #3
0
 @Override
 public void onAttach(Activity activity) {
   logger.v("onAttach", "mRecipeId=%s, activity=%s", mRecipeId, activity);
   super.onAttach(activity);
   try {
     mListener = (OnFragmentInteractionListener) activity;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         activity.toString() + " must implement OnFragmentInteractionListener");
   }
 }
예제 #4
0
 @Override
 public void onDetach() {
   logger.v("onDetach", "mRecipeId=%s", mRecipeId);
   super.onDetach();
   mListener = null;
 }
예제 #5
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   logger.v("onCreate", "savedInstanceState=%s", savedInstanceState);
   super.onCreate(savedInstanceState);
   mDbOpenHelper = new DbOpenHelper(getContext(), null);
 }
예제 #6
0
 public RecipeFragment() {
   logger.v("RecipeFragment", null);
 }