package com.sheep.gamegroup.view.activity;

import android.support.v7.widget.RecyclerView;

import com.sheep.gamegroup.absBase.BaseListActivity2;
import com.sheep.gamegroup.model.api.ApiService;
import com.sheep.gamegroup.model.entity.BaseMessage;
import com.sheep.gamegroup.model.entity.GameEntity;
import com.sheep.gamegroup.model.entity.GameListType;
import com.sheep.gamegroup.util.DataUtil;
import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

import io.reactivex.Observable;

/**
 * Created by realicing on 2018/10/31.
 * realicing@sina.com
 * 猜你喜欢游戏列表
 */
public class ActPlayGameUserLikeList extends BaseListActivity2<GameEntity> {

    @Override
    public void initView() {
        GameListType gameListType = DataUtil.getObject(getIntent(), GameListType.class);
        TitleBarUtils
                .getInstance()
                .setShowOrHide(this, true)
                .setTitle(this, gameListType.getTitle())
                .setTitleFinish(this);
    }
    @Override
    protected RecyclerView.Adapter getAdapter() {
        return new PlayGameItemAdapter(this, list);
    }

    @Override
    protected String getKey(int page, int per_page) {
        return "app/find/recommend/user_like";
    }

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

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

    @Override
    public void notifyDataSetChanged() {
        if(!list.isEmpty())
            setNoMore(true);
        super.notifyDataSetChanged();
    }
}
