// Path: app/src/main/java/com/lqr/biliblili/mvp/contract/RecommendContract.java
// public interface RecommendContract {
// 
//     interface View extends IView {
// 
//         void setRecyclerAdapter(RecommendMultiItemAdapter adapter);
// 
//         void recyclerScrollToPosition(int position);
//     }
// 
//     interface Model extends IModel {
//         /**
//          * @param idx        下拉刷新时取第一个数据的idx，上拉加载更多时取最后一个数据的idx
//          * @param refresh    下拉刷新时取"true"，上拉加载更多时取"false"
//          * @param clearCache 第一次加载数据时为true，其他时候为false(对应的true时，login_event的值为1[获取banner]，为false时，login_event的值为0)
//          * @return
//          */
//         Observable<IndexData> getRecommendIndexData(int idx, boolean refresh, boolean clearCache);
// 
//         List<RecommendMultiItem> parseIndexData(IndexData indexData);
// 
//     }
// }
// 
// Path: app/src/main/java/com/lqr/biliblili/mvp/model/RecommendModel.java
// @FragmentScope
// public class RecommendModel extends BaseModel implements RecommendContract.Model {
// 
//     private boolean isOdd = true;
//     private Gson mGson;
//     private Application mApplication;
// 
//     @Inject
//     public RecommendModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
//         super(repositoryManager);
//         mGson = gson;
//         mApplication = application;
//         RetrofitUrlManager.getInstance().putDomain("recommend", Api.RECOMMEND_BASE_URL);
//     }
// 
// 
//     @Override
//     public void onDestroy() {
//         super.onDestroy();
//         this.mGson = null;
//         this.mApplication = null;
//     }
// 
//     @Override
//     public Observable<IndexData> getRecommendIndexData(int idx, boolean refresh, boolean clearCache) {
//         return Observable.just(mRepositoryManager
//                 .obtainRetrofitService(RecommendService.class)
//                 .getRecommendIndexData(idx, refresh ? "true" : "false", clearCache ? 1 : 0))
//                 .flatMap(new Function<Observable<IndexData>, ObservableSource<IndexData>>() {
//                     @Override
//                     public ObservableSource<IndexData> apply(@NonNull Observable<IndexData> indexDataObservable) throws Exception {
//                         return mRepositoryManager
//                                 .obtainCacheService(RecommendCache.class)
//                                 .getRecommendIndexData(indexDataObservable, new DynamicKey(idx), new EvictProvider(clearCache))
//                                 .map(indexDataReply -> indexDataReply.getData());
//                     }
//                 });
//     }
// 
// 
//     @Override
//     public List<RecommendMultiItem> parseIndexData(IndexData indexData) {
//         List<RecommendMultiItem> list = new ArrayList<>();
//         List<IndexData.DataBean> data = indexData.getData();
//         if (data != null) {
//             for (int i = 0; i < data.size(); i++) {
//                 IndexData.DataBean dataBean = data.get(i);
//                 if (dataBean != null) {
//                     String gotoX = dataBean.getGotoX();
//                     if (RecommendMultiItem.isWeNeed(gotoX)) {
//                         RecommendMultiItem item = new RecommendMultiItem();
//                         item.setItemTypeWithGoto(gotoX, dataBean.getRcmd_reason() == null);
//                         item.setIndexDataBean(dataBean);
//                         if (RecommendMultiItem.isItemData(gotoX)) {
//                             item.setOdd(isOdd);
//                             isOdd = !isOdd;
//                         } else {
//                             isOdd = true;
//                         }
//                         list.add(item);
//                     }
//                 }
//             }
//         }
//         return list;
//     }
// }


import com.jess.arms.di.scope.FragmentScope;
import com.lqr.biliblili.mvp.contract.RecommendContract;
import com.lqr.biliblili.mvp.model.RecommendModel;
import dagger.Module;
import dagger.Provides;
package com.lqr.biliblili.di.module;



@Module
public class RecommendModule {

    private RecommendContract.View view;

    public RecommendModule(RecommendContract.View view) {
        this.view = view;
    }

    @FragmentScope
    @Provides
    public RecommendContract.View provideView() {
        return view;
    }

