修改点唱页面逻辑
修改背包展示问题
This commit is contained in:
@@ -364,7 +364,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
private final List<MqttBean> messageQueue = new ArrayList<>(); // 消息队列
|
||||
private boolean isPlaying = false; // 播放状态标志
|
||||
private final Object queueLock = new Object(); // 队列同步锁
|
||||
///礼物特效
|
||||
|
||||
/// 礼物特效
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceived(MqttBean mqttBean) {
|
||||
if (mqttBean == null) {
|
||||
@@ -401,36 +402,29 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
showFloatingMessage(mqttBean);
|
||||
}
|
||||
|
||||
private View floatingView; // 成员变量保存浮动视图
|
||||
private boolean isFloatingViewAdded = false; // 标记浮动视图是否已添加到 decorView
|
||||
|
||||
private void showFloatingMessage(MqttBean mqttBean) {
|
||||
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
|
||||
// 如果浮动视图未创建,则创建一次
|
||||
if (floatingView == null) {
|
||||
floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
||||
View floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
||||
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
floatingView.setLayoutParams(layoutParams);
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
floatingView.setLayoutParams(layoutParams);
|
||||
|
||||
// 初始化动画监听器
|
||||
setupAnimationListener(floatingView, decorView);
|
||||
}
|
||||
// 初始化动画监听器
|
||||
setupAnimationListener(floatingView, decorView);
|
||||
|
||||
// 更新视图数据
|
||||
updateFloatingViewData(mqttBean);
|
||||
updateFloatingViewData(floatingView, mqttBean);
|
||||
|
||||
// 如果浮动视图未添加到 decorView,则添加
|
||||
if (!isFloatingViewAdded) {
|
||||
decorView.addView(floatingView);
|
||||
isFloatingViewAdded = true;
|
||||
}
|
||||
decorView.addView(floatingView);
|
||||
|
||||
// 重置视图位置并开始动画
|
||||
resetAndStartAnimation(floatingView);
|
||||
@@ -464,10 +458,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
if (isFloatingViewAdded) {
|
||||
decorView.removeView(floatingView);
|
||||
isFloatingViewAdded = false;
|
||||
}
|
||||
decorView.removeView(floatingView);
|
||||
|
||||
// 标记播放结束并处理下一个消息
|
||||
synchronized (queueLock) {
|
||||
@@ -503,7 +494,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
private void updateFloatingViewData(MqttBean mqttBean) {
|
||||
private void updateFloatingViewData(View floatingView, MqttBean mqttBean) {
|
||||
TextView textView = floatingView.findViewById(R.id.tv_name);
|
||||
TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
|
||||
TextView tv_time = floatingView.findViewById(R.id.tv_num);
|
||||
@@ -627,8 +618,6 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
|
||||
|
||||
// 在类中添加新的成员变量
|
||||
private View xlhFloatingView; // XLH类型的浮动视图
|
||||
private boolean isXlhFloatingViewAdded = false; // 标记XLH浮动视图是否已添加到 decorView
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(XLHBean event) {
|
||||
@@ -640,32 +629,28 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
|
||||
|
||||
// 如果XLH浮动视图未创建,则创建一次
|
||||
if (xlhFloatingView == null) {
|
||||
xlhFloatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
|
||||
View xlhFloatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
|
||||
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
xlhFloatingView.setLayoutParams(layoutParams);
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
xlhFloatingView.setLayoutParams(layoutParams);
|
||||
|
||||
// 初始化动画监听器
|
||||
setupXlhAnimationListener(xlhFloatingView, decorView);
|
||||
} // 更新视图数据
|
||||
updateXlhFloatingViewData(event);
|
||||
// 初始化动画监听器
|
||||
setupXlhAnimationListener(xlhFloatingView, decorView);
|
||||
updateXlhFloatingViewData(xlhFloatingView, event);
|
||||
|
||||
// 如果浮动视图未添加到 decorView,则添加
|
||||
if (!isXlhFloatingViewAdded) {
|
||||
decorView.addView(xlhFloatingView);
|
||||
isXlhFloatingViewAdded = true;
|
||||
}
|
||||
decorView.addView(xlhFloatingView);
|
||||
|
||||
// 重置视图位置并开始动画
|
||||
resetAndStartXlhAnimation(xlhFloatingView);
|
||||
}
|
||||
|
||||
private void setupXlhAnimationListener(View floatingView, ViewGroup decorView) {
|
||||
// 为视图添加一个全局布局监听器,确保在视图完全加载后再设置动画
|
||||
floatingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@@ -694,10 +679,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
if (isXlhFloatingViewAdded) {
|
||||
decorView.removeView(floatingView);
|
||||
isXlhFloatingViewAdded = false;
|
||||
}
|
||||
decorView.removeView(floatingView);
|
||||
|
||||
// 标记播放结束并处理下一个消息
|
||||
synchronized (queueLock) {
|
||||
@@ -733,11 +715,11 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
private void updateXlhFloatingViewData(XLHBean xlhBean) {
|
||||
private void updateXlhFloatingViewData(View xlhFloatingView, XLHBean xlhBean) {
|
||||
TextView textView = xlhFloatingView.findViewById(R.id.tv_name);
|
||||
ImageView xlh_image = xlhFloatingView.findViewById(R.id.im_xlh);
|
||||
|
||||
if (xlhBean!=null){
|
||||
if (xlhBean != null) {
|
||||
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ? getResources().getDrawable(R.mipmap.xlh_jjks) : getResources().getDrawable(R.mipmap.xlh_zsks));
|
||||
|
||||
textView.setText(xlhBean.getText());
|
||||
|
||||
@@ -4,9 +4,10 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MyBagDataBean {
|
||||
private String title;
|
||||
private String giftName;
|
||||
private String time;
|
||||
private String base_image;
|
||||
private String remarks; //收入说明
|
||||
private String gift_num;//礼物数量
|
||||
private String gift_name;//礼物名称
|
||||
private String gift_image;//礼物图片
|
||||
private String time;//时间
|
||||
|
||||
}
|
||||
|
||||
@@ -883,6 +883,7 @@ public class AgoraManager {
|
||||
} else if (musicPlayer.getState() == io.agora.mediaplayer.Constants.MediaPlayerState.PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED) {
|
||||
LogUtils.e("lxj", "daki");
|
||||
musicPlayer.open(mSongCode, 0);
|
||||
|
||||
isPreload(mSongCode, type);
|
||||
} else if (musicPlayer.getState() == io.agora.mediaplayer.Constants.MediaPlayerState.PLAYER_STATE_OPENING) {
|
||||
LogUtils.e("lxj", musicPlayer.getState());
|
||||
|
||||
@@ -14,19 +14,7 @@
|
||||
android:clipToPadding="false">
|
||||
|
||||
<!--说话动态图 (麦圈) - 与头像大小相同-->
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_ripple"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:autoPlay="false"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.5"
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
@@ -55,6 +43,20 @@
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.5" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_ripple"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:autoPlay="false"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.5"
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
<!--头像框 - 比头像大2dp-->
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/iv_frame"
|
||||
|
||||
@@ -1007,12 +1007,11 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private void handleMsgType1013(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||
if (text == null || mRoomUserBean == null) return;
|
||||
|
||||
int userid = text.getFromUserInfo().getUser_id();
|
||||
int userId2 = SpUtil.getUserId();
|
||||
|
||||
if (text.getAction() == 1 && mRoomUserBean.getUser_id().equals(userId2 + "") && mRoomUserBean.getPit_number() == 9) {
|
||||
queren(text.getFromUserInfo().getNickname());
|
||||
} else if (text.getAction() == 4 && userid == userId2) {
|
||||
} else if (text.getAction() == 4 && text.getFromUserInfo().getUser_id() == userId2) {
|
||||
queren1(text.getFromUserInfo().getNickname());
|
||||
} else {
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
@@ -1060,7 +1059,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
|
||||
setBoolean(aBoolean);
|
||||
if (mRoomInfoResp.getUser_info() != null) {
|
||||
mRoomInfoResp.getUser_info().setPit_number(pitNumber != null ? Integer.parseInt(pitNumber) : 0);
|
||||
mRoomInfoResp.getUser_info().setPit_number(pitNumber != null ? Integer.parseInt(pitNumber) :-1);
|
||||
}
|
||||
setRoleType(3, Integer.parseInt(pitNumber));
|
||||
switchMic(2);
|
||||
@@ -2002,7 +2001,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
if (pit_number == 888) {
|
||||
rl_mic.setVisibility(View.VISIBLE);
|
||||
switchMic(2);
|
||||
} else {
|
||||
} else if (pit_number== -1) {
|
||||
switchMic(1);
|
||||
rl_mic.setVisibility(VISIBLE);
|
||||
}else {
|
||||
switchMic(2);
|
||||
rl_mic.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -662,6 +662,7 @@ private List<GiftLabelBean> giftLabelBeanList;
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
this.fragmentList.add(null);
|
||||
}
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -299,10 +299,10 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// 移除监听器
|
||||
if (messageListener != null) {
|
||||
LogUtils.e("移除监听器");
|
||||
MessageListenerSingleton.getInstance().removePublicScreenMessageListener(messageListener);
|
||||
}
|
||||
// if (messageListener != null) {
|
||||
// LogUtils.e("移除监听器");
|
||||
// MessageListenerSingleton.getInstance().removePublicScreenMessageListener(messageListener);
|
||||
// }
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,9 +80,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
super.onAttach(context);
|
||||
// roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
upData();
|
||||
@@ -424,6 +426,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
mBinding.llJs.setVisibility(View.VISIBLE);
|
||||
mBinding.llQg.setVisibility(View.VISIBLE);
|
||||
mBinding.llSz.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,12 +444,16 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
AgoraManager.getInstance(getActivity()).stopMuisc();
|
||||
MvpPre.changeSong(roomInfoResp.getRoom_info().getRoom_id(), did);
|
||||
} else if (id == R.id.ll_ds) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setAvatar(roomInfoResp.getSong_user_info().getAvatar());
|
||||
userInfo.setNickname(roomInfoResp.getSong_user_info().getNickname());
|
||||
userInfo.setUser_id(Integer.parseInt(roomInfoResp.getSong_user_info().getUser_id()));
|
||||
userInfo.setPit_number("0");
|
||||
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(), 0, "", getParentFragmentManager());
|
||||
if (mBinding.muYc.pitBean.getUser_id() != null && !mBinding.muYc.pitBean.getUser_id().equals("")) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setAvatar(roomInfoResp.getSong_user_info().getAvatar());
|
||||
userInfo.setNickname(roomInfoResp.getSong_user_info().getNickname());
|
||||
userInfo.setUser_id(Integer.parseInt(roomInfoResp.getSong_user_info().getUser_id()));
|
||||
userInfo.setPit_number("0");
|
||||
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(), 0, "", getParentFragmentManager());
|
||||
} else {
|
||||
com.hjq.toast.ToastUtils.show("请等待演唱者上麦");
|
||||
}
|
||||
} else if (id == R.id.ll_bz) {
|
||||
if (isRotate) {
|
||||
AgoraManager.getInstance(getActivity()).selectAudioTrack(0);
|
||||
@@ -583,17 +590,32 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
((RoomActivity) getActivity()).switchMic(1);
|
||||
|
||||
} else {
|
||||
if (mBinding.muZc.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
((RoomActivity) getActivity()).setRoleType(2, -1);
|
||||
((RoomActivity) getActivity()).switchMic(2);
|
||||
} else {
|
||||
((RoomActivity) getActivity()).setRoleType(0, 0);
|
||||
((RoomActivity) getActivity()).switchMic(2);
|
||||
if (roomInfoResp.getUser_info().getPit_number()>0){
|
||||
|
||||
}else {
|
||||
// if (mBinding.muZc.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
// ((RoomActivity) getActivity()).setRoleType(2, -1);
|
||||
// ((RoomActivity) getActivity()).switchMic(2);
|
||||
// } else {
|
||||
((RoomActivity) getActivity()).setRoleType(0, 0);
|
||||
((RoomActivity) getActivity()).switchMic(2);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
RoomPitBean pitBean = mBinding.muYc.pitBean;
|
||||
pitBean.setAvatar("");
|
||||
pitBean.setUser_id("");
|
||||
pitBean.setNickname("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setDress("");
|
||||
pitBean.setUser_code("");
|
||||
mBinding.muYc.setData(pitBean);
|
||||
((RoomActivity) getActivity()).setRoleType(0, 0);
|
||||
did = "";
|
||||
mBinding.muName.setText("无");
|
||||
}
|
||||
@@ -638,7 +660,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
}
|
||||
} else {
|
||||
RoomPitBean pitBean = new RoomPitBean();
|
||||
pitBean.setPit_number(messageEvent.getText().getPit_number());
|
||||
pitBean.setPit_number(messageEvent.getText().getPit_number()!=null ? messageEvent.getText().getPit_number() : "9999");
|
||||
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
|
||||
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
android:id="@+id/cl_bj"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:background="@drawable/bg_r8_tm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1.4:1.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -31,7 +31,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/default_avatar"
|
||||
android:alpha="0.3"
|
||||
android:background="#40000000"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -67,6 +67,11 @@ public class MyBagActivity extends BaseMvpActivity<MyBagPresenter, ActivityMyBag
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRefreshLoadMore() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -82,4 +82,9 @@ public class MyBagFragment extends BaseMvpFragment<MyBagPresenter, FragmentMyBag
|
||||
public void giftPack(List<GiftPackBean> giftPackBean) {
|
||||
mAdapter.setNewData(giftPackBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRefreshLoadMore() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user