// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/favorite_list/FavoriteListContract.java
// public interface FavoriteListContract {
//     interface Presenter extends org.kaerdan.mvp_navigation.core.Presenter<View> {
//         void setNavigator(@NonNull Navigator navigator);
//     }
// 
//     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);
//     }
// 
//     interface NavigatorProvider {
// 
//         @NonNull
//         Navigator getNavigator(FavoriteListContract.Presenter presenter);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/favorite_list/FavoriteListFragment.java
// public class FavoriteListFragment extends Fragment implements FavoriteListContract.View {
// 
//     private FavoriteListContract.Presenter mPresenter;
// 
//     private RecyclerView mRecyclerView;
// 
//     public FavoriteListFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
//             final Bundle savedInstanceState) {
//         mPresenter = createPresenter();
// 
//         // Inflate the layout for this fragment
//         mRecyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_favorite_article_list, container, false);
//         mRecyclerView.setLayoutManager(new LinearLayoutManager(container.getContext(), LinearLayoutManager.VERTICAL,
//                 false));
//         return mRecyclerView;
//     }
// 
//     @NonNull
//     protected FavoriteListContract.Presenter createPresenter() {
//         FavoriteListContract.Presenter presenter = new FavoriteListPresenter();
//         presenter.setNavigator(getNavigator(presenter));
//         return presenter;
//     }
// 
//     @NonNull
//     protected FavoriteListContract.Navigator getNavigator(final FavoriteListContract.Presenter presenter) {
//         Fragment parentFragment = getParentFragment();
//         if (parentFragment != null && parentFragment instanceof FavoriteListContract.NavigatorProvider) {
//             return ((FavoriteListContract.NavigatorProvider) parentFragment).getNavigator(presenter);
//         } else {
//             Activity activity = getActivity();
//             if (activity instanceof FavoriteListContract.NavigatorProvider) {
//                 return ((FavoriteListContract.NavigatorProvider) activity).getNavigator(presenter);
//             }
//         }
// 
//         throw new IllegalStateException("Activity or parent Fragment must implement "
//                 + "FavoriteListContract.NavigatorProvider");
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         mPresenter.onAttachView(this);
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
//         mPresenter.onDetachView();
//     }
// 
//     @Override
//     public void displayArticles(@NonNull final List<Article> articles,
//             @NonNull final OnArticleClickListener onArticleClickListener) {
//         mRecyclerView.setAdapter(new ArticleListAdapter(articles, onArticleClickListener));
//     }
// }


import org.kaerdan.mvp_navigation.R;
import org.kaerdan.mvp_navigation.core.ui.favorite_list.FavoriteListContract;
import org.kaerdan.mvp_navigation.core.ui.favorite_list.FavoriteListFragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
package org.kaerdan.mvp_navigation.example2_fragments;






public class FragmentsFavoriteListActivity extends AppCompatActivity implements FavoriteListContract.NavigatorProvider {

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/favorite_list/FavoriteListContract.java
// public interface FavoriteListContract {
//     interface Presenter extends org.kaerdan.mvp_navigation.core.Presenter<View> {
//         void setNavigator(@NonNull Navigator navigator);
//     }
// 
//     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);
//     }
// 
//     interface NavigatorProvider {
// 
//         @NonNull
//         Navigator getNavigator(FavoriteListContract.Presenter presenter);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/favorite_list/FavoriteListFragment.java
// public class FavoriteListFragment extends Fragment implements FavoriteListContract.View {
// 
//     private FavoriteListContract.Presenter mPresenter;
// 
//     private RecyclerView mRecyclerView;
// 
//     public FavoriteListFragment() {
//         // Required empty public constructor
//     }
// 
//     @Override
//     public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
//             final Bundle savedInstanceState) {
//         mPresenter = createPresenter();
// 
//         // Inflate the layout for this fragment
//         mRecyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_favorite_article_list, container, false);
//         mRecyclerView.setLayoutManager(new LinearLayoutManager(container.getContext(), LinearLayoutManager.VERTICAL,
//                 false));
//         return mRecyclerView;
//     }
// 
//     @NonNull
//     protected FavoriteListContract.Presenter createPresenter() {
//         FavoriteListContract.Presenter presenter = new FavoriteListPresenter();
//         presenter.setNavigator(getNavigator(presenter));
//         return presenter;
//     }
// 
//     @NonNull
//     protected FavoriteListContract.Navigator getNavigator(final FavoriteListContract.Presenter presenter) {
//         Fragment parentFragment = getParentFragment();
//         if (parentFragment != null && parentFragment instanceof FavoriteListContract.NavigatorProvider) {
//             return ((FavoriteListContract.NavigatorProvider) parentFragment).getNavigator(presenter);
//         } else {
//             Activity activity = getActivity();
//             if (activity instanceof FavoriteListContract.NavigatorProvider) {
//                 return ((FavoriteListContract.NavigatorProvider) activity).getNavigator(presenter);
//             }
//         }
// 
//         throw new IllegalStateException("Activity or parent Fragment must implement "
//                 + "FavoriteListContract.NavigatorProvider");
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         mPresenter.onAttachView(this);
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
//         mPresenter.onDetachView();
//     }
// 
//     @Override
//     public void displayArticles(@NonNull final List<Article> articles,
//             @NonNull final OnArticleClickListener onArticleClickListener) {
//         mRecyclerView.setAdapter(new ArticleListAdapter(articles, onArticleClickListener));
//     }
// }


// Path: app/src/main/java/org/kaerdan/mvp_navigation/example2_fragments/FragmentsFavoriteListActivity.java
import org.kaerdan.mvp_navigation.R;
import org.kaerdan.mvp_navigation.core.ui.favorite_list.FavoriteListContract;
import org.kaerdan.mvp_navigation.core.ui.favorite_list.FavoriteListFragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

package org.kaerdan.mvp_navigation.example2_fragments;






public class FragmentsFavoriteListActivity extends AppCompatActivity implements FavoriteListContract.NavigatorProvider {

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.main_content, new FavoriteListFragment(), null)