    @FragmentScope
    @Provides
    public RecommendContract.Model provideModel(RecommendModel model) {
// Path: app/src/main/java/com/lqr/biliblili/mvp/contract/RecommendContract.java
// public interface RecommendContract {
// 
//     interface View extends IView {
// 
//         void setRecyclerAdapter(RecommendMultiItemAdapter adapter);
// 
//         void recyclerScrollToPosition(int position);
//     }
// 
//     interface Model extends IModel {
//         /**
//          * @param idx        下拉刷新时取第一个数据的idx，上拉加载更多时取最后一个数据的idx
//          * @param refresh    下拉刷新时取"true"，上拉加载更多时取"false"
//          * @param clearCache 第一次加载数据时为true，其他时候为false(对应的true时，login_event的值为1[获取banner]，为false时，login_event的值为0)
//          * @return
//          */
//         Observable<IndexData> getRecommendIndexData(int idx, boolean refresh, boolean clearCache);
// 
//         List<RecommendMultiItem> parseIndexData(IndexData indexData);
// 
//     }
// }
// 
// Path: app/src/main/java/com/lqr/biliblili/mvp/model/RecommendModel.java
// @FragmentScope
// public class RecommendModel extends BaseModel implements RecommendContract.Model {
// 
//     private boolean isOdd = true;
//     private Gson mGson;
//     private Application mApplication;
// 
//     @Inject
//     public RecommendModel(IRepositoryManager repositoryManager, Gson gson, Application application) {
//         super(repositoryManager);
//         mGson = gson;
//         mApplication = application;
//         RetrofitUrlManager.getInstance().putDomain("recommend", Api.RECOMMEND_BASE_URL);
//     }
// 
// 
//     @Override
//     public void onDestroy() {
//         super.onDestroy();
//         this.mGson = null;
//         this.mApplication = null;
//     }
// 
//     @Override
//     public Observable<IndexData> getRecommendIndexData(int idx, boolean refresh, boolean clearCache) {
//         return Observable.just(mRepositoryManager
//                 .obtainRetrofitService(RecommendService.class)
//                 .getRecommendIndexData(idx, refresh ? "true" : "false", clearCache ? 1 : 0))
//                 .flatMap(new Function<Observable<IndexData>, ObservableSource<IndexData>>() {
//                     @Override
//                     public ObservableSource<IndexData> apply(@NonNull Observable<IndexData> indexDataObservable) throws Exception {
//                         return mRepositoryManager
//                                 .obtainCacheService(RecommendCache.class)
//                                 .getRecommendIndexData(indexDataObservable, new DynamicKey(idx), new EvictProvider(clearCache))
//                                 .map(indexDataReply -> indexDataReply.getData());
//                     }
//                 });
//     }
// 
// 
//     @Override
//     public List<RecommendMultiItem> parseIndexData(IndexData indexData) {
//         List<RecommendMultiItem> list = new ArrayList<>();
//         List<IndexData.DataBean> data = indexData.getData();
//         if (data != null) {
//             for (int i = 0; i < data.size(); i++) {
//                 IndexData.DataBean dataBean = data.get(i);
//                 if (dataBean != null) {
//                     String gotoX = dataBean.getGotoX();
//                     if (RecommendMultiItem.isWeNeed(gotoX)) {
//                         RecommendMultiItem item = new RecommendMultiItem();
//                         item.setItemTypeWithGoto(gotoX, dataBean.getRcmd_reason() == null);
//                         item.setIndexDataBean(dataBean);
//                         if (RecommendMultiItem.isItemData(gotoX)) {
//                             item.setOdd(isOdd);
//                             isOdd = !isOdd;
//                         } else {
//                             isOdd = true;
//                         }
//                         list.add(item);
//                     }
//                 }
//             }
//         }
//         return list;
//     }
// }


// Path: app/src/main/java/com/lqr/biliblili/di/module/RecommendModule.java
import com.jess.arms.di.scope.FragmentScope;
import com.lqr.biliblili.mvp.contract.RecommendContract;
import com.lqr.biliblili.mvp.model.RecommendModel;
import dagger.Module;
import dagger.Provides;

package com.lqr.biliblili.di.module;



@Module
public class RecommendModule {

    private RecommendContract.View view;

    public RecommendModule(RecommendContract.View view) {
        this.view = view;
    }

    @FragmentScope
    @Provides
    public RecommendContract.View provideView() {
        return view;
    }

    @FragmentScope
    @Provides
    public RecommendContract.Model provideModel(RecommendModel model) {
        return model;