// Path: ferro-mvp/src/main/java/com/agna/ferro/mvp/component/ScreenComponent.java
// public interface ScreenComponent<V extends BaseView> {
//     void inject(V view);
// }
// 
// Path: ferro-mvp/src/main/java/com/agna/ferro/mvp/presenter/MvpPresenter.java
// public class MvpPresenter<V extends BaseView> implements
//         PersistentScreenScope.OnScopeDestroyListener {
// 
//     private V view;
// 
//     public void attachView(V view) {
//         this.view = view;
//     }
// 
//     /**
//      * @return screen's view
//      */
//     protected V getView() {
//         return view;
//     }
// 
//     /**
//      * This method is called, when view is ready
//      * @param viewRecreated - show whether view created in first time or recreated after
//      *                        changing configuration
//      */
//     public void onLoad(boolean viewRecreated) {
//     }
// 
//     /**
//      * Called after {@link this#onLoad}
//      */
//     public void onLoadFinished() {
// 
//     }
// 
//     /**
//      * Called when view is started
//      */
//     public void onStart(){
// 
//     }
// 
//     /**
//      * Called when view is resumed
//      */
//     public void onResume(){
// 
//     }
// 
//     /**
//      * Called when view is paused
//      */
//     public void onPause(){
// 
//     }
// 
//     /**
//      * Called when view is stopped
//      */
//     public void onStop(){
// 
//     }
// 
//     public final void detachView() {
//         view = null;
//         onViewDetached();
//     }
// 
//     /**
//      * Called when view is detached
//      */
//     protected void onViewDetached() {
// 
//     }
// 
//     /**
//      * Called when screen is finally destroyed
//      */
//     public void onDestroy() {
// 
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/domain/Book.java
// public class Book {
//     private String id;
//     private String name;
//     private int downloadProgress;
//     private String imageUrl;
// 
//     public Book(String id, String name, String imageUrl) {
//         this.id = id;
//         this.name = name;
//         this.imageUrl = imageUrl;
//         this.downloadProgress = -1;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getImageUrl() {
//         return imageUrl;
//     }
// 
//     public boolean isDownloaded() {
//         return downloadProgress == 100;
//     }
// 
//     public boolean isDownloading() {
//         return downloadProgress >= 0;
//     }
// 
//     public int getDownloadProgress() {
//         return downloadProgress;
//     }
// 
//     public void setDownloadProgress(int downloadProgress) {
//         this.downloadProgress = downloadProgress;
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/base/BaseActivityView.java
// public abstract class BaseActivityView extends MvpActivityView {
// 
//     protected AppComponent getAppComponent() {
//         return ((App) getApplication()).getAppComponent();
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/common/dagger/ActivityModule.java
// @Module
// public class ActivityModule {
// 
//     private PersistentScreenScope persistentScreenScope;
// 
//     public ActivityModule(PersistentScreenScope persistentScreenScope) {
//         this.persistentScreenScope = persistentScreenScope;
//     }
// 
//     @Provides
//     @PerScreen
//     ActivityProvider provideActivityProvider() {
//         return new ActivityProvider(persistentScreenScope);
//     }
// 
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/screen/catalog/grid/BookItemListener.java
// public interface BookItemListener {
//     void onDownloadClick(Book book);
//     void onReadClick(Book book);
//     void onClick(Book book);
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/screen/catalog/grid/BooksAdapter.java
// public class BooksAdapter extends RecyclerView.Adapter<BookHolder> {
// 
//     private List<Book> books = new ArrayList<>();
//     private final BookItemListener itemListener;
// 
//     public BooksAdapter(BookItemListener bookItemListener) {
//         this.itemListener = bookItemListener;
//     }
// 
//     @Override
//     public BookHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         return BookHolder.newInstance(parent, itemListener);
//     }
// 
//     @Override
//     public void onBindViewHolder(BookHolder holder, int position) {
//         holder.bind(books.get(position));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return books.size();
//     }
// 
//     public void updateBooksData(List<Book> books) {
//         this.books = books;
//     }
// }


import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import com.agna.ferro.mvp.component.ScreenComponent;
import com.agna.ferro.mvp.presenter.MvpPresenter;
import com.agna.ferro.sample.R;
import com.agna.ferro.sample.domain.Book;
import com.agna.ferro.sample.ui.base.BaseActivityView;
import com.agna.ferro.sample.ui.common.dagger.ActivityModule;
import com.agna.ferro.sample.ui.screen.catalog.grid.BookItemListener;
import com.agna.ferro.sample.ui.screen.catalog.grid.BooksAdapter;
import java.util.List;
import javax.inject.Inject;
package com.agna.ferro.sample.ui.screen.catalog;





/**
 * view for Catalog screen
 */
public class CatalogActivityView extends BaseActivityView {

    @Inject
    CatalogPresenter presenter;

    private Handler handler = new Handler();
    private SwipeRefreshLayout swipeRefreshLayout;
    private RecyclerView booksRw;
    private BooksAdapter adapter;

    @Override
    protected int getContentView() {
        return R.layout.activity_catalog;
    }

