// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/article/ArticleFragment.java
// public class ArticleFragment extends Fragment implements ArticleContract.View {
// 
//     private static final String ARTICLE_ID_TAG = "Article id";
// 
//     public static ArticleFragment newInstance(final int id) {
//         Bundle args = new Bundle();
//         args.putInt(ARTICLE_ID_TAG, id);
// 
//         ArticleFragment fragment = new ArticleFragment();
//         fragment.setArguments(args);
//         return fragment;
//     }
// 
//     private ArticleContract.Presenter mPresenter;
//     private TextView mArticleTextView;
// 
//     public ArticleFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
//             final Bundle savedInstanceState) {
// 
//         // Inflate the layout for this fragment
//         mPresenter = new ArticlePresenter(getArguments().getInt(ARTICLE_ID_TAG));
// 
//         View v = inflater.inflate(R.layout.fragment_article, container, false);
//         mArticleTextView = (TextView) v.findViewById(R.id.article_body);
//         return v;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         mPresenter.onAttachView(this);
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
//         mPresenter.onDetachView();
//     }
// 
//     @Override
//     public void displayArticle(@NonNull final Article article) {
//         mArticleTextView.setText(article.getBody());
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/article_list/ArticleListContract.java
// public interface ArticleListContract {
//     interface Presenter extends org.kaerdan.mvp_navigation.core.Presenter<View> {
//         void setNavigator(@NonNull Navigator navigator);
// 
//         void onFavoriteArticleClick();
//     }
// 
//     interface View extends org.kaerdan.mvp_navigation.core.Presenter.View {
//         void displayArticles(@NonNull List<Article> articles, @NonNull OnArticleClickListener onArticleClickListener);
//     }
// 
//     interface Navigator {
//         void openArticle(int id);
// 
//         void openFavoriteArticles();
//     }
// 
//     interface NavigatorProvider {
// 
//         @NonNull
//         Navigator getNavigator(ArticleListContract.Presenter presenter);
//     }
// }


import org.kaerdan.mvp_navigation.R;
import org.kaerdan.mvp_navigation.core.ui.article.ArticleFragment;
import org.kaerdan.mvp_navigation.core.ui.article_list.ArticleListContract;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
package org.kaerdan.mvp_navigation.example2_fragments;




public class FragmentsArticleListNavigator implements ArticleListContract.Navigator {

    private final AppCompatActivity mActivity;

    public FragmentsArticleListNavigator(final AppCompatActivity activity) {
        this.mActivity = activity;
    }

    @Override
    public void openArticle(final int id) {
        mActivity.getSupportFragmentManager()
                .beginTransaction()
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/article/ArticleFragment.java
// public class ArticleFragment extends Fragment implements ArticleContract.View {
// 
//     private static final String ARTICLE_ID_TAG = "Article id";
// 
//     public static ArticleFragment newInstance(final int id) {
//         Bundle args = new Bundle();
//         args.putInt(ARTICLE_ID_TAG, id);
// 
//         ArticleFragment fragment = new ArticleFragment();
//         fragment.setArguments(args);
//         return fragment;
//     }
// 
//     private ArticleContract.Presenter mPresenter;
//     private TextView mArticleTextView;
// 
//     public ArticleFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
//             final Bundle savedInstanceState) {
// 
//         // Inflate the layout for this fragment
//         mPresenter = new ArticlePresenter(getArguments().getInt(ARTICLE_ID_TAG));
// 
//         View v = inflater.inflate(R.layout.fragment_article, container, false);
//         mArticleTextView = (TextView) v.findViewById(R.id.article_body);
//         return v;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         mPresenter.onAttachView(this);
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
//         mPresenter.onDetachView();
//     }
// 
//     @Override
//     public void displayArticle(@NonNull final Article article) {
//         mArticleTextView.setText(article.getBody());
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/article_list/ArticleListContract.java
// public interface ArticleListContract {
//     interface Presenter extends org.kaerdan.mvp_navigation.core.Presenter<View> {
//         void setNavigator(@NonNull Navigator navigator);
// 
//         void onFavoriteArticleClick();
//     }
// 
//     interface View extends org.kaerdan.mvp_navigation.core.Presenter.View {
//         void displayArticles(@NonNull List<Article> articles, @NonNull OnArticleClickListener onArticleClickListener);
//     }
// 
//     interface Navigator {
//         void openArticle(int id);
// 
//         void openFavoriteArticles();
//     }
// 
//     interface NavigatorProvider {
// 
//         @NonNull
//         Navigator getNavigator(ArticleListContract.Presenter presenter);
//     }
// }


// Path: app/src/main/java/org/kaerdan/mvp_navigation/example2_fragments/FragmentsArticleListNavigator.java
import org.kaerdan.mvp_navigation.R;
import org.kaerdan.mvp_navigation.core.ui.article.ArticleFragment;
import org.kaerdan.mvp_navigation.core.ui.article_list.ArticleListContract;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;

package org.kaerdan.mvp_navigation.example2_fragments;




public class FragmentsArticleListNavigator implements ArticleListContract.Navigator {

    private final AppCompatActivity mActivity;

    public FragmentsArticleListNavigator(final AppCompatActivity activity) {
        this.mActivity = activity;
    }

    @Override
    public void openArticle(final int id) {
        mActivity.getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.secondary_content, ArticleFragment.newInstance(id), null)