1.添加背包礼物交友功能

This commit is contained in:
2025-09-16 00:56:58 +08:00
parent e87a368862
commit 72802ef7be
26 changed files with 321 additions and 120 deletions

View File

@@ -12,6 +12,7 @@ import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -84,8 +85,8 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (type == 0) {
MvpPre.getGiftList("0", type, roomId);
} else {
if (id==null){
id="0";
if (id == null) {
id = "0";
}
MvpPre.getGiftList(id, type, roomId);
}
@@ -94,23 +95,23 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onString(String giftId){
bdgiftId=giftId;
public void onString(String giftId) {
bdgiftId = giftId;
MvpPre.giftPack();
}
@Override
protected void initData() {
if (id.equals("0")) {
MvpPre.giftPack();
} else {
if (type == 0) {
MvpPre.getGiftList("0", type, roomId);
} else {
MvpPre.getGiftList(id, type, roomId);
}
}
// if (id.equals("0")) {
// MvpPre.giftPack();
// } else {
// if (type == 0) {
// MvpPre.getGiftList("0", type, roomId);
// } else {
// MvpPre.getGiftList(id, type, roomId);
// }
//
// }
}
@Override
@@ -183,23 +184,33 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList = new ArrayList<>();
if (bdgiftId!=null){
for (GiftPackBean item : giftPackBean){
if (item.getGift_id().equals(bdgiftId)){
item.setChecked(true);
if (giftPackBean != null && giftPackBean.size() > 0) {
if (bdgiftId != null) {
for (GiftPackBean item : giftPackBean) {
if (item.getGift_id().equals(bdgiftId)) {
item.setChecked(true);
}
}
}
}
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
// mBinding.rvGift.setAdapter(mAdapter);
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
mBinding.rvGift.setAdapter(packAdapter);
}
} else {
giftPackBean = new ArrayList<>();
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, 0, "0");
mBinding.rvGift.setAdapter(packAdapter);
}
}
@Override
@@ -207,6 +218,11 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
@Override
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
}
@Override
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {

View File

@@ -0,0 +1,13 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/9/15
*@description: 背包礼物总价值
*/
@Data
public class GiftPackListCount {
private String count;
}

View File

@@ -18,6 +18,7 @@ import com.xscm.moduleutil.bean.GiftBoxRecordBean;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftName;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.GiftUserWallBean;
import com.xscm.moduleutil.bean.HeadlineBean;
import com.xscm.moduleutil.bean.HeatedBean;
@@ -193,7 +194,7 @@ public interface ApiServer {
Observable<BaseModel<List<MyBagDataBean>>> packOutcome(@Query("page") String page, @Query("page_limit") String page_size);
@GET(Constants.GET_GIFT_PACK)
Observable<BaseModel<List<GiftPackBean>>> giftPack();
Call<BaseModel<List<GiftPackBean>>> giftPack();
@FormUrlEncoded
@POST(Constants.ADD_BLACK_LIST)
@@ -767,10 +768,13 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_GIFT_ALL_CLEAR)
Call<BaseModel<String>> getGiftPack(@Field("room_id") String roomId,@Field("to_uid") String user_id,@Field("heart_id") String heart_id);
Call<BaseModel<String>> getGiftPack(@Field("room_id") String roomId,@Field("to_uid") String user_id,@Field("heart_id") String heart_id,@Field("auction_id") String auction_id);
@FormUrlEncoded
@POST(Constants.POST_ROOM_USER_CHARM_LIST)
Call<BaseModel<List<RoomUserCharmListBean>>> roomUserCharmList(@Field("room_id") String roomId,@Field("user_id") String user_id);
@GET(Constants.GET_GIFT_PACK_LIST_COUNT)
Call<BaseModel<GiftPackListCount>> getGiftPackListCount();
}

View File

