添加了盲盒转盘抽奖功能

修改交友房中开始后,不能点击头像送礼的问题
This commit is contained in:
2025-08-27 19:58:05 +08:00
parent 994d98b515
commit 0b128f3d72
27 changed files with 1333 additions and 137 deletions

View File

@@ -1,7 +1,11 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/8/27
*@description: 推送过来的礼物信息,复用在盲盒活动获取礼物信息中
*/
@Data
public class GiftBean {
@@ -12,4 +16,5 @@ public class GiftBean {
private String play_image;
private String base_image;
private String gift_type;
private int number;
}

View File

@@ -1,26 +0,0 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
@Data
public class RoomMessageEvent1 {
private int MsgType; // 消息类型,如 QXRoomMessageTypeJoin
private String RoomId; // 房间 ID
private RoomMessageEvent.T Text; // 携带的数据对象
public RoomMessageEvent1(int msgType, String roomId, RoomMessageEvent.T text) {
MsgType = msgType;
RoomId = roomId;
Text = text;
}
@Data
public static class T {
private String text;
private String GiftNum;
private UserInfo FromUserInfo;
private UserInfo ToUserInfo;
private GiftBean GiftInfo;
}
}

View File

@@ -31,7 +31,8 @@ public class RoonGiftModel {
private boolean isSelected;
private boolean can_send_self;//是否能送自己
private int num;//礼物数量
private int activities_id;//4盲盒 5天空之境
private int gift_bag;
public boolean isCan_send_self() {
if ( isManghe()) {
return true;

View File

@@ -0,0 +1,31 @@
package com.xscm.moduleutil.bean.blindboxwheel;
import com.xscm.moduleutil.bean.GiftBean;
import java.util.List;
import lombok.Data;
/**
*@author qx
*@data 2025/8/27
*@description: 获取活动礼物列表
*/
@Data
public class BlindBoxBean {
private String title;
private String rule_url;
private String rule;
private String box_price ;
private int is_xlh; ///是否开启巡乐会 0 关闭 1 开启
private XlhData xlh_data;
private List<GiftBean> gift_list;
@Data
public class XlhData{
private String waiting_start_num;//等待开始需要达到的次数
private String start_num;//巡乐会开启需要达到的次数
private int current_num;//当前已抽奖次数
private int status;
}
}

View File

@@ -0,0 +1,23 @@
package com.xscm.moduleutil.bean.blindboxwheel;
import java.util.List;
import lombok.Data;
/**
* @author qx
* @data 2025/8/27
* @description: 礼物抽奖结果
*/
@Data
public class BlindReslutBean {
private String blind_box_turntable_id;//本次抽奖标识 Id 效果完成后用这个值推送发放
private List<ReslutList> reslut_list;
@Data
public class ReslutList {
private int gift_id;//中奖礼物Id
private int count;//中奖礼物数量
}
}

View File

@@ -4,13 +4,19 @@ import android.app.Activity;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
public class GiftLotteryContacts {
public interface View extends IView<Activity> {
void getGiftListSuccess(BlindBoxBean blindBoxBean);
void drawGiftListSuccess(BlindReslutBean blindReslutBean);
}
public interface IRoomPre extends IPresenter {
void getGiftList(String giftBagId,String roomId);
void drawGiftList(String giftBagId,String gift_user_ids,String roomId,String num);
}
}

View File

@@ -2,7 +2,10 @@ package com.xscm.moduleutil.dialog.giftLottery;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.Window;
@@ -11,10 +14,16 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.databinding.DialogGiftLotteryBinding;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.widget.GiftCardView;
import java.util.ArrayList;
import java.util.List;
@@ -22,23 +31,51 @@ import java.util.List;
/**
* @author qx
* @data 2025/8/18
* @description: 礼物抽奖
* @description: 天空之境礼物抽奖
*/
public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogGiftLotteryBinding> implements GiftLotteryContacts.View {
private int topCount = 4;
private int bottomCount = 4;
private String giftBagId;
private String roomId;
private String userIds;
///共有12个礼物
private int giftMaxCount = 12;
///最少转6圈
private int minRoundCount = 6;
///距离4个的时候放慢
private int toSlowCount = 4;
private List<GiftCardView> allViewsArray=new ArrayList<>() ;//视图的集合
private int targetIndex;//目标的下标
private List<Integer> targetArrayIndex=new ArrayList<>();//中奖的下标
private List<Integer> finishTargetArrayIndex=new ArrayList<>();
private int currentIndex;///当前转到第几个下标
private int roundCount;//转动多少次
private double delayTime;//延时
private GiftCardView currentGiftCardView;
private boolean isDrawing;//是否正在抽奖
private boolean isOpenSound;//是否开启音效
private boolean isOpenSpecial;//是否开启特效
private Handler handler;
private Runnable timerRunnable;//定时器
private int startType;//类型点击的事抽奖1次还是10次还是100次
private List<GiftBean> giftLists=new ArrayList<>();
@Override
protected GiftLotteryPresenter bindPresenter() {
return new GiftLotteryPresenter(this, getActivity());
}
public static GiftLotteryDialog newInstance(int top, int bottom) {
public static GiftLotteryDialog newInstance(String giftBagId,String roomId,String userIds) {
GiftLotteryDialog dialog = new GiftLotteryDialog();
Bundle args = new Bundle();
args.putInt("top", top);
args.putInt("bottom", bottom);
args.putString("giftBagId", giftBagId);
args.putString("roomId", roomId);
args.putString("userIds", userIds);
dialog.setArguments(args);
return dialog;
}
@@ -53,58 +90,357 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
topCount = getArguments().getInt("top");
bottomCount = getArguments().getInt("bottom");
roomId = getArguments().getString("roomId");
giftBagId = getArguments().getString("giftBagId");
userIds = getArguments().getString("userIds");
}
@Override
protected void initData() {
MvpPre.getGiftList(giftBagId, roomId);
}
private List<Integer> getTargetArrayIndex() {
if (targetArrayIndex == null) {
targetArrayIndex = new ArrayList<>();
}
return targetArrayIndex;
}
private List<Integer> getFinishTargetArrayIndex() {
if (finishTargetArrayIndex == null) {
finishTargetArrayIndex = new ArrayList<>();
}
return finishTargetArrayIndex;
}
@Override
protected void initView() {
mBinding.recyclerGifts.setLayoutManager(new GridLayoutManager(requireContext(), 4));
List<GiftLottery> gifts = new ArrayList<>();
for (int i = 0; i < topCount + bottomCount; i++) {
gifts.add(new GiftLottery(
String.valueOf(i),
"R.mipmap.ic_launcher",
"66666",
"柔情似水",
"66666",
false
));
} GiftLotteryAdapter adapter = new GiftLotteryAdapter(gifts, new GiftLotteryAdapter.OnGiftClickListener() {
allViewsArray.add(mBinding.gift1);
allViewsArray.add(mBinding.gift2);
allViewsArray.add(mBinding.gift3);
allViewsArray.add(mBinding.gift4);
allViewsArray.add(mBinding.gift5);
allViewsArray.add(mBinding.gift6);
allViewsArray.add(mBinding.gift7);
allViewsArray.add(mBinding.gift8);
allViewsArray.add(mBinding.gift9);
allViewsArray.add(mBinding.gift10);
allViewsArray.add(mBinding.gift11);
allViewsArray.add(mBinding.gift12);
mBinding.llOne.setOnClickListener(this::onClisk);
mBinding.llTen.setOnClickListener(this::onClisk);
mBinding.llHundred.setOnClickListener(this::onClisk);
mBinding.swLockYx.setOnClickListener(this::onClisk);
mBinding.swTex.setOnClickListener(this::onClisk);
init(0);
mBinding.swLockYx.setChecked(true);
mBinding.swTex.setChecked(true);
isOpenSpecial=true;
}
private void onClisk(View view) {
int id = view.getId();
if (id == R.id.ll_one){
if (!isDrawing) {
init(1);
startType = 1;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1");
}else {
com.hjq.toast.ToastUtils.show("正在抽奖中...");
return;
}
}else if (id == R.id.ll_ten){
if (!isDrawing) {
init(2);
startType = 2;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "10");
}else {
com.hjq.toast.ToastUtils.show("正在抽奖中...");
}
}else if (id == R.id.ll_hundred){
if (!isDrawing) {
init(3);
startType = 3;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "100");
}else {
com.hjq.toast.ToastUtils.show("正在抽奖中...");
}
}else if (id == R.id.sw_lock_yx){
isOpenSpecial=mBinding.swLockYx.isChecked();
}else if (id == R.id.sw_tex){
isOpenSpecial=mBinding.swTex.isChecked();
}
}
private void init(int type) {
if (type == 1) {
mBinding.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_x));
mBinding.llTen.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
} else if (type == 2) {
mBinding.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llTen.setBackground(getResources().getDrawable(R.mipmap.chou_x));
mBinding.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
} else if (type == 3) {
mBinding.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llTen.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_x));
}else {
mBinding.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llTen.setBackground(getResources().getDrawable(R.mipmap.chou_w));
mBinding.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
}
}
///定时器
public void startFastAnimate() {
if (allViewsArray.isEmpty()) {
return;
}
currentGiftCardView = allViewsArray.get(0);
currentGiftCardView.setSelected(true);
// 停止之前的定时器
stopFastAnimate();
if (isOpenSound) {
// 假设此处有播放音乐的逻辑
// player.seekTo(0);
// player.start();
}
roundCount = 0;
delayTime = 0.2;
handler = new Handler(Looper.getMainLooper());
timerRunnable = new Runnable() {
@Override
public void onGiftClick(GiftLottery item) {
}
});
mBinding.recyclerGifts.setAdapter(adapter);
// 绑定按钮点击事件
mBinding.btnLotteryOnce.setOnClickListener(v -> {
adapter.startScanAnimation(); // 启动扫描动画
});
mBinding.btnLotteryTen.setOnClickListener(v -> {
// 抽奖10次每次启动一次扫描
for (int i = 0; i < 10; i++) {
adapter.startScanAnimation();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
public void run() {
roundCount++;
if ((roundCount / giftMaxCount == minRoundCount) && startType != 0) {
boolean has = false;
for (int index : finishTargetArrayIndex) {
if (index == currentIndex) {
has = true;
break;
}
}
currentGiftCardView.setSelected(false);
GiftCardView giftView = allViewsArray.get(currentIndex);
if (has) {
giftView.setSelected(true);
} else {
giftView.setSelected(false);
}
} else {
currentGiftCardView.setSelected(false);
}
currentIndex = roundCount % giftMaxCount;
GiftCardView giftView = allViewsArray.get(currentIndex);
giftView.setSelected(true);
currentGiftCardView = giftView;
if (roundCount / giftMaxCount == minRoundCount) {
for (int i = 0; i < targetArrayIndex.size(); i++) {
int index = targetArrayIndex.get(i);
if (currentIndex == index) {
GiftCardView targetGiftView = allViewsArray.get(index);
targetGiftView.setSelected(true);
targetGiftView.setVisibilitymResultTextView(true);
targetGiftView.startPulseAnimationWithLayer();
targetArrayIndex.remove(i);
finishTargetArrayIndex.add(index);
break;
}
}
delayTime = 0.03;
if (targetArrayIndex.size()==0) {
isDrawing = false;
stopFastAnimate();
}
} else {
delayTime = delayTime - 0.02;
if (delayTime <= 0.03) {
delayTime = 0.03;
}
}
// 重新调度任务
handler.postDelayed(this, (long) (delayTime * 1000));
}
});
};
// 启动定时器
handler.postDelayed(timerRunnable, (long) (0.2 * 1000));
}
public void stopFastAnimate() {
if (handler != null && timerRunnable != null) {
handler.removeCallbacks(timerRunnable);
timerRunnable=null;
}
}
@Override
protected int getLayoutId() {
return R.layout.dialog_gift_lottery;
}
@Override
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
if (blindBoxBean != null && blindBoxBean.getGift_list() != null) {
giftLists = blindBoxBean.getGift_list();
// 确保数据数量不超过视图数量
int size = Math.min(giftLists.size(), allViewsArray.size());
// 一对一绑定数据到视图
for (int i = 0; i < size; i++) {
GiftCardView giftCardView = allViewsArray.get(i);
GiftBean giftBean = giftLists.get(i);
giftCardView.bindGiftData(giftBean);
}
// 如果礼物数量少于视图数量,隐藏多余的视图
for (int i = size; i < allViewsArray.size(); i++) {
allViewsArray.get(i).setVisibility(View.GONE);
}
}
}
@Override
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
if (blindReslutBean!=null || !blindReslutBean.getReslut_list().isEmpty()){
for (int i=0;i<blindReslutBean.getReslut_list().size();i++){
BlindReslutBean.ReslutList reslutList = blindReslutBean.getReslut_list().get(i);
for (int j=0;j<giftLists.size();j++){
if (giftLists.get(j).getGift_id().equals(reslutList.getGift_id()+"")){
targetArrayIndex.add(j);
if (j<12){
GiftCardView giftCardView=allViewsArray.get(j);
GiftBean giftBean=giftLists.get(j);
giftBean.setNumber(reslutList.getCount());
if (!isOpenSpecial){
giftCardView.setVisibilitymResultTextView(false);
giftCardView.setSelected( true);
isDrawing=true;
}
}
}
}
}
if (isOpenSpecial){
startFastAnimate();
}
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
releaseResources();
}
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
releaseResources();
}
@Override
public void onDestroy() {
super.onDestroy();
releaseResources();
}
/**
* 释放所有资源
*/
private void releaseResources() {
// 清理定时器
if (handler != null && timerRunnable != null) {
handler.removeCallbacksAndMessages(null);
timerRunnable = null;
}
// 停止并清理所有动画
stopAllAnimations();
// 清理GiftCardView中的动画
if (allViewsArray != null) {
for (GiftCardView giftCardView : allViewsArray) {
if (giftCardView != null) {
giftCardView.stopPulseAnimationWithLayer();
}
}
}
// 清理Presenter
if (MvpPre != null) {
// 如果Presenter中有需要清理的资源在这里处理
}
// 清理视图引用
clearViewReferences();
// 建议进行垃圾回收
System.gc();
}
/**
* 停止所有动画
*/
private void stopAllAnimations() {
// 停止所有GiftCardView动画
if (allViewsArray != null) {
for (GiftCardView giftCardView : allViewsArray) {
if (giftCardView != null) {
giftCardView.stopPulseAnimationWithLayer();
}
}
}
}
/**
* 清理视图引用
*/
private void clearViewReferences() {
// 清理GiftCardView列表
if (allViewsArray != null) {
allViewsArray.clear();
}
// 清理Presenter引用
if (MvpPre != null) {
MvpPre.detachView();
MvpPre = null;
}
// 清理Binding引用
if (mBinding != null) {
// 清理Binding中的视图引用
mBinding = null;
}
}
/**
* 停止抽奖过程
*/
private void stopLotteryProcess() {
// 停止当前的抽奖动画
if (handler != null && timerRunnable != null) {
handler.removeCallbacks(timerRunnable);
}
// 重置抽奖状态
isDrawing = false;
currentIndex = 0;
roundCount = 0;
}
}

