@Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    prepareBackgroundManager();

    mSelectedMovie = getActivity().getIntent().getParcelableExtra(MovieDetailsActivity.MOVIE);
    if (mSelectedMovie != null || checkGlobalSearchIntent()) {
      removeNotification(
          getActivity()
              .getIntent()
              .getIntExtra(MovieDetailsActivity.NOTIFICATION_ID, NO_NOTIFICATION));
      setupAdapter();
      setupDetailsOverviewRow();
      setupDetailsOverviewRowPresenter();
      setupMovieListRow();
      setupMovieListRowPresenter();
      updateBackground(mSelectedMovie.getBackgroundImageUrl());
      setOnItemViewClickedListener(new ItemViewClickedListener());
    } else {
      Intent intent = new Intent(getActivity(), MainActivity.class);
      startActivity(intent);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.amphitheatre);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    Video video = (Video) getActivity().getIntent().getSerializableExtra(Constants.VIDEO);

    if (video.isMovie()) {
      new DetailRowBuilderTask(getActivity(), this).execute(video);
    } else {
      List<Video> videos =
          Select.from(Video.class)
              .where(Condition.prop("name").eq(video.getName()), Condition.prop("is_movie").eq(0))
              .list();

      Map<String, List<Video>> groups =
          new TreeMap<String, List<Video>>(Collections.reverseOrder());

      for (Video vid : videos) {
        // if an Episode item exists then categorize it
        // otherwise, add it to the uncategorized list
        if (vid.getTvShow() != null && vid.getTvShow().getEpisode() != null) {
          int seasonNumber = vid.getTvShow().getEpisode().getSeasonNumber();
          String key = String.format(getString(R.string.season_number), seasonNumber);

          if (groups.containsKey(key)) {
            List<Video> subVideos = groups.get(key);
            subVideos.add(vid);
          } else {
            List<Video> list = new ArrayList<Video>();
            list.add(vid);
            groups.put(key, list);
          }
        } else {
          String key = getString(R.string.uncategorized);

          if (groups.containsKey(key)) {
            groups.get(key).add(vid);
          } else {
            List<Video> list = new ArrayList<Video>();
            list.add(vid);
            groups.put(key, list);
          }
        }
      }

      new DetailRowBuilderTask(getActivity(), groups, this).execute(video);
    }

    setOnItemClickedListener(getDefaultItemClickedListener());
    updateBackground(video.getBackgroundImageUrl());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);

    mDefaultBackground = getResources().getDrawable(R.drawable.default_background);

    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);

    selectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
    new DetailRowBuilderTask().execute(selectedMovie);

    setOnItemClickedListener(getDefaultItemClickedListener());
    updateBackground(selectedMovie.getBackgroundImageURI());
  }
 @Override
 public void onStop() {
   mBackgroundManager.release();
   super.onStop();
 }