// Path: app/src/main/java/org/kaerdan/mvp_navigation/example2_fragments/FragmentsArticleListActivity.java
// public class FragmentsArticleListActivity extends AppCompatActivity implements ArticleListContract.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 ArticleListFragment(), null)
//                     .commit();
//         }
//     }
// 
//     @NonNull
//     @Override
//     public ArticleListContract.Navigator getNavigator(final ArticleListContract.Presenter presenter) {
//         return new FragmentsArticleListNavigator(this);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example3_viewpager/ViewPagerActivity.java
// public class ViewPagerActivity extends AppCompatActivity implements ArticleListContract.NavigatorProvider,
//     FavoriteListContract.NavigatorProvider {
// 
//     private ViewPager mViewPager;
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_view_pager);
// 
//         mViewPager = (ViewPager) findViewById(R.id.container);
//         mViewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
//         ((TabLayout) findViewById(R.id.tabs)).setupWithViewPager(mViewPager);
//     }
// 
//     @NonNull
//     @Override
//     public ArticleListContract.Navigator getNavigator(final ArticleListContract.Presenter presenter) {
//         return new ViewPagerArticleListNavigator(this, mViewPager);
//     }
// 
//     @NonNull
//     @Override
//     public FavoriteListContract.Navigator getNavigator(final FavoriteListContract.Presenter presenter) {
//         return new ViewPagerFavoriteListNavigator(this);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example4_injection/InjectArticleListActivity.java
// public class InjectArticleListActivity extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_single_fragment);
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .add(R.id.content_frame, new InjectArticleListFragment(), null)
//                     .commit();
//         }
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example5_retainpresenter/RetainPresenterArticleListActivity.java
// public class RetainPresenterArticleListActivity extends PresenterActivity
//         implements RetainPresenterArticleListContract.NavigatorProvider {
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_single_fragment);
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .add(R.id.content_frame, new RetainPresenterArticleListFragment(), null)
//                     .commit();
//         }
//     }
// 
//     @NonNull
//     @Override
//     public RetainPresenterArticleListContract.Navigator getNavigator(
//             final RetainPresenterArticleListContract.Presenter presenter) {
//         return new RetainPresenterActivityNavigator(this);
//     }
// }


import android.support.annotation.NonNull;
import java.util.Arrays;
import java.util.List;
import org.kaerdan.mvp_navigation.example2_fragments.FragmentsArticleListActivity;
import org.kaerdan.mvp_navigation.example3_viewpager.ViewPagerActivity;
import org.kaerdan.mvp_navigation.example4_injection.InjectArticleListActivity;
import org.kaerdan.mvp_navigation.example5_retainpresenter.RetainPresenterArticleListActivity;
package org.kaerdan.mvp_navigation;




public class MainPresenter implements MainContract.Presenter {

    private final List<Integer> mStringIdList = Arrays.asList(R.string.example1_title, R.string.example2_title,
            R.string.example3_title, R.string.example4_title, R.string.example5_title);

    private final List<Class<?>> mActivityClsList = Arrays.<Class<?>>asList(
            org.kaerdan.mvp_navigation.example1_activities.ArticleListActivity.class,
            FragmentsArticleListActivity.class, ViewPagerActivity.class, InjectArticleListActivity.class,
            RetainPresenterArticleListActivity.class);

    private MainContract.View mView;
    private MainContract.Navigator mNavigator;

    public void onAttachView(final MainContract.View view) {
        mView = view;
        view.displayButtons(mStringIdList);
    }

    public void onDetachView() {
        this.mView = null;
    }

    @Override
    public void onButtonFromListClicked(final int position) {
        mNavigator.launchActivity(mActivityClsList.get(position));
    }

    @Override
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example2_fragments/FragmentsArticleListActivity.java
// public class FragmentsArticleListActivity extends AppCompatActivity implements ArticleListContract.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 ArticleListFragment(), null)
//                     .commit();
//         }
//     }
// 
//     @NonNull
//     @Override
//     public ArticleListContract.Navigator getNavigator(final ArticleListContract.Presenter presenter) {
//         return new FragmentsArticleListNavigator(this);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example3_viewpager/ViewPagerActivity.java
// public class ViewPagerActivity extends AppCompatActivity implements ArticleListContract.NavigatorProvider,
//     FavoriteListContract.NavigatorProvider {
// 
//     private ViewPager mViewPager;
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_view_pager);
// 
//         mViewPager = (ViewPager) findViewById(R.id.container);
//         mViewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
//         ((TabLayout) findViewById(R.id.tabs)).setupWithViewPager(mViewPager);
//     }
// 
//     @NonNull
//     @Override
//     public ArticleListContract.Navigator getNavigator(final ArticleListContract.Presenter presenter) {
//         return new ViewPagerArticleListNavigator(this, mViewPager);
//     }
// 
//     @NonNull
//     @Override
//     public FavoriteListContract.Navigator getNavigator(final FavoriteListContract.Presenter presenter) {
//         return new ViewPagerFavoriteListNavigator(this);
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example4_injection/InjectArticleListActivity.java
// public class InjectArticleListActivity extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_single_fragment);
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .add(R.id.content_frame, new InjectArticleListFragment(), null)
//                     .commit();
//         }
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/example5_retainpresenter/RetainPresenterArticleListActivity.java
// public class RetainPresenterArticleListActivity extends PresenterActivity
//         implements RetainPresenterArticleListContract.NavigatorProvider {
// 
//     @Override
//     protected void onCreate(final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_single_fragment);
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .add(R.id.content_frame, new RetainPresenterArticleListFragment(), null)
//                     .commit();
//         }
//     }
// 
//     @NonNull
//     @Override
//     public RetainPresenterArticleListContract.Navigator getNavigator(
//             final RetainPresenterArticleListContract.Presenter presenter) {
//         return new RetainPresenterActivityNavigator(this);
//     }
// }


// Path: app/src/main/java/org/kaerdan/mvp_navigation/MainPresenter.java
import android.support.annotation.NonNull;
import java.util.Arrays;
import java.util.List;
import org.kaerdan.mvp_navigation.example2_fragments.FragmentsArticleListActivity;
import org.kaerdan.mvp_navigation.example3_viewpager.ViewPagerActivity;
import org.kaerdan.mvp_navigation.example4_injection.InjectArticleListActivity;
import org.kaerdan.mvp_navigation.example5_retainpresenter.RetainPresenterArticleListActivity;

package org.kaerdan.mvp_navigation;




public class MainPresenter implements MainContract.Presenter {

    private final List<Integer> mStringIdList = Arrays.asList(R.string.example1_title, R.string.example2_title,
            R.string.example3_title, R.string.example4_title, R.string.example5_title);

    private final List<Class<?>> mActivityClsList = Arrays.<Class<?>>asList(
            org.kaerdan.mvp_navigation.example1_activities.ArticleListActivity.class,
            FragmentsArticleListActivity.class, ViewPagerActivity.class, InjectArticleListActivity.class,
            RetainPresenterArticleListActivity.class);

    private MainContract.View mView;
    private MainContract.Navigator mNavigator;

    public void onAttachView(final MainContract.View view) {
        mView = view;
        view.displayButtons(mStringIdList);
    }

    public void onDetachView() {
        this.mView = null;
    }

    @Override
    public void onButtonFromListClicked(final int position) {
        mNavigator.launchActivity(mActivityClsList.get(position));
    }

    @Override
    public void setNavigator(@NonNull final MainContract.Navigator navigator) {