View File

@@ -2,12 +2,57 @@ package com.xscm.moduleutil.dialog.giftLottery;
import android.content.Context;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter;
import java.lang.ref.WeakReference;
import java.util.List;
import io.reactivex.disposables.Disposable;
public class GiftLotteryPresenter extends BasePresenter<GiftLotteryContacts.View> implements GiftLotteryContacts.IRoomPre {
GiftLotteryContacts.View mView;
public GiftLotteryPresenter(GiftLotteryContacts.View view, Context context) {
super(view, context);
mView = view;
}
@Override
public void getGiftList(String giftBagId, String roomId) {
api.getBoxGiftList(giftBagId, roomId, new BaseObserver<BlindBoxBean>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable( d);
}
@Override
public void onNext(BlindBoxBean blindBoxBeans) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().getGiftListSuccess(blindBoxBeans);
}
});
}
@Override
public void drawGiftList(String giftBagId, String gift_user_ids, String roomId, String num) {
api.drawGiftList(giftBagId, gift_user_ids, roomId, num, new BaseObserver<BlindReslutBean>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(BlindReslutBean blindReslutBean) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().drawGiftListSuccess(blindReslutBean);
}
});
}
}

View File

@@ -55,6 +55,8 @@ import com.xscm.moduleutil.bean.UserTagBean;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.WalletConfig;
import com.xscm.moduleutil.bean.WithdrawalBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.bean.room.AuctionBean;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
@@ -86,12 +88,14 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.LOGIN)
Observable<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
@FormUrlEncoded //手机换绑
@POST(Constants.MODIFY_MOBILE)
Call<BaseModel<String>> mobileView(@Field("mobile") String mobile, @Field("new_mobile") String new_mobile,@Field("sms_code") String sms_code);
Call<BaseModel<String>> mobileView(@Field("mobile") String mobile, @Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code);
@FormUrlEncoded //手机绑定
@POST(Constants.BIND_MOBILE)
Call<BaseModel<String>> mobileView2( @Field("new_mobile") String new_mobile,@Field("sms_code") String sms_code);
Call<BaseModel<String>> mobileView2(@Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code);
@FormUrlEncoded
@POST(Constants.USER_LOGIN)
@@ -135,7 +139,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_USER_WALL)
Observable<BaseModel<GiftUserWallBean>> giftWall(@Field("user_id")String userId);
Observable<BaseModel<GiftUserWallBean>> giftWall(@Field("user_id") String userId);
@GET(Constants.CURRENT_HEADLINE)
Observable<BaseModel<HeadlineBean>> currentHeadline();
@@ -159,7 +163,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_MESSAGE_LIST)
Observable<BaseModel<List<NewsMessageList>>> getMessagetitle(@Field("type")String type, @Field("page")String page, @Field("page_limit")String page_limit);
Observable<BaseModel<List<NewsMessageList>>> getMessagetitle(@Field("type") String type, @Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_ROOM_RANK)
@@ -259,7 +263,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.GET_EXPAND_COLUMN)
Observable<BaseModel<List<ExpandColumnBean>>> getExpandColumn(@Field("type") String type,@Field("page") String page, @Field("page_limit") String page_limit);
Observable<BaseModel<List<ExpandColumnBean>>> getExpandColumn(@Field("type") String type, @Field("page") String page, @Field("page_limit") String page_limit);
@GET(Constants.GET_OFFICIAL_NOTICE)
Observable<BaseModel<NewsDataBean>> getOfficialNotice();
@@ -290,6 +294,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_BLACK_LIST)
Observable<BaseModel<List<BlackUserBean>>> getBlacklist(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_LOCK_MI_LIST)
Observable<BaseModel<List<BlackUserBean>>> getLockMiniList(@Field("page") String page, @Field("page_limit") String page_limit);
@@ -435,7 +440,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_CLEAR_USER_CHARM)
Call<BaseModel<String>> clearUserCharm(@Field("room_id") String roomId,@Field("user_id") String userId);
Call<BaseModel<String>> clearUserCharm(@Field("room_id") String roomId, @Field("user_id") String userId);
@FormUrlEncoded
@POST(Constants.REMOVE_BLACK_LIST)
@@ -443,7 +448,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_USER_OLINE_STATUS)
Call<BaseModel<List<UserOnlineStatusBean>>> userOnlineStatus(@Field("user_id") String userId,@Field("room_id")String roomId);
Call<BaseModel<List<UserOnlineStatusBean>>> userOnlineStatus(@Field("user_id") String userId, @Field("room_id") String roomId);
@FormUrlEncoded
@POST(Constants.postRoomSwToken)
@@ -500,7 +505,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.GET_ROOM_GIFT)
Call<BaseModel<String>> roomGift(@Field("room_id") String room_id, @Field("gift_id") String gift_id, @Field("gift_num") String num, @Field("to_uid") String to_uid, @Field("type") String gift_type, @Field("pit_number") String pit_number,@Field("heart_id")String heat_id);
Call<BaseModel<String>> roomGift(@Field("room_id") String room_id, @Field("gift_id") String gift_id, @Field("gift_num") String num, @Field("to_uid") String to_uid, @Field("type") String gift_type, @Field("pit_number") String pit_number, @Field("heart_id") String heat_id);
@GET(Constants.GET_FIRST_CHARGE_GIFT)
Observable<BaseModel<FirstChargeGiftBean>> firstChargeGift();
@@ -542,16 +547,18 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.START_FRIEND)
Call<BaseModel<String>> startFriend(@Field("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.END_FRIEND)
Call<BaseModel<FriendUserBean>> endFriend(@Field("friend_id") String friend_id, @Field("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.CREATE_RELATION)
Call<BaseModel<String>> createRelation( @Field("room_id") String room_id,@Field("friend_id") String friend_id,@Field("user1_id") String user1_id,@Field("user2_id") String user2_id,@Field("relation_id") String relation_id);
Call<BaseModel<String>> createRelation(@Field("room_id") String room_id, @Field("friend_id") String friend_id, @Field("user1_id") String user1_id, @Field("user2_id") String user2_id, @Field("relation_id") String relation_id);
@FormUrlEncoded
@POST(Constants.DELAY)
Call<BaseModel<String>> delay(@Field("friend_id")String friend_id, @Field("room_id") String room_id,@Field("delay_times")String delay_times);
Call<BaseModel<String>> delay(@Field("friend_id") String friend_id, @Field("room_id") String room_id, @Field("delay_times") String delay_times);
@FormUrlEncoded
@POST(Constants.DOWN_PIT)
@@ -648,7 +655,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_GIVE_COIN)
Call<BaseModel<String>> giveCoin(@Field("user_id") String user_id,@Field("coin") String coin);
Call<BaseModel<String>> giveCoin(@Field("user_id") String user_id, @Field("coin") String coin);
@FormUrlEncoded
@POST(Constants.POST_SET_MUTE_PIT)
@@ -663,7 +670,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_CHARM_LIST)
Observable<BaseModel<RoomDetails>> getCharmList(@Field("room_id") String room_id, @Field("start_time") String start_time, @Field("end_time") String end_time,@Field("page") String page);
Observable<BaseModel<RoomDetails>> getCharmList(@Field("room_id") String room_id, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("page") String page);
@FormUrlEncoded
@POST(Constants.POST_SET_UPLOAD_BG_IMG)
@@ -675,7 +682,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_AUCTION_END)
Call<BaseModel<String>> auctionEnd(@Field("auction_id") String auction_id,@Field("room_id") String room_id);
Call<BaseModel<String>> auctionEnd(@Field("auction_id") String auction_id, @Field("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.POST_AUCTION_MODE)
@@ -723,4 +730,11 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_SEARCH_PK_ROOM)
Observable<BaseModel<List<RoomBean>>> searchPkRoom(@Field("room_id") String room_id, @Field("page") String page, @Field("limit") String limit);
@GET(Constants.GET_BOX_GIFT_LIST)
Call<BaseModel<BlindBoxBean>> getBoxGiftList(@Query("gift_bag_id") String gift_bag_id, @Query("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.POST_DRAW_GIFT_LIST)
Call<BaseModel<BlindReslutBean>> drawGiftList(@Field("gift_bag_id") String gift_bag_id, @Field("gift_user_ids") String gift_user_ids,@Field("room_id")String room_id,@Field("num")String num);
}

View File

@@ -72,6 +72,8 @@ import com.xscm.moduleutil.bean.UserTagBean;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.WalletConfig;
import com.xscm.moduleutil.bean.WithdrawalBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.bean.room.AuctionBean;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
@@ -103,6 +105,7 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import io.reactivex.disposables.Disposable;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
@@ -2204,5 +2207,39 @@ public class RetrofitClient {
}
}
///获取活动礼物列表
public void getBoxGiftList(String giftBagId, String roomId, BaseObserver<BlindBoxBean> observer){
sApiServer.getBoxGiftList(giftBagId, roomId).enqueue(new Callback<BaseModel<BlindBoxBean>>() {
@Override
public void onResponse(Call<BaseModel<BlindBoxBean>> call, Response<BaseModel<BlindBoxBean>> response) {
if (response.code() == 200) {
BaseModel<BlindBoxBean> baseModel = response.body();
observer.onNext(baseModel.getData());
}
}
@Override
public void onFailure(Call<BaseModel<BlindBoxBean>> call, Throwable t) {
t.printStackTrace();
}
});
}
///盲盒转盘抽奖
public void drawGiftList(String giftBagId, String gift_user_ids, String roomId, String num,BaseObserver<BlindReslutBean> observer){
sApiServer.drawGiftList(giftBagId, gift_user_ids, roomId, num).enqueue(new Callback<BaseModel<BlindReslutBean>>() {
@Override
public void onResponse(Call<BaseModel<BlindReslutBean>> call, Response<BaseModel<BlindReslutBean>> response) {
if (response.code() == 200) {
BaseModel<BlindReslutBean> baseModel = response.body();
observer.onNext(baseModel.getData());
}
}
@Override
public void onFailure(Call<BaseModel<BlindReslutBean>> call, Throwable t) {
t.printStackTrace();
}
});
}
}

View File

@@ -15,7 +15,7 @@ public enum EnvironmentEnum {
"tcp://81.70.45.221",
"https://vespa.qxmier.com"),
TEST(//测试环境
"http://tmd.qixing2.top/",
"http://md.qxmier.com/",
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",
"https://oss-cn-hangzhou.aliyuncs.com/",
"LTAI5tJ2UYfFNF7K3F4e1siv",

View File

@@ -103,9 +103,33 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
} else {
isPlaying = false;
// playNextFromQueue(); // 播放下一项
// 播放完成后立即清理当前资源
clearCurrentResource();
mainHandler.postDelayed(this::playNextFromQueue, 50);
}
}
private void clearCurrentResource() {
// 清理当前播放的文件引用
// mFile = null;
// 清理SVGA资源
if (svgaSurface != null) {
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable(null);
}
// 清理MP4资源
if (exoPlayer != null) {
exoPlayer.stop();
exoPlayer.clearVideoSurface();
}
if (mBinding != null && mBinding.playView != null) {
mBinding.playView.stopPlay();
}
}
@Override
public void onVideoDestroy() {

View File

@@ -374,6 +374,8 @@ public class Constants {
public static final String DELAY = "/api/Friend/delay";//点击延时 交友房
public static final String END_FRIEND = "/api/Friend/end_friend";//点击结束 交友房
public static final String CREATE_RELATION = "/api/Friend/create_relation";//卡关系 (创建关系) 交友房
public static final String GET_BOX_GIFT_LIST = "/api/BlindBoxTurntable/get_gift_list";//获取活动礼物列表
public static final String POST_DRAW_GIFT_LIST = "/api/BlindBoxTurntable/draw_gift";//盲盒转盘抽奖

View File

@@ -0,0 +1,291 @@
package com.xscm.moduleutil.widget;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.google.android.material.card.MaterialCardView;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.utils.ImageUtils;
/**
* 礼物卡片控件 - 支持选中效果和自定义样式
*/
public class GiftCardView extends FrameLayout {
private ImageView mIconImageView;
private TextView mNameTextView;
private TextView mCountTextView;
private TextView mResultTextView;
private boolean isSelected = false;
private Drawable selectedBackground;
private Drawable normalBackground;
// 添加GiftBean数据引用
private GiftBean giftBean;
private ObjectAnimator pulseAnimator;
public GiftCardView(Context context) {
this(context, null);
}
public GiftCardView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public GiftCardView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initViews();
initAttributes(attrs);
}
private void initViews() {
LayoutInflater.from(getContext()).inflate(R.layout.view_gift_card, this, true);
mIconImageView = findViewById(R.id.img_gift_icon);
mNameTextView = findViewById(R.id.tv_gift_name);
mCountTextView = findViewById(R.id.tv_gift_count);
mResultTextView= findViewById(R.id.result);
// 设置默认点击事件
setOnClickListener(v -> {
if (getOnGiftClickListener() != null) {
getOnGiftClickListener().onGiftClick(this);
}
});
}
private void initAttributes(AttributeSet attrs) {
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.GiftCardView);
try {
// 获取自定义属性
String name = typedArray.getString(R.styleable.GiftCardView_giftName);
String count = typedArray.getString(R.styleable.GiftCardView_giftCount);
int iconResId = typedArray.getResourceId(R.styleable.GiftCardView_giftIcon, 0);
// 设置默认值
if (name != null) {
setName(name);
}
if (count != null) {
setCount(count);
}
if (iconResId != 0) {
setIcon("");
}
// 获取选中状态相关属性
selectedBackground = typedArray.getDrawable(R.styleable.GiftCardView_selectedBackground);
normalBackground = typedArray.getDrawable(R.styleable.GiftCardView_normalBackground);
// 如果没有设置选中背景,则使用默认的选中效果
if (selectedBackground == null) {
selectedBackground = ContextCompat.getDrawable(getContext(), R.mipmap.tkzj_x);
}
if (normalBackground == null) {
normalBackground = ContextCompat.getDrawable(getContext(), R.mipmap.tkzj_w);
}
// 设置默认背景
if (normalBackground != null) {
setBackground(normalBackground);
}
} finally {
typedArray.recycle();
}
}
/**
* 绑定GiftBean数据
*/
public void bindGiftData(GiftBean giftBean) {
this.giftBean = giftBean;
if (giftBean != null) {
// 设置礼物图标
if (giftBean.getBase_image() != null && !giftBean.getBase_image().isEmpty()) {
setIcon(giftBean.getBase_image());
// 如果是资源ID
} else {
setIcon("");
}
// 设置礼物名称
setName(giftBean.getGift_name() != null ? giftBean.getGift_name() : "未知礼物");
// 设置礼物数量
setCount(giftBean.getGift_price() != null ? giftBean.getGift_price() : "0");
setmResultTextView(giftBean.getNumber());
}
}
/**
* 获取绑定的GiftBean数据
*/
public GiftBean getGiftBean() {
return giftBean;
}
/**
* 设置礼物图标URL
*/
public void setIcon(String url) {
if (mIconImageView != null) {
if (url != null && !url.isEmpty()) {
ImageUtils.loadHeadCC(url, mIconImageView);
} else {
mIconImageView.setImageResource(R.mipmap.ic_launcher);
}
}
}
public void startPulseAnimationWithLayer() {
if (pulseAnimator != null && pulseAnimator.isRunning()) {
pulseAnimator.cancel();
}
pulseAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.9f, 1.1f);
pulseAnimator.setDuration(500);
pulseAnimator.setRepeatCount(ObjectAnimator.INFINITE);
pulseAnimator.setRepeatMode(ObjectAnimator.REVERSE);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 0.9f, 1.1f);
scaleYAnimator.setDuration(500);
scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
scaleYAnimator.setRepeatMode(ObjectAnimator.REVERSE);
// 组合动画
android.animation.AnimatorSet animatorSet = new android.animation.AnimatorSet();
animatorSet.playTogether(pulseAnimator, scaleYAnimator);
animatorSet.start();
}
public void stopPulseAnimationWithLayer() {
if (pulseAnimator != null) {
pulseAnimator.cancel();
}
this.setScaleX(1f);
this.setScaleY(1f);
}
/**
* 设置礼物名称
*/
public void setName(String name) {
if (mNameTextView != null) {
mNameTextView.setText(name);
}
}
/**
* 设置礼物数量
*/
public void setCount(String count) {
if (mCountTextView != null) {
mCountTextView.setText(count);
}
}
/**
* 设置选中状态
*/
public void setSelected(boolean selected) {
isSelected = selected;
if (selected) {
setBackground(selectedBackground);
// 可以添加额外的选中效果
setElevation(8f); // 提高阴影
// 添加发光效果
addGlowEffect();
} else {
setBackground(normalBackground);
setElevation(4f); // 恢复默认阴影
removeGlowEffect();
}
}
public void setmResultTextView(int num){
if (mResultTextView!=null) {
mResultTextView.setText("X" + num);
}
}
public void setVisibilitymResultTextView(boolean isVisible){
if (mResultTextView!=null) {
mResultTextView.setVisibility(isVisible?View.VISIBLE:View.GONE);
}
}
/**
* 添加发光效果
*/
private void addGlowEffect() {
// 使用LayerDrawable创建发光效果
GradientDrawable glow = new GradientDrawable();
glow.setColor(Color.TRANSPARENT);
glow.setStroke(8, Color.argb(150, 255, 255, 255));
glow.setCornerRadius(16f);
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{glow, getBackground()});
setBackground(layerDrawable);
}
/**
* 移除发光效果
*/
private void removeGlowEffect() {
setBackground(normalBackground);
}
/**
* 获取当前是否选中
*/
public boolean isSelected() {
return isSelected;
}
/**
* 切换选中状态
*/
public void toggleSelected() {
setSelected(!isSelected);
}
/**
* 设置点击监听器
*/
public void setOnGiftClickListener(OnGiftClickListener listener) {
this.onGiftClickListener = listener;
}
/**
* 获取点击监听器
*/
public OnGiftClickListener getOnGiftClickListener() {
return onGiftClickListener;
}
/**
* 点击监听器接口
*/
public interface OnGiftClickListener {
void onGiftClick(GiftCardView giftCardView);
}
private OnGiftClickListener onGiftClickListener;
}

