修改动画
This commit is contained in:
@@ -99,14 +99,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
private String blind_box_turntable_id = "";//本次抽奖标识id
|
||||
private BlindBoxBean.XlhData xlhData;
|
||||
private int icon;//金币金额
|
||||
private String heart_id="";
|
||||
private String heart_id = "";
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
return new GiftLotteryPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static GiftLotteryDialog newInstance(String giftBagId, String roomId, String userIds,String heart_id) {
|
||||
public static GiftLotteryDialog newInstance(String giftBagId, String roomId, String userIds, String heart_id) {
|
||||
GiftLotteryDialog dialog = new GiftLotteryDialog();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("giftBagId", giftBagId);
|
||||
@@ -135,9 +135,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
userIds = getArguments().getString("userIds");
|
||||
// 根据userIds确定类型
|
||||
userIdType = LotteryEvent.fromLotteryEvent(giftBagId);
|
||||
heart_id=getArguments().getString("heart_id");
|
||||
heart_id = getArguments().getString("heart_id");
|
||||
|
||||
if (!EventBus.getDefault().isRegistered( this)){
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
}
|
||||
@@ -149,8 +149,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.mirroeSky.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -158,8 +158,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.cityTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -167,8 +167,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.pinnacleTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -176,36 +176,36 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.mirroeSky.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
mBinding.cityTime.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
mBinding.pinnacleTime.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void stopPlay(){
|
||||
if(mediaPlayer!=null&&player!=null){
|
||||
private void stopPlay() {
|
||||
if (mediaPlayer != null && player != null) {
|
||||
player.stop();
|
||||
player.reset();
|
||||
player=null;
|
||||
player = null;
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.reset();
|
||||
mediaPlayer=null;
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// 根据不同的用户类型显示不同的界面
|
||||
@@ -379,7 +379,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(1);
|
||||
startType = 1;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1", heart_id);
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
return;
|
||||
@@ -389,7 +389,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(2);
|
||||
startType = 2;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6", heart_id);
|
||||
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
@@ -399,7 +399,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(3);
|
||||
startType = 3;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9", heart_id);
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
}
|
||||
@@ -579,17 +579,18 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceived(MqttXlhEnd event) {
|
||||
XLHBean xlhBean= GsonUtils.fromJson(event.getMessage(), XLHBean.class);
|
||||
XLHBean xlhBean = GsonUtils.fromJson(event.getMessage(), XLHBean.class);
|
||||
// if (xlhBean.getFrom_type()==3) {
|
||||
// dismiss();
|
||||
// }
|
||||
// BlindBoxBean.XlhData xlhData =new BlindBoxBean.XlhData();
|
||||
if (xlhBean.getFrom_type()==3) {
|
||||
if (xlhBean.getFrom_type() == 3) {
|
||||
xlhData.setCurrent_num(0);
|
||||
xlhData.setStatus(0);
|
||||
UpView(xlhData);
|
||||
}
|
||||
}
|
||||
|
||||
/// 定时器
|
||||
public void startFastAnimate() {
|
||||
if (allViewsArray.isEmpty()) {
|
||||
@@ -606,10 +607,10 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
// 停止之前的定时器
|
||||
stopFastAnimate();
|
||||
Log.e("isOpenSound===","isOpenSound111"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound111" + isOpenSound);
|
||||
if (isOpenSound) {
|
||||
// 假设此处有播放音乐的逻辑
|
||||
Log.e("isOpenSound===","raw_music.mp");
|
||||
Log.e("isOpenSound===", "raw_music.mp");
|
||||
playSound("draw_music.mp3");
|
||||
// isOpenSound=false;
|
||||
}
|
||||
@@ -708,7 +709,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
|
||||
private MediaPlayer player;
|
||||
MediaPlayer mediaPlayer ;
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
// 播放音频的方法
|
||||
private void playSound(String fileName) {
|
||||
try {
|
||||
@@ -734,12 +736,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
player.prepare();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// 如果assets中没有找到文件,尝试从raw资源目录加载
|
||||
// try {
|
||||
// player = MediaPlayer.create(getContext(), R.raw.draw_music);
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
AssetFileDescriptor afd = getContext().getAssets().openFd(fileName);
|
||||
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
|
||||
player.prepare();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return player;
|
||||
@@ -883,7 +887,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
if (blindReslutBean.getBlind_box_turntable_id() != null) {
|
||||
blind_box_turntable_id = blindReslutBean.getBlind_box_turntable_id();
|
||||
}
|
||||
if (allViewsArray.size()>0) {
|
||||
if (allViewsArray.size() > 0) {
|
||||
for (int i = 0; i < blindReslutBean.getReslut_list().size(); i++) {
|
||||
BlindReslutBean.ReslutList reslutList = blindReslutBean.getReslut_list().get(i);
|
||||
|
||||
@@ -910,25 +914,25 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MvpPre==null){
|
||||
if (MvpPre == null) {
|
||||
MvpPre = new GiftLotteryPresenter(this, getActivity());
|
||||
}
|
||||
MvpPre.wallet();
|
||||
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound1222" + isOpenSound);
|
||||
if (isOpenSpecial) {//特效
|
||||
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound333" + isOpenSound);
|
||||
startFastAnimate();
|
||||
}else{
|
||||
if(isOpenSound){//音效
|
||||
} else {
|
||||
if (isOpenSound) {//音效
|
||||
isDrawing = false;
|
||||
playSound("xuanz.mp3");
|
||||
}else {
|
||||
} else {
|
||||
isDrawing = false;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isDrawing = false;
|
||||
}
|
||||
|
||||
@@ -966,7 +970,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
} else if (type == 12) {
|
||||
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// dialog 已关闭,不进行 UI 更新
|
||||
return;
|
||||
}
|
||||
@@ -1050,7 +1054,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
player = null;
|
||||
}
|
||||
|
||||
if (EventBus.getDefault().isRegistered( this)){
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = (int) (screenHeight * 0.79);
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
int heightInPx = (int) (screenHeight * 0.85);
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
@@ -175,6 +175,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
mBinding.recycleView.scrollToPosition(middlePosition);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 添加自动滚动相关的方法
|
||||
@@ -323,6 +324,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
@Override
|
||||
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||
if (blindBoxBean != null) {
|
||||
|
||||
getRule_url = blindBoxBean.getRule_url();
|
||||
upTitle(blindBoxBean.getBox_price());
|
||||
giftLists = blindBoxBean.getGift_list();
|
||||
@@ -332,9 +334,10 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
// 获取结束时间并启动倒计时
|
||||
if (blindBoxBean.getXlh_end_time() != null && !blindBoxBean.getXlh_end_time().isEmpty()) {
|
||||
try {
|
||||
// 假设 end_time 是时间戳字符串
|
||||
endTime = Long.parseLong(blindBoxBean.getXlh_end_time());
|
||||
startCountdown();
|
||||
mBinding.qxDjs.setEndTime(endTime);
|
||||
// 假设 end_time 是时间戳字符串
|
||||
// startCountdown();
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果不是时间戳,可能是日期字符串,需要相应解析
|
||||
// 例如:2025-08-26 19:10:47
|
||||
@@ -344,20 +347,30 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
}
|
||||
|
||||
if (blindBoxBean.getGive_homeowner_gift() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getGive_homeowner_gift().getBase_image(), mBinding.giveIm);
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getGive_homeowner_gift().getBase_image(), mBinding.giveIm);
|
||||
mBinding.gvFzlw.setModel(blindBoxBean.getGive_homeowner_gift());
|
||||
}
|
||||
if (blindBoxBean.getLocking_gift() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getLocking_gift().getBase_image(), mBinding.giftImg);
|
||||
mBinding.tvGiftName.setText(blindBoxBean.getLocking_gift().getGift_name());
|
||||
mBinding.tvGiftPrice.setText(blindBoxBean.getLocking_gift().getGift_price());
|
||||
mBinding.tvGiftCount.setText(blindBoxBean.getLocking_gift().getGift_num());
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getLocking_gift().getBase_image(), mBinding.giftImg);
|
||||
// mBinding.tvGiftName.setText(blindBoxBean.getLocking_gift().getGift_name());
|
||||
// mBinding.tvGiftPrice.setText(blindBoxBean.getLocking_gift().getGift_price());
|
||||
// mBinding.tvGiftCount.setText(blindBoxBean.getLocking_gift().getGift_num());
|
||||
|
||||
mBinding.gvSdlw.setModel(blindBoxBean.getLocking_gift());
|
||||
mBinding.gvSdlw.setIsLockGift(true);
|
||||
mBinding.gvSdlw.stopAnimation();
|
||||
mBinding.gvSdlw.startAnimation();
|
||||
}
|
||||
|
||||
if (blindBoxBean.getXlh_user() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getXlh_user().getAvatar(), mBinding.userPic);
|
||||
mBinding.userName.setText(blindBoxBean.getXlh_user().getNickname());
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getXlh_user().getAvatar(), mBinding.userPic);
|
||||
// mBinding.userName.setText(blindBoxBean.getXlh_user().getNickname());
|
||||
|
||||
mBinding.gvXyz.setModel(blindBoxBean.getXlh_user());
|
||||
}
|
||||
|
||||
}
|
||||
mBinding.gvFz.setIsLuckUser(false);
|
||||
giftXlhChouAdapter.setNewData(giftLists);
|
||||
// // 数据加载完成后启动自动滚动
|
||||
// if (giftLists != null && !giftLists.isEmpty()) {
|
||||
@@ -434,6 +447,9 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
long remainingSeconds = seconds % 60;
|
||||
updateCountdownDisplay((int) minutes, (int) remainingSeconds);
|
||||
}
|
||||
mBinding.gvXyz.setIsLuckUser(true);
|
||||
if (blindBoxBean.getHomeowner_user()!=null){
|
||||
mBinding.gvFz.setModel(blindBoxBean.getHomeowner_user());
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
Reference in New Issue
Block a user