@@ -33,6 +33,7 @@ import com.xscm.moduleutil.bean.GiftBoxRecordBean;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftName;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.GiftUserWallBean;
import com.xscm.moduleutil.bean.HeadlineBean;
import com.xscm.moduleutil.bean.HeatedBean;
@@ -455,11 +456,29 @@ public class RetrofitClient {
}
public void giftPack(BaseObserver<List<GiftPackBean>> observer) {
sApiServer.giftPack().compose(new DefaultTransformer<>()).subscribe(observer);
sApiServer.giftPack().enqueue(new Callback<BaseModel<List<GiftPackBean>>>() {
@Override
public void onResponse(Call<BaseModel<List<GiftPackBean>>> call, Response<BaseModel<List<GiftPackBean>>> response) {
if (response.code() == 200){
BaseModel<List<GiftPackBean>> baseModel = response.body();
if (baseModel.getCode() == 1) {
observer.onNext(baseModel.getData());
} else {
observer.onNext(null);
}
}
}
@Override
public void onFailure(Call<BaseModel<List<GiftPackBean>>> call, Throwable t) {
t.printStackTrace();
}
});
}
public void getGiftPack(String roomId, String userId, String heart_id,BaseObserver<String> observer){
sApiServer.getGiftPack(roomId,userId,heart_id).enqueue(new Callback<BaseModel<String>>() {
public void getGiftPack(String roomId, String userId, String heart_id,String auction_id,BaseObserver<String> observer){
sApiServer.getGiftPack(roomId,userId,heart_id,auction_id).enqueue(new Callback<BaseModel<String>>() {
@Override
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
if (response.code() == 200){
@@ -479,6 +498,25 @@ public class RetrofitClient {
});
}
public void getGiftPackListCount(BaseObserver<GiftPackListCount> observer){
sApiServer.getGiftPackListCount().enqueue(new Callback<BaseModel<GiftPackListCount>>() {
@Override
public void onResponse(Call<BaseModel<GiftPackListCount>> call, Response<BaseModel<GiftPackListCount>> response) {
if (response.code() == 200){
BaseModel<GiftPackListCount> baseModel = response.body();
if (baseModel.getCode() == 1){
observer.onNext(baseModel.getData());
}
}
}
@Override
public void onFailure(Call<BaseModel<GiftPackListCount>> call, Throwable t) {
t.printStackTrace();
}
});
}
public void tasksLihen(BaseObserver<GiftBoxBean> observer) {
sApiServer.tasksLihen().enqueue(new Callback<ResponseBody>() {
@Override

View File

@@ -6,6 +6,7 @@ import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -29,6 +30,8 @@ public class RewardGiftContacts {
void giftPack(List<GiftPackBean> giftPackBean);
void getGiftPack(String s);
void getGiftPackListCount(GiftPackListCount giftPackListCount);
}
public interface IIndexPre extends IPresenter {
@@ -51,6 +54,8 @@ public class RewardGiftContacts {
void roomAuctionJoin(String auction_id,String user_id, String gift_id, String num,String type);
void giftPack();
void getGiftPack(String roomId,String userId,String heart_id);
void getGiftPack(String roomId,String userId,String heart_id,String auction_id );
void getGiftPackListCount();
}
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -17,6 +18,7 @@ import io.reactivex.disposables.Disposable;
public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View> implements RewardGiftContacts.IIndexPre {
RewardGiftContacts.View mView;
public RewardGiftPresenter(RewardGiftContacts.View view, Context context) {
super(view, context);
mView = view;
@@ -32,7 +34,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(List<RewardUserBean> rewardUserBeans) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().getRewardList(rewardUserBeans);
@@ -51,7 +53,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(List<GiftLabelBean> giftLabelBeans) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().getGiftLabel(giftLabelBeans);
@@ -61,8 +63,8 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
}
@Override
public void getGiftList(String id, int type,String roomId) {
api.getGiftList(Integer.parseInt(id),roomId, new BaseObserver<List<RoonGiftModel>>() {
public void getGiftList(String id, int type, String roomId) {
api.getGiftList(Integer.parseInt(id), roomId, new BaseObserver<List<RoonGiftModel>>() {
@Override
public void onSubscribe(Disposable d) {
@@ -71,7 +73,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(List<RoonGiftModel> roonGiftModels) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().setGiftList(roonGiftModels, type);
@@ -90,7 +92,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(String s) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().giveGift();
@@ -99,8 +101,8 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
}
@Override
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number,String heart_id) {
api.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number,heart_id, new BaseObserver<String>() {
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number, String heart_id) {
api.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
@@ -109,7 +111,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(String s) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().giveGift();
@@ -127,7 +129,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(WalletBean walletBean) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().wallet(walletBean);
@@ -146,7 +148,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(String s) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().reward_zone();
@@ -164,7 +166,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(String s) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().reward_zone();
@@ -182,7 +184,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(RoomAuction.AuctionListBean auctionListBean) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().roomAuctionJoin(auctionListBean);
@@ -201,7 +203,7 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(List<GiftPackBean> giftPackBeans) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().giftPack(giftPackBeans);
@@ -210,8 +212,8 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
}
@Override
public void getGiftPack(String roomId,String userId,String heart_id) {
api.getGiftPack(roomId,userId,heart_id, new BaseObserver<String>() {
public void getGiftPack(String roomId, String userId, String heart_id, String auction_id) {
api.getGiftPack(roomId, userId, heart_id, auction_id, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
@@ -219,15 +221,33 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
@Override
public void onNext(String s) {
if (MvpRef==null){
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
if (s==null){
if (s == null) {
MvpRef.get().getGiftPack(null);
}else {
} else {
MvpRef.get().getGiftPack(s);
}
}
});
}
@Override
public void getGiftPackListCount() {
api.getGiftPackListCount(new BaseObserver<GiftPackListCount>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(GiftPackListCount giftPackListCount) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().getGiftPackListCount(giftPackListCount);
}
});
}
}

View File

@@ -386,6 +386,7 @@ public class Constants {
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";///巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";///背包礼物全清
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";///房间用户当前魅力值列表
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";///背包礼物总价值

View File

@@ -19,6 +19,7 @@ import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -196,4 +197,9 @@ public class RewardDialogFragment extends BaseMvpDialogFragment<RewardGiftPresen
public void getGiftPack(String s) {
}
@Override
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
}
}

View File

@@ -25,6 +25,7 @@ import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftNumBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -292,6 +293,11 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
}
@Override
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
}
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List<GiftLabelBean> list;

View File

@@ -29,18 +29,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
<!-- android:id="@+id/iv_ripple"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_marginTop="@dimen/dp_8"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintHeight_percent="0.99"-->
<!-- app:layout_constraintWidth_percent="0.99"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- />-->
<com.xscm.moduleutil.widget.AvatarFrameView
android:id="@+id/iv_frame"
@@ -50,13 +38,11 @@
android:scaleType="fitCenter"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.95"
android:layout_marginTop="@dimen/dp_5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.95" />
app:layout_constraintBottom_toBottomOf="@id/riv"
app:layout_constraintEnd_toEndOf="@id/riv"
app:layout_constraintStart_toStartOf="@id/riv"
app:layout_constraintTop_toTopOf="@id/riv"
android:layout_margin="-5dp"/>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_ripple"