1:优化礼物播放和下载方式
2:优化转盘展示效果
This commit is contained in:
@@ -9,7 +9,9 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.GridView;
|
||||
|
||||
@@ -133,7 +135,29 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
setupUIBasedOnUserType();
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 获取屏幕高度
|
||||
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = (int) (screenHeight * 0.8);;
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
private void setupUIBasedOnUserType() {
|
||||
switch (userIdType) {
|
||||
case MIRROR_SKY://天空之境
|
||||
@@ -383,6 +407,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
for (GiftCardView gridView : allViewsArray) {
|
||||
gridView.setSelected(false);
|
||||
gridView.stopPulseAnimationWithLayer();
|
||||
gridView.setVisibilitymResultTextView(false);
|
||||
}
|
||||
currentGiftCardView = allViewsArray.get(0);
|
||||
currentGiftCardView.setSelected(true);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xscm.moduleutil.dialog.giftLottery;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
@@ -70,9 +71,8 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = screenHeight;
|
||||
int heightInPx = (int) (screenHeight * 0.8);;
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
@@ -80,6 +80,12 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
@@ -111,13 +117,14 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
page = 1;
|
||||
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
page++;
|
||||
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||
}
|
||||
});
|
||||
@@ -170,6 +177,7 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
setTextViewStyle(mBinding.textView2, true);
|
||||
setTextViewStyle(mBinding.textView1, false);
|
||||
}
|
||||
page=1;
|
||||
data.clear();
|
||||
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||
}
|
||||
@@ -210,6 +218,10 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
}else {
|
||||
adapter.addData(data);
|
||||
}
|
||||
}else {
|
||||
if (page == 1) {
|
||||
adapter.setNewData(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +233,10 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
|
||||
}else {
|
||||
adapter.addData(data);
|
||||
}
|
||||
}else {
|
||||
if (page == 1) {
|
||||
adapter.setNewData(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xscm.moduleutil.dialog.giftLottery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -21,18 +22,36 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/8/28
|
||||
*@description: 盲盒转盘奖池弹窗
|
||||
* @author qx
|
||||
* @data 2025/8/28
|
||||
* @description: 盲盒转盘奖池弹窗
|
||||
*/
|
||||
public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
|
||||
private Context mContext;
|
||||
private List<GiftBean> gift_list;
|
||||
private int type ;
|
||||
private int type;
|
||||
|
||||
public PrizePoolDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
// 设置对话框从底部弹出并紧贴底部
|
||||
if (getWindow() != null) {
|
||||
getWindow().setGravity(android.view.Gravity.BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getWindow() != null) {
|
||||
// 获取屏幕尺寸
|
||||
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||
// 设置高度为屏幕高度的80%
|
||||
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = (int) (displayMetrics.heightPixels * 0.8);
|
||||
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +62,6 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -60,14 +77,14 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
|
||||
}
|
||||
|
||||
// 提供更新数据的方法
|
||||
public void updateData(List<GiftBean> newData ,int type) {
|
||||
if (type==10){
|
||||
public void updateData(List<GiftBean> newData, int type) {
|
||||
if (type == 10) {
|
||||
mBinding.clPrize.setBackgroundResource(R.mipmap.tkzj);
|
||||
mBinding.imJc.setImageResource(R.mipmap.jiangc);
|
||||
}else if (type==11){
|
||||
} else if (type == 11) {
|
||||
mBinding.clPrize.setBackgroundResource(R.mipmap.syzc);
|
||||
mBinding.imJc.setImageResource(R.mipmap.syzc_jc);
|
||||
}else if (type==12){
|
||||
} else if (type == 12) {
|
||||
mBinding.clPrize.setBackgroundResource(R.mipmap.skzj);
|
||||
mBinding.imJc.setImageResource(R.mipmap.skzl_jc);
|
||||
}
|
||||
@@ -77,13 +94,13 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
|
||||
float density = mContext.getResources().getDisplayMetrics().density;
|
||||
|
||||
if (density <= 2.0) { // 低密度屏幕(如mdpi, hdpi)
|
||||
rows = 3;
|
||||
columns = 2;
|
||||
rows = 5;
|
||||
columns = 3;
|
||||
} else if (density <= 3.0) { // 中密度屏幕(如xhdpi)
|
||||
rows = 3;
|
||||
rows = 5;
|
||||
columns = 3;
|
||||
} else { // 高密度屏幕(如xxhdpi, xxxhdpi)
|
||||
rows = 4;
|
||||
rows = 5;
|
||||
columns = 3;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user