    @Override
    protected ScreenComponent createScreenComponent() {
        //creating Screen Component, you needn't call ScreenComponent#inject(this)
        return DaggerCatalogScreenComponent.builder()
                .appComponent(getAppComponent())
// Path: ferro-mvp/src/main/java/com/agna/ferro/mvp/component/ScreenComponent.java
// public interface ScreenComponent<V extends BaseView> {
//     void inject(V view);
// }
// 
// Path: ferro-mvp/src/main/java/com/agna/ferro/mvp/presenter/MvpPresenter.java
// public class MvpPresenter<V extends BaseView> implements
//         PersistentScreenScope.OnScopeDestroyListener {
// 
//     private V view;
// 
//     public void attachView(V view) {
//         this.view = view;
//     }
// 
//     /**
//      * @return screen's view
//      */
//     protected V getView() {
//         return view;
//     }
// 
//     /**
//      * This method is called, when view is ready
//      * @param viewRecreated - show whether view created in first time or recreated after
//      *                        changing configuration
//      */
//     public void onLoad(boolean viewRecreated) {
//     }
// 
//     /**
//      * Called after {@link this#onLoad}
//      */
//     public void onLoadFinished() {
// 
//     }
// 
//     /**
//      * Called when view is started
//      */
//     public void onStart(){
// 
//     }
// 
//     /**
//      * Called when view is resumed
//      */
//     public void onResume(){
// 
//     }
// 
//     /**
//      * Called when view is paused
//      */
//     public void onPause(){
// 
//     }
// 
//     /**
//      * Called when view is stopped
//      */
//     public void onStop(){
// 
//     }
// 
//     public final void detachView() {
//         view = null;
//         onViewDetached();
//     }
// 
//     /**
//      * Called when view is detached
//      */
//     protected void onViewDetached() {
// 
//     }
// 
//     /**
//      * Called when screen is finally destroyed
//      */
//     public void onDestroy() {
// 
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/domain/Book.java
// public class Book {
//     private String id;
//     private String name;
//     private int downloadProgress;
//     private String imageUrl;
// 
//     public Book(String id, String name, String imageUrl) {
//         this.id = id;
//         this.name = name;
//         this.imageUrl = imageUrl;
//         this.downloadProgress = -1;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getImageUrl() {
//         return imageUrl;
//     }
// 
//     public boolean isDownloaded() {
//         return downloadProgress == 100;
//     }
// 
//     public boolean isDownloading() {
//         return downloadProgress >= 0;
//     }
// 
//     public int getDownloadProgress() {
//         return downloadProgress;
//     }
// 
//     public void setDownloadProgress(int downloadProgress) {
//         this.downloadProgress = downloadProgress;
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/base/BaseActivityView.java
// public abstract class BaseActivityView extends MvpActivityView {
// 
//     protected AppComponent getAppComponent() {
//         return ((App) getApplication()).getAppComponent();
//     }
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/common/dagger/ActivityModule.java
// @Module
// public class ActivityModule {
// 
//     private PersistentScreenScope persistentScreenScope;
// 
//     public ActivityModule(PersistentScreenScope persistentScreenScope) {
//         this.persistentScreenScope = persistentScreenScope;
//     }
// 
//     @Provides
//     @PerScreen
//     ActivityProvider provideActivityProvider() {
//         return new ActivityProvider(persistentScreenScope);
//     }
// 
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/screen/catalog/grid/BookItemListener.java
// public interface BookItemListener {
//     void onDownloadClick(Book book);
//     void onReadClick(Book book);
//     void onClick(Book book);
// }
// 
// Path: sample/src/main/java/com/agna/ferro/sample/ui/screen/catalog/grid/BooksAdapter.java
// public class BooksAdapter extends RecyclerView.Adapter<BookHolder> {
// 
//     private List<Book> books = new ArrayList<>();
//     private final BookItemListener itemListener;
// 
//     public BooksAdapter(BookItemListener bookItemListener) {
//         this.itemListener = bookItemListener;
//     }
// 
//     @Override
//     public BookHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         return BookHolder.newInstance(parent, itemListener);
//     }
// 
//     @Override
//     public void onBindViewHolder(BookHolder holder, int position) {
//         holder.bind(books.get(position));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return books.size();
//     }
// 
//     public void updateBooksData(List<Book> books) {
//         this.books = books;
//     }
// }


// Path: sample/src/main/java/com/agna/ferro/sample/ui/screen/catalog/CatalogActivityView.java
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import com.agna.ferro.mvp.component.ScreenComponent;
import com.agna.ferro.mvp.presenter.MvpPresenter;
import com.agna.ferro.sample.R;
import com.agna.ferro.sample.domain.Book;
import com.agna.ferro.sample.ui.base.BaseActivityView;
import com.agna.ferro.sample.ui.common.dagger.ActivityModule;
import com.agna.ferro.sample.ui.screen.catalog.grid.BookItemListener;
import com.agna.ferro.sample.ui.screen.catalog.grid.BooksAdapter;
import java.util.List;
import javax.inject.Inject;

package com.agna.ferro.sample.ui.screen.catalog;





/**
 * view for Catalog screen
 */
public class CatalogActivityView extends BaseActivityView {

    @Inject
    CatalogPresenter presenter;

    private Handler handler = new Handler();
    private SwipeRefreshLayout swipeRefreshLayout;
    private RecyclerView booksRw;
    private BooksAdapter adapter;

    @Override
    protected int getContentView() {
        return R.layout.activity_catalog;
    }

    @Override
    protected ScreenComponent createScreenComponent() {
        //creating Screen Component, you needn't call ScreenComponent#inject(this)
        return DaggerCatalogScreenComponent.builder()
                .appComponent(getAppComponent())
                .activityModule(new ActivityModule(getPersistentScreenScope()))