package com.sheep.gamegroup.view.fragment;

import android.support.v7.widget.RecyclerView;

import com.sheep.gamegroup.model.api.ApiService;
import com.sheep.gamegroup.model.entity.BaseMessage;
import com.sheep.gamegroup.model.entity.EveryDayShare;
import com.sheep.gamegroup.util.ListUtil;
import com.sheep.gamegroup.view.adapter.AdpEveryDayShare;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

import org.afinal.simplecache.ApiKey;

import java.util.List;

import io.reactivex.Observable;

/**
 * Created by realicing on 2018/11/23.
 * realicing@sina.com
 * 小绵羊3.4.5新增--每日分享
 */
public class FgtEveryDayShare extends BaseListFragment2<EveryDayShare>{

    @Override
    public void initView() {
        TitleBarUtils.getInstance()
                .setShowOrHide(getActivity(), true)
                .setTitle(getActivity(), "每日分享")
                .setTitleFinish(getActivity());
        view_list.setLoadingMoreEnabled(false);
    }

    @Override
    protected RecyclerView.Adapter getAdapter() {
        return new AdpEveryDayShare(getActivity(), list);
    }

    @Override
    protected String getKey(int page, int per_page) {
        return ApiKey.getShareList;
    }

    @Override
    protected Observable<BaseMessage> getApi(ApiService apiService) {
        return apiService.getShareList();
    }

    @Override
    protected Class<EveryDayShare> getTClass() {
        return EveryDayShare.class;
    }

    @Override
    public void loadList(List<EveryDayShare> addList) {
        addList.add(0, new EveryDayShare());
        super.loadList(addList);
    }

}
