修改点唱页面逻辑

修改背包展示问题
This commit is contained in:
2025-09-06 19:28:18 +08:00
parent 0db678d6a6
commit 77b801cca6
16 changed files with 184 additions and 108 deletions

View File

@@ -67,6 +67,11 @@ public class MyBagActivity extends BaseMvpActivity<MyBagPresenter, ActivityMyBag
}
@Override
public void finishRefreshLoadMore() {
}
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {

View File

@@ -15,6 +15,7 @@ public class MyBagConacts {
void packIncome(List<MyBagDataBean> myBagDataBean);
void packOutcome(List<MyBagDataBean> myBagDataBean);
void giftPack(List<GiftPackBean> giftPackBean);
void finishRefreshLoadMore();
}
public interface IMePre extends IPresenter {

View File

@@ -82,4 +82,9 @@ public class MyBagFragment extends BaseMvpFragment<MyBagPresenter, FragmentMyBag
public void giftPack(List<GiftPackBean> giftPackBean) {
mAdapter.setNewData(giftPackBean);
}
@Override
public void finishRefreshLoadMore() {
}
}

View File

@@ -12,8 +12,8 @@ public class MyBagListAdapter extends BaseQuickAdapter<MyBagDataBean, BaseViewHo
@Override
protected void convert(BaseViewHolder helper, MyBagDataBean item) {
helper.setText(R.id.tv_title, item.getTitle());
helper.setText(R.id.tv_title, item.getRemarks());
helper.setText(R.id.tv_time, item.getTime());
helper.setText(R.id.tv_gift_name, item.getGiftName());
helper.setText(R.id.tv_gift_name, item.getGift_name());
}
}

View File

@@ -2,22 +2,27 @@ package com.example.modulevocal.fragment.mybag;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.example.modulevocal.R;
import com.example.modulevocal.conacts.MyBagConacts;
import com.example.modulevocal.databinding.FragmentMyBagListBinding;
import com.example.modulevocal.presenter.MyBagPresenter;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.MyBagDataBean;
import java.util.ArrayList;
import java.util.List;
public class MyBagListFragment extends BaseMvpFragment<MyBagPresenter, FragmentMyBagListBinding> implements MyBagConacts.View{
MyBagListAdapter mAdapter;
private String type;
List<MyBagDataBean> myBagDataBeanList;
private int page = 1;
public static MyBagListFragment newInstance(String type) {
@@ -43,8 +48,10 @@ public class MyBagListFragment extends BaseMvpFragment<MyBagPresenter, FragmentM
if (type.equals("1")){
}else if (type.equals("2")){
page=1;
MvpPre.packIncome("1","30");
}else if (type.equals("3")){
page=1;
MvpPre.packOutcome("1","30");
}
@@ -52,6 +59,29 @@ public class MyBagListFragment extends BaseMvpFragment<MyBagPresenter, FragmentM
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mBinding.recyclerView.setAdapter(mAdapter);
mBinding.smartRefreshLayout.setOnLoadMoreListener(new OnRefreshLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
if (type.equals("2")) {
page++;
MvpPre.packIncome(page + "", "30");
}else if (type.equals("3")){
page++;
MvpPre.packOutcome(page + "", "30");
}
}
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
if (type.equals("2")) {
page = 1;
MvpPre.packIncome(page + "", "30");
}else if (type.equals("3")){
page = 1;
MvpPre.packOutcome(page + "", "30");
}
}
});
}
@Override
@@ -65,19 +95,36 @@ public class MyBagListFragment extends BaseMvpFragment<MyBagPresenter, FragmentM
@Override
public void packIncome(List<MyBagDataBean> myBagDataBean) {
if (myBagDataBeanList!=null) {
myBagDataBeanList.addAll(myBagDataBean);
mAdapter.setNewData(myBagDataBeanList);
if (page==1) {
mAdapter.setNewData(myBagDataBean);
}else {
if (myBagDataBean==null){
return;
}
mAdapter.addData(myBagDataBean);
}
}
@Override
public void packOutcome(List<MyBagDataBean> myBagDataBean) {
mAdapter.setNewData(myBagDataBean);
if (page==1) {
mAdapter.setNewData(myBagDataBean);
}else {
if (myBagDataBean==null){
return;
}
mAdapter.addData(myBagDataBean);
}
}
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
}
@Override
public void finishRefreshLoadMore() {
mBinding.smartRefreshLayout.finishRefresh();
mBinding.smartRefreshLayout.finishLoadMore();
}
}

View File

@@ -28,6 +28,7 @@ public class MyBagPresenter extends BasePresenter<MyBagConacts.View> implements
@Override
public void onNext(List<MyBagDataBean> myBagDataBeans) {
MvpRef.get().packIncome(myBagDataBeans);
MvpRef.get().finishRefreshLoadMore();
}
});
}

View File

@@ -1,16 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
>
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.recyclerview.widget.RecyclerView
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recyclerView"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:overScrollMode="never"
android:scrollbars="none"
android:background="@drawable/bg_r10_white"
/>
android:layout_height="match_parent"
app:srlEnableLoadMore="true"
app:srlEnableRefresh="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_r10_white"
android:overScrollMode="never"
android:scrollbars="none" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</layout>