// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/data/Article.java
// public class Article {
//     private final int id;
//     private final String title;
//     private final String body;
//     private final boolean isFavourite;
// 
//     public Article(int id, String title, String body, boolean isFavourite) {
//         this.id = id;
//         this.title = title;
//         this.body = body;
//         this.isFavourite = isFavourite;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public String getBody() {
//         return body;
//     }
// 
//     public boolean isFavourite() {
//         return isFavourite;
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/data/DataProvider.java
// public class DataProvider {
// 
//     private static final Article ARTICLE_1 = new Article(1, "Article 1", "Article 1 body", false);
//     private static final Article ARTICLE_2 = new Article(2, "Article 2", "Article 2 body", true);
//     private static final Article ARTICLE_3 = new Article(3, "Article 3", "Article 3 body", false);
//     private static final Article ARTICLE_4 = new Article(4, "Article 4", "Article 4 body", true);
//     private static final Article ARTICLE_5 = new Article(5, "Article 5", "Article 5 body", false);
//     private static final Article ARTICLE_6 = new Article(6, "Article 6", "Article 6 body", true);
//     private static final Article ARTICLE_7 = new Article(7, "Article 7", "Article 7 body", false);
//     private static final Article ARTICLE_8 = new Article(8, "Article 8", "Article 8 body", true);
//     private static final Article ARTICLE_9 = new Article(9, "Article 9", "Article 9 body", false);
//     private static final Article ARTICLE_10 = new Article(10, "Article 10", "Article 10 body", true);
// 
//     private static DataProvider sInstance = new DataProvider();
// 
//     public static DataProvider getInstance() {
//         return sInstance;
//     }
// 
//     private final List<Article> mArticles;
// 
//     private DataProvider() {
//         mArticles = Arrays.asList(ARTICLE_1, ARTICLE_2, ARTICLE_3, ARTICLE_4, ARTICLE_5, ARTICLE_6, ARTICLE_7,
//                 ARTICLE_8, ARTICLE_9, ARTICLE_10);
//     }
// 
//     public List<Article> getmArticles() {
//         return mArticles;
//     }
// 
//     public List<Article> getFavouriteArticles() {
//         List<Article> favouriteArticles = new ArrayList<>();
//         for (Article article : mArticles) {
//             if (article.isFavourite()) {
//                 favouriteArticles.add(article);
//             }
//         }
// 
//         return favouriteArticles;
//     }
// 
//     @Nullable
//     public Article getArticleById(final int id) {
//         for (Article article : mArticles) {
//             if (id == article.getId()) {
//                 return article;
//             }
//         }
// 
//         return null;
//     }
// }


import org.kaerdan.mvp_navigation.core.data.Article;
import org.kaerdan.mvp_navigation.core.data.DataProvider;
package org.kaerdan.mvp_navigation.core.ui.article;


public class ArticlePresenter implements ArticleContract.Presenter {

    private final int mArticleId;
    private ArticleContract.View mView;

    public ArticlePresenter(final int articleId) {
        this.mArticleId = articleId;
    }

    @Override
    public void onAttachView(final ArticleContract.View view) {
        this.mView = view;

        // Usually this call goes asynchronous but for this example it doesn't matter
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/data/Article.java
// public class Article {
//     private final int id;
//     private final String title;
//     private final String body;
//     private final boolean isFavourite;
// 
//     public Article(int id, String title, String body, boolean isFavourite) {
//         this.id = id;
//         this.title = title;
//         this.body = body;
//         this.isFavourite = isFavourite;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public String getBody() {
//         return body;
//     }
// 
//     public boolean isFavourite() {
//         return isFavourite;
//     }
// }
// 
// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/data/DataProvider.java
// public class DataProvider {
// 
//     private static final Article ARTICLE_1 = new Article(1, "Article 1", "Article 1 body", false);
//     private static final Article ARTICLE_2 = new Article(2, "Article 2", "Article 2 body", true);
//     private static final Article ARTICLE_3 = new Article(3, "Article 3", "Article 3 body", false);
//     private static final Article ARTICLE_4 = new Article(4, "Article 4", "Article 4 body", true);
//     private static final Article ARTICLE_5 = new Article(5, "Article 5", "Article 5 body", false);
//     private static final Article ARTICLE_6 = new Article(6, "Article 6", "Article 6 body", true);
//     private static final Article ARTICLE_7 = new Article(7, "Article 7", "Article 7 body", false);
//     private static final Article ARTICLE_8 = new Article(8, "Article 8", "Article 8 body", true);
//     private static final Article ARTICLE_9 = new Article(9, "Article 9", "Article 9 body", false);
//     private static final Article ARTICLE_10 = new Article(10, "Article 10", "Article 10 body", true);
// 
//     private static DataProvider sInstance = new DataProvider();
// 
//     public static DataProvider getInstance() {
//         return sInstance;
//     }
// 
//     private final List<Article> mArticles;
// 
//     private DataProvider() {
//         mArticles = Arrays.asList(ARTICLE_1, ARTICLE_2, ARTICLE_3, ARTICLE_4, ARTICLE_5, ARTICLE_6, ARTICLE_7,
//                 ARTICLE_8, ARTICLE_9, ARTICLE_10);
//     }
// 
//     public List<Article> getmArticles() {
//         return mArticles;
//     }
// 
//     public List<Article> getFavouriteArticles() {
//         List<Article> favouriteArticles = new ArrayList<>();
//         for (Article article : mArticles) {
//             if (article.isFavourite()) {
//                 favouriteArticles.add(article);
//             }
//         }
// 
//         return favouriteArticles;
//     }
// 
//     @Nullable
//     public Article getArticleById(final int id) {
//         for (Article article : mArticles) {
//             if (id == article.getId()) {
//                 return article;
//             }
//         }
// 
//         return null;
//     }
// }


// Path: app/src/main/java/org/kaerdan/mvp_navigation/core/ui/article/ArticlePresenter.java
import org.kaerdan.mvp_navigation.core.data.Article;
import org.kaerdan.mvp_navigation.core.data.DataProvider;

package org.kaerdan.mvp_navigation.core.ui.article;


public class ArticlePresenter implements ArticleContract.Presenter {

    private final int mArticleId;
    private ArticleContract.View mView;

    public ArticlePresenter(final int articleId) {
        this.mArticleId = articleId;
    }

    @Override
    public void onAttachView(final ArticleContract.View view) {
        this.mView = view;

        // Usually this call goes asynchronous but for this example it doesn't matter
        Article article = DataProvider.getInstance().getArticleById(mArticleId);