// Path: app/src/main/java/com/xurxodev/moviesandroidkata/presentation/view/fragment/MovieDetailFragment.java
// public class MovieDetailFragment extends Fragment implements MovieDetailPresenter.View {
// 
//     View rootView;
// 
//     @Inject
//     public MovieDetailPresenter presenter;
// 
//     private RecyclerView recyclerView;
// 
// 
// 
//     AppBarLayout appBarLayout;
//     private ProgressBar progressBarLoading;
// 
//     /**
//      * Mandatory empty constructor for the fragment manager to instantiate the
//      * fragment (e.g. upon screen orientation changes).
//      */
//     public MovieDetailFragment() {
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         ((MoviesApplication) getActivity().getApplication()).getAppComponent().activityComponent
//                 ().activityModule(
//                 new ActivityModule(getActivity())).build().inject(this);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//             Bundle savedInstanceState) {
//         rootView = inflater.inflate(R.layout.fragment_movie_detail, container, false);
// 
// 
//         if (getArguments().containsKey(MOVIE_TITLE)) {
// 
//             String competitorName = (String) getArguments().get(MOVIE_TITLE);
// 
//             appBarLayout = (AppBarLayout) getActivity().findViewById(R.id.app_bar);
//             progressBarLoading = (ProgressBar) getActivity().findViewById(R.id.pb_loading);
// 
//             initializePresenter(competitorName);
//         }
// 
//         return rootView;
//     }
// 
//     private void initializePresenter(String competitorName) {
//         presenter.attachView(this, competitorName);
//     }
// 
//     @Override
//     public void renderImage(String image) {
//         Activity activity = this.getActivity();
// 
//         ImageView imgtoolbar = (ImageView) activity.findViewById(R.id.imgToolbar);
// 
//         if (imgtoolbar != null) {
//             Picasso.with(activity.getApplicationContext()).load(image)
//                     .into(imgtoolbar);
//         }
//     }
// 
//     @Override
//     public void renderOverview(String biography) {
//         ((TextView) rootView.findViewById(R.id.movie_overview_content)).setText(biography);
//     }
// 
//     @Override
//     public void renderTitle(String name) {
//         //setTitle from background working in phone
//         CollapsingToolbarLayout collapsingToolbar =
//                 (CollapsingToolbarLayout) getActivity().findViewById(R.id.toolbar_layout);
//         collapsingToolbar.setTitle(name);
// 
//         //setTitle from background working in tablet
//         getActivity().setTitle(name);
//     }
// 
//     @Override
//     public void showLoading() {
//         appBarLayout.setVisibility(View.GONE);
//         rootView.setVisibility(View.GONE);
//         progressBarLoading.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void hideLoading() {
//         appBarLayout.setVisibility(View.VISIBLE);
//         rootView.setVisibility(View.VISIBLE);
//         progressBarLoading.setVisibility(View.GONE);
//     }
// 
//     @Override
//     public boolean isReady() {
//         return isAdded();
//     }
// }


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import com.xurxodev.moviesandroidkata.R;
import com.xurxodev.moviesandroidkata.presentation.view.fragment.MovieDetailFragment;
package com.xurxodev.moviesandroidkata.presentation.view.activity;



public class MovieDetailActivity extends AppCompatActivity {

