@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);
    }
  }
  private void setupDetailsOverviewRow() {
    Log.d(TAG, "doInBackground: " + mSelectedMovie.toString());
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
    row.setImageDrawable(getResources().getDrawable(R.drawable.default_background));
    int width = Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT);

    Glide.with(getActivity())
        .load(mSelectedMovie.getCardImageUrl())
        .centerCrop()
        .error(R.drawable.default_background)
        .into(
            new SimpleTarget<GlideDrawable>(width, height) {
              @Override
              public void onResourceReady(
                  GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                Log.d(TAG, "details overview card image url ready: " + resource);
                row.setImageDrawable(resource);
                mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
              }
            });

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

    adapter.set(
        ACTION_WATCH_TRAILER,
        new Action(
            ACTION_WATCH_TRAILER,
            getResources().getString(R.string.watch_trailer_1),
            getResources().getString(R.string.watch_trailer_2)));
    adapter.set(
        ACTION_RENT,
        new Action(
            ACTION_RENT,
            getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    adapter.set(
        ACTION_BUY,
        new Action(
            ACTION_BUY,
            getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    row.setActionsAdapter(adapter);

    mAdapter.add(row);
  }
  private void setupMovieListRow() {
    String subcategories[] = {getString(R.string.related_movies)};
    HashMap<String, List<Movie>> movies = VideoProvider.getMovieList();

    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (Map.Entry<String, List<Movie>> entry : movies.entrySet()) {
      if (mSelectedMovie.getCategory().contains(entry.getKey())) {
        List<Movie> list = entry.getValue();
        for (int j = 0; j < list.size(); j++) {
          listRowAdapter.add(list.get(j));
        }
      }
    }
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    mAdapter.add(new ListRow(header, listRowAdapter));
  }