View File

@@ -1,55 +1,377 @@
<?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">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:background="@mipmap/tkzj_bj">
<!-- 顶部抽奖按钮 -->
<LinearLayout
android:id="@+id/lottery_buttons_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="@dimen/dp_16"
android:gravity="center"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/btn_lottery_once"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/ll_one"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="抽奖一次" />
android:layout_weight="1"
android:background="@mipmap/chou_w"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/btn_lottery_ten"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="抽奖10次" />
<TextView
android:id="@+id/btn_lottery_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center"
android:text="抽一次"
android:textSize="@dimen/sp_12" />
<Button
android:id="@+id/btn_lottery_hundred"
android:layout_width="wrap_content"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb"
android:gravity="center"
android:text="10币一次"
android:textSize="@dimen/sp_10" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_ten"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="抽奖100次" />
android:layout_marginStart="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_8"
android:layout_weight="1"
android:background="@mipmap/chou_w"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/btn_lottery_ten"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center"
android:text="抽十次"
android:textSize="@dimen/sp_12" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb"
android:gravity="center"
android:text="100币一次"
android:textSize="@dimen/sp_10" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_hundred"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@mipmap/chou_w"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/btn_lottery_hundred"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center"
android:text="抽百次"
android:textSize="@dimen/sp_12" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb"
android:gravity="center"
android:text="1000币一次"
android:textSize="@dimen/sp_10" />
</LinearLayout>
</LinearLayout>
<!-- 礼物网格 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_gifts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/lottery_buttons_layout"
<TextView
android:id="@+id/tv_jc"
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_24"
android:layout_marginTop="@dimen/dp_60"
android:background="@mipmap/tkzi_rigth_bj"
android:gravity="center"
android:text="奖池"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gz"
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_24"
android:background="@mipmap/tkzj_left_bj"
android:gravity="center"
android:text="规则"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_jc" />
<TextView
android:id="@+id/tv_jl"
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_24"
android:layout_marginTop="@dimen/dp_10"
android:background="@mipmap/tkzj_left_bj"
android:gravity="center"
android:text="记录"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_gz" />
<LinearLayout
android:id="@+id/ll_yx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_60"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintTop_toBottomOf="@+id/gift10"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/tv_lock_yx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="音效"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
/>
<Switch
android:id="@+id/sw_lock_yx"
android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_tx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_17"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="@+id/ll_yx"
app:layout_constraintStart_toEndOf="@+id/ll_yx">
<TextView
android:id="@+id/tv_tx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="特效"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
/>
<Switch
android:id="@+id/sw_tex"
android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift1"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_5"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_jl"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift2"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_11"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toEndOf="@+id/gift1"
app:layout_constraintTop_toTopOf="@+id/gift1"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift3"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_11"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toEndOf="@+id/gift2"
app:layout_constraintTop_toTopOf="@+id/gift2"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift4"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginEnd="@dimen/dp_20"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/gift3"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift5"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_20"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gift3"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift6"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_20"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gift5"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift7"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_20"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gift6"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift8"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_11"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toEndOf="@+id/gift9"
app:layout_constraintTop_toTopOf="@+id/gift7"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift9"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_11"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toEndOf="@+id/gift10"
app:layout_constraintTop_toTopOf="@+id/gift8"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift10"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_16"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/gift9"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift11"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_16"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/gift6"
app:layout_constraintWidth_percent="0.2"
/>
<com.xscm.moduleutil.widget.GiftCardView
android:id="@+id/gift12"
android:layout_width="0dp"
android:layout_height="@dimen/dp_93"
android:layout_marginStart="@dimen/dp_16"
app:giftCount="66666"
app:giftIcon="@mipmap/ic_launcher"
app:giftName="柔情似水"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/gift5"
app:layout_constraintWidth_percent="0.2"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="center"
android:layout_gravity="center"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center">
<ImageView
android:id="@+id/img_gift_icon"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/tv_gift_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4"
android:text="礼物名称"
android:singleLine="true"
android:maxLines="1"
android:ellipsize="end"
android:gravity="center"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_gift_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="999"
android:drawableLeft="@mipmap/jinb"
android:gravity="center"
android:textColor="#C7BF62"
android:textSize="@dimen/sp_10" />
</LinearLayout>
<TextView
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_15"
android:gravity="center"
tools:text="x1000"
android:textStyle="bold"
android:textColor="#024AA7"
android:textSize="18sp"
android:visibility="gone"/>
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -461,4 +461,12 @@
<attr name="me_piv_subtitle" format="string" />
<attr name="me_piv_url" format="string" />
</declare-styleable>
<!--抽奖礼物的属性-->
<declare-styleable name="GiftCardView">
<attr name="giftName" format="string" />
<attr name="giftCount" format="string" />
<attr name="giftIcon" format="reference" />
<attr name="selectedBackground" format="reference" />
<attr name="normalBackground" format="reference" />
</declare-styleable>
</resources>