    public static final String MOVIE_TITLE = "MovieTitle";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_detail);

        initializeToolBar();
        showUpButtonInActionBar();

        if (savedInstanceState == null) {
            showDetailFragment();
        }
    }

    private void showDetailFragment() {
        String movieTitle = (String) getIntent().getStringExtra(MovieDetailActivity.MOVIE_TITLE);

        Bundle arguments = new Bundle();
        arguments.putSerializable(MovieDetailActivity.MOVIE_TITLE, movieTitle);

// Path: app/src/main/java/com/xurxodev/moviesandroidkata/presentation/view/fragment/MovieDetailFragment.java
// public class MovieDetailFragment extends Fragment implements MovieDetailPresenter.View {
// 
//     View rootView;
// 
//     @Inject
//     public MovieDetailPresenter presenter;
// 
//     private RecyclerView recyclerView;
// 
// 
// 
//     AppBarLayout appBarLayout;
//     private ProgressBar progressBarLoading;
// 
//     /**
//      * Mandatory empty constructor for the fragment manager to instantiate the
//      * fragment (e.g. upon screen orientation changes).
//      */
//     public MovieDetailFragment() {
//     }
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         ((MoviesApplication) getActivity().getApplication()).getAppComponent().activityComponent
//                 ().activityModule(
//                 new ActivityModule(getActivity())).build().inject(this);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//             Bundle savedInstanceState) {
//         rootView = inflater.inflate(R.layout.fragment_movie_detail, container, false);
// 
// 
//         if (getArguments().containsKey(MOVIE_TITLE)) {
// 
//             String competitorName = (String) getArguments().get(MOVIE_TITLE);
// 
//             appBarLayout = (AppBarLayout) getActivity().findViewById(R.id.app_bar);
//             progressBarLoading = (ProgressBar) getActivity().findViewById(R.id.pb_loading);
// 
//             initializePresenter(competitorName);
//         }
// 
//         return rootView;
//     }
// 
//     private void initializePresenter(String competitorName) {
//         presenter.attachView(this, competitorName);
//     }
// 
//     @Override
//     public void renderImage(String image) {
//         Activity activity = this.getActivity();
// 
//         ImageView imgtoolbar = (ImageView) activity.findViewById(R.id.imgToolbar);
// 
//         if (imgtoolbar != null) {
//             Picasso.with(activity.getApplicationContext()).load(image)
//                     .into(imgtoolbar);
//         }
//     }
// 
//     @Override
//     public void renderOverview(String biography) {
//         ((TextView) rootView.findViewById(R.id.movie_overview_content)).setText(biography);
//     }
// 
//     @Override
//     public void renderTitle(String name) {
//         //setTitle from background working in phone
//         CollapsingToolbarLayout collapsingToolbar =
//                 (CollapsingToolbarLayout) getActivity().findViewById(R.id.toolbar_layout);
//         collapsingToolbar.setTitle(name);
// 
//         //setTitle from background working in tablet
//         getActivity().setTitle(name);
//     }
// 
//     @Override
//     public void showLoading() {
//         appBarLayout.setVisibility(View.GONE);
//         rootView.setVisibility(View.GONE);
//         progressBarLoading.setVisibility(View.VISIBLE);
//     }
// 
//     @Override
//     public void hideLoading() {
//         appBarLayout.setVisibility(View.VISIBLE);
//         rootView.setVisibility(View.VISIBLE);
//         progressBarLoading.setVisibility(View.GONE);
//     }
// 
//     @Override
//     public boolean isReady() {
//         return isAdded();
//     }
// }


// Path: app/src/main/java/com/xurxodev/moviesandroidkata/presentation/view/activity/MovieDetailActivity.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import com.xurxodev.moviesandroidkata.R;
import com.xurxodev.moviesandroidkata.presentation.view.fragment.MovieDetailFragment;

package com.xurxodev.moviesandroidkata.presentation.view.activity;



public class MovieDetailActivity extends AppCompatActivity {

    public static final String MOVIE_TITLE = "MovieTitle";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_detail);

        initializeToolBar();
        showUpButtonInActionBar();

        if (savedInstanceState == null) {
            showDetailFragment();
        }
    }

    private void showDetailFragment() {
        String movieTitle = (String) getIntent().getStringExtra(MovieDetailActivity.MOVIE_TITLE);

        Bundle arguments = new Bundle();
        arguments.putSerializable(MovieDetailActivity.MOVIE_TITLE, movieTitle);

        MovieDetailFragment fragment = new MovieDetailFragment();