Files
yusheng-android/moduleUtil/src/main/java/com/xscm/moduleutil/dialog/LotteryFragment.java
2025-10-24 17:55:15 +08:00

131 lines
3.8 KiB
Java

package com.xscm.moduleutil.dialog;
import android.os.Bundle;
import android.view.Choreographer;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
import com.xscm.moduleutil.databinding.DialogNewRankingXlhFragmentBinding;
import com.xscm.moduleutil.databinding.FframentDataBinding;
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryContacts;
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryPresenter;
import com.xscm.moduleutil.dialog.giftLottery.GiftRecordAdapte;
import com.xscm.moduleutil.dialog.giftLottery.NewGiftRecordAdapte;
import java.util.List;
public class LotteryFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FframentDataBinding> implements GiftLotteryContacts.View {
private int page=1;
private String roomId;
private int type=-1;
private GiftRecordAdapte giftRecordAdapte;
@Override
protected GiftLotteryPresenter bindPresenter() {
return new GiftLotteryPresenter(this,getSelfActivity());
}
public static LotteryFragment newInstance(String giftBagId,int type) {
Bundle args = new Bundle();
LotteryFragment fragment = new LotteryFragment();
args.putString("roomId", giftBagId);
args.putInt("type",type);
fragment.setArguments(args);
return fragment;
}
@Override
protected void initData() {
roomId = getArguments().getString("roomId");
type = getArguments().getInt("type");
MvpPre.xlhAllRecord(roomId, "1", "20",type);
}
@Override
protected void initView() {
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
page = 1;
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
}
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
page++;
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
}
});
giftRecordAdapte=new GiftRecordAdapte();
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
mBinding.recyclerView.setAdapter(giftRecordAdapte);
}
@Override
protected int getLayoutId() {
return R.layout.fframent_data;
}
@Override
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
}
@Override
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
}
@Override
public void getMyRecordSuccess(List<GiftBean> data) {
}
@Override
public void getAllRecordSuccess(List<GiftBean> data) {
if (data != null){
if (page==1){
giftRecordAdapte.setNewData(data);
}else {
giftRecordAdapte.addData(data);
}
}else {
if (page == 1) {
giftRecordAdapte.setNewData(null);
}
}
}
@Override
public void finishRefreshLoadMore() {
mBinding.smartRefreshLayout.finishRefresh();
mBinding.smartRefreshLayout.finishLoadMore();
}
@Override
public void wallet(WalletBean walletBean) {
}
@Override
public void xlhChouSuccess(List<XlhDrawBean> data) {
}
}