Compare commits
11 Commits
dev_lxj
...
abed908e70
| Author | SHA1 | Date | |
|---|---|---|---|
| abed908e70 | |||
| f68f6721e9 | |||
| 062fc7b0ed | |||
| 4a21c866f4 | |||
| 4e06c6742d | |||
| e5a7b480c3 | |||
| 888c04ce11 | |||
| 903ea22dfd | |||
| 9f54c26d0e | |||
| 3d54880dc0 | |||
| 5c5d2550bd |
@@ -434,7 +434,8 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
// startService(mqttServiceIntent);
|
||||
// }
|
||||
|
||||
mqttConnect=MqttConnect.getInstance(this,"tcp://62.234.12.147","android-"+ MqttClient.generateClientId());
|
||||
mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.181.248","android-"+ MqttClient.generateClientId());
|
||||
// mqttConnect=MqttConnect.getInstance(this,"tcp://62.234.12.147","android-"+ MqttClient.generateClientId());
|
||||
mqttConnect.mqttClient();
|
||||
|
||||
// 每次启动应用时重置状态
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.Data;
|
||||
public class GiftBean {
|
||||
|
||||
private String gift_id;
|
||||
private String periods;
|
||||
private String gift_name;
|
||||
private String gift_price;
|
||||
private int file_type;
|
||||
|
||||
@@ -31,7 +31,9 @@ public class BlindBoxBean {
|
||||
private GiveGift give_homeowner_gift;//房主礼物
|
||||
private GiveGift locking_gift;//锁定礼物
|
||||
|
||||
|
||||
private xlhUser xlh_user;//巡乐会中奖用户
|
||||
private xlhUser homeowner_user;//房主信息
|
||||
|
||||
public boolean isXlhDataArray() {
|
||||
return xlh_data instanceof JsonArray || xlh_data instanceof List;
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.xscm.moduleutil.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Choreographer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||
import com.xscm.moduleutil.databinding.DialogNewRankingXlhFragmentBinding;
|
||||
import com.xscm.moduleutil.databinding.FframentDataBinding;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryContacts;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryPresenter;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.GiftRecordAdapte;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.NewGiftRecordAdapte;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LotteryFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FframentDataBinding> implements GiftLotteryContacts.View {
|
||||
private int page=1;
|
||||
private String roomId;
|
||||
private int type=-1;
|
||||
private GiftRecordAdapte giftRecordAdapte;
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||
}
|
||||
public static LotteryFragment newInstance(String giftBagId,int type) {
|
||||
Bundle args = new Bundle();
|
||||
LotteryFragment fragment = new LotteryFragment();
|
||||
args.putString("roomId", giftBagId);
|
||||
args.putInt("type",type);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
roomId = getArguments().getString("roomId");
|
||||
type = getArguments().getInt("type");
|
||||
MvpPre.xlhAllRecord(roomId, "1", "20",type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
giftRecordAdapte=new GiftRecordAdapte();
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fframent_data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||
|
||||
if (data != null){
|
||||
if (page==1){
|
||||
giftRecordAdapte.setNewData(data);
|
||||
}else {
|
||||
giftRecordAdapte.addData(data);
|
||||
}
|
||||
}else {
|
||||
if (page == 1) {
|
||||
giftRecordAdapte.setNewData(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void finishRefreshLoadMore() {
|
||||
mBinding.smartRefreshLayout.finishRefresh();
|
||||
mBinding.smartRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class GiftLotteryContacts {
|
||||
|
||||
void xlhChou(String room_id,String num);
|
||||
|
||||
void xlhAllRecord(String room_id,String page,String pageSize);
|
||||
void xlhAllRecord(String room_id,String page,String pageSize,int type);
|
||||
|
||||
void xlhMyRecord(String room_id,String page,String pageSize);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,22 +173,26 @@ public class GiftLotteryPresenter extends BasePresenter<GiftLotteryContacts.View
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xlhAllRecord(String room_id, String page, String pageSize) {
|
||||
api.xlhAllRecord(room_id,page,pageSize,new BaseObserver<List<GiftBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
public void xlhAllRecord(String room_id, String page, String pageSize,int type) {
|
||||
|
||||
@Override
|
||||
public void onNext(List<GiftBean> giftBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
|
||||
api.xlhAllRecord(room_id, page, pageSize,type, new BaseObserver<List<GiftBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
MvpRef.get().getAllRecordSuccess(giftBean);
|
||||
MvpRef.get().finishRefreshLoadMore();
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onNext(List<GiftBean> giftBean) {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getAllRecordSuccess(giftBean);
|
||||
MvpRef.get().finishRefreshLoadMore();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ public class GiftRecordAdapte extends BaseQuickAdapter<GiftBean, BaseViewHolder>
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||
|
||||
helper.setText(R.id.tv_user_name, item.getNickname());
|
||||
helper.setText(R.id.tv_gift_count_name,"x"+item.getCount()+" "+ item.getGift_name());
|
||||
helper.setText(R.id.tv_time, item.getCreatetime());
|
||||
|
||||
@@ -82,8 +82,11 @@ public class GiftXlhChouAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolde
|
||||
if (selectedIcon != null) {
|
||||
// 检查当前item是否为选中位置
|
||||
if (actualPosition == selectedPosition) {
|
||||
selectedIcon.setVisibility(View.VISIBLE);
|
||||
selectedIcon.setVisibility(View.GONE);
|
||||
helper.setBackgroundRes(R.id.ll_bg,R.mipmap.ke_bg);
|
||||
|
||||
} else {
|
||||
helper.setBackgroundRes(R.id.ll_bg,R.mipmap.xlh_cj_item);
|
||||
selectedIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.xscm.moduleutil.dialog.giftLottery;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||
import com.xscm.moduleutil.databinding.FframentDataBinding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LuckyFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FframentDataBinding> implements GiftLotteryContacts.View {
|
||||
private int page=1;
|
||||
private String roomId;
|
||||
private int type=-1;
|
||||
private NewGiftRecordAdapte giftRecordAdapte;
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||
}
|
||||
public static LuckyFragment newInstance(String giftBagId, int type) {
|
||||
Bundle args = new Bundle();
|
||||
LuckyFragment fragment = new LuckyFragment();
|
||||
args.putString("roomId", giftBagId);
|
||||
args.putInt("type",type);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
roomId = getArguments().getString("roomId");
|
||||
type = getArguments().getInt("type");
|
||||
MvpPre.xlhAllRecord(roomId, "1", "20",type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
giftRecordAdapte=new NewGiftRecordAdapte();
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fframent_data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||
|
||||
if (data != null){
|
||||
if (page==1){
|
||||
giftRecordAdapte.setNewData(data);
|
||||
}else {
|
||||
giftRecordAdapte.addData(data);
|
||||
}
|
||||
}else {
|
||||
if (page == 1) {
|
||||
giftRecordAdapte.setNewData(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void finishRefreshLoadMore() {
|
||||
mBinding.smartRefreshLayout.finishRefresh();
|
||||
mBinding.smartRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xscm.moduleutil.dialog.giftLottery;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
public class NewGiftRecordAdapte extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||
public NewGiftRecordAdapte() {
|
||||
super(R.layout.item_gift_record_new);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||
helper.setText(R.id.tv_issue,item.getPeriods());
|
||||
helper.setText(R.id.tv_user_name, item.getNickname());
|
||||
helper.setText(R.id.tv_gift_count_name, item.getGift_name());
|
||||
helper.setText(R.id.tv_time, item.getCreatetime());
|
||||
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_icon));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
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.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.adapter.MyPagerAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||
import com.xscm.moduleutil.databinding.DialogNewRankingXlhFragmentBinding;
|
||||
import com.xscm.moduleutil.dialog.LotteryFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/4
|
||||
*@description:巡乐会榜单
|
||||
*/
|
||||
public class NewXlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogNewRankingXlhFragmentBinding> implements GiftLotteryContacts.View{
|
||||
private String roomId;
|
||||
|
||||
private MyPagerAdapter pagerAdapter;
|
||||
private List<Fragment> fragmentList;
|
||||
private List<String> titleList = new ArrayList();
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||
}
|
||||
|
||||
public static NewXlhRankingDialog newInstance(String giftBagId) {
|
||||
Bundle args = new Bundle();
|
||||
NewXlhRankingDialog fragment = new NewXlhRankingDialog();
|
||||
args.putString("roomId", giftBagId);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setCancelable(true);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
roomId = getArguments().getString("roomId");
|
||||
// MvpPre.xlhAllRecord(roomId, "1", "20");
|
||||
// 初始化Fragment列表
|
||||
initFragments();
|
||||
initViewPager();
|
||||
}
|
||||
|
||||
// 初始化Fragment列表
|
||||
private void initFragments() {
|
||||
fragmentList = new ArrayList<>();
|
||||
fragmentList.add(new LotteryFragment().newInstance(roomId,1)); // 第1页:抽奖榜单
|
||||
fragmentList.add(new LuckyFragment().newInstance(roomId,2)); // 第1页:抽奖榜单
|
||||
|
||||
}
|
||||
|
||||
// 初始化ViewPager
|
||||
private void initViewPager() {
|
||||
titleList.add("");
|
||||
titleList.add("");
|
||||
FragmentManager childFragmentManager = getChildFragmentManager();
|
||||
pagerAdapter = new MyPagerAdapter(childFragmentManager, fragmentList,titleList );
|
||||
mBinding.ivViewPager.setAdapter(pagerAdapter);
|
||||
mBinding.ivViewPager.setCurrentItem(0); // 默认显示第1页
|
||||
}
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.rbBtn.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId==R.id.radio_all){
|
||||
mBinding.ivViewPager.setCurrentItem(0);
|
||||
}else {
|
||||
mBinding.ivViewPager.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_new_ranking_xlh_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRefreshLoadMore() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.xscm.moduleutil.dialog.giftLottery;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
@@ -57,7 +58,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
private CountDownTimer mCountDownTimer;
|
||||
private long endTime; // 服务器返回的结束时间戳
|
||||
private String num;
|
||||
private XlhRankingDialog xlhRankingDialog;
|
||||
private NewXlhRankingDialog newXlhRankingDialog;
|
||||
private XlhRecordDialog xlhRecordDialog;
|
||||
private XlhObtainDialog xlhObtainDialog;
|
||||
|
||||
@@ -136,8 +137,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);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
@@ -181,6 +182,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
mBinding.recycleView.scrollToPosition(middlePosition);
|
||||
}
|
||||
});
|
||||
mBinding.tvNumber.setText("x0");
|
||||
mBinding.tvNumber.setTypeface(android.graphics.Typeface.create("sans-serif-condensed", Typeface.BOLD));
|
||||
}
|
||||
|
||||
// 添加自动滚动相关的方法
|
||||
@@ -298,12 +301,12 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
dialog.show();
|
||||
} else if (id == R.id.tv_bd) {
|
||||
// 如果当前dialog存在且正在显示,先关闭
|
||||
if (xlhRankingDialog != null && xlhRankingDialog.isVisible()) {
|
||||
xlhRankingDialog.dismiss();
|
||||
if (newXlhRankingDialog != null && newXlhRankingDialog.isVisible()) {
|
||||
newXlhRankingDialog.dismiss();
|
||||
}
|
||||
|
||||
xlhRankingDialog = XlhRankingDialog.newInstance(roomId);
|
||||
xlhRankingDialog.show(getChildFragmentManager(), "XlhRankingDialog");
|
||||
newXlhRankingDialog = NewXlhRankingDialog.newInstance(roomId);
|
||||
newXlhRankingDialog.show(getChildFragmentManager(), "newXlhRankingDialog");
|
||||
} else if (id == R.id.tv_jl) {
|
||||
// 如果当前dialog存在且正在显示,先关闭
|
||||
if (xlhRecordDialog != null && xlhRecordDialog.isVisible()) {
|
||||
@@ -329,6 +332,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();
|
||||
@@ -338,9 +342,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
|
||||
@@ -350,20 +355,33 @@ 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.tvNumber.setText("x"+(blindBoxBean.getLocking_gift().getGift_num()!=null ?blindBoxBean.getLocking_gift().getGift_num():"0"));
|
||||
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.gvXyz.setIsLuckUser(true);
|
||||
if (blindBoxBean.getHomeowner_user()!=null){
|
||||
mBinding.gvFz.setModel(blindBoxBean.getHomeowner_user());
|
||||
|
||||
}
|
||||
mBinding.gvFz.setIsLuckUser(false);
|
||||
giftXlhChouAdapter.setNewData(giftLists);
|
||||
// // 数据加载完成后启动自动滚动
|
||||
// if (giftLists != null && !giftLists.isEmpty()) {
|
||||
@@ -394,10 +412,17 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
if (message.getMsgType() == 1057) {
|
||||
// UpView(message.getText().getXlh_data());
|
||||
endTime = Long.parseLong(message.getText().getEnd_time() != null ? message.getText().getEnd_time() : "0");
|
||||
startCountdown();
|
||||
mBinding.tvGiftCount.setText(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0");
|
||||
mBinding.userName.setText(message.getText().getFromUserInfo().getNickname() != null ? message.getText().getFromUserInfo().getNickname() : "");
|
||||
ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
||||
// startCountdown();
|
||||
// mBinding.tvGiftCount.setText(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0");
|
||||
// mBinding.userName.setText(message.getText().getFromUserInfo().getNickname() != null ? message.getText().getFromUserInfo().getNickname() : "");
|
||||
// ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
||||
BlindBoxBean.xlhUser xlhUser = new BlindBoxBean.xlhUser();
|
||||
xlhUser.setAvatar(message.getText().getFromUserInfo().getAvatar());
|
||||
xlhUser.setNickname(message.getText().getFromUserInfo().getNickname());
|
||||
mBinding.gvXyz.setModel(xlhUser);
|
||||
mBinding.qxDjs.setEndTime(endTime);
|
||||
mBinding.tvNumber.setText("x"+(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0"));
|
||||
|
||||
isDrawing=false;
|
||||
}
|
||||
}
|
||||
@@ -517,8 +542,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
}
|
||||
|
||||
// 如果当前dialog存在且正在显示,先关闭
|
||||
if (xlhRankingDialog != null && xlhRankingDialog.isVisible()) {
|
||||
xlhRankingDialog.dismiss();
|
||||
if (newXlhRankingDialog != null && newXlhRankingDialog.isVisible()) {
|
||||
newXlhRankingDialog.dismiss();
|
||||
}
|
||||
|
||||
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class XlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter
|
||||
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||
}
|
||||
|
||||
public static XlhRankingDialog newInstance(String giftBagId) {
|
||||
public static XlhRankingDialog newInstance(String giftBagId,int type) {
|
||||
Bundle args = new Bundle();
|
||||
XlhRankingDialog fragment = new XlhRankingDialog();
|
||||
args.putString("roomId", giftBagId);
|
||||
@@ -93,7 +93,7 @@ public class XlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.xlhAllRecord(roomId, "1", "20");
|
||||
MvpPre.xlhAllRecord(roomId, "1", "20",1);
|
||||
|
||||
}
|
||||
|
||||
@@ -105,14 +105,14 @@ public class XlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20");
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20");
|
||||
MvpPre.xlhAllRecord(roomId, page+"", "20",1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -767,6 +767,9 @@ public interface ApiServer {
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_XLH_ALL_RECORD)
|
||||
Call<BaseModel<List<GiftBean>>> xlhAllRecord(@Field("room_id") String room_id, @Field("page") String page, @Field("page_size") String page_size);
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.Get_XH_RANking)
|
||||
Call<BaseModel<List<GiftBean>>> xlXH_RANking(@Field("room_id") String room_id, @Field("page") String page, @Field("page_size") String page_size);
|
||||
|
||||
@GET(Constants.GET_XLH_MY_RECORD)
|
||||
Call<BaseModel<List<GiftBean>>> xlhMyRecord(@Query("room_id") String room_id, @Query("page") String page, @Query("page_size") String page_size);
|
||||
|
||||
@@ -193,7 +193,6 @@ public class RetrofitClient {
|
||||
|
||||
private Retrofit provideRetrofit(OkHttpClient client) {
|
||||
return new Retrofit.Builder()
|
||||
.addConverterFactory(new BusinessAwareConverterFactory(CommonAppContext.getInstance()))
|
||||
.addConverterFactory(MyConverterFactory.create())/**/
|
||||
// .addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
@@ -281,7 +280,6 @@ public class RetrofitClient {
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> body = response.body();
|
||||
|
||||
observer.onNext(body.getMsg());
|
||||
|
||||
}
|
||||
@@ -391,7 +389,6 @@ public class RetrofitClient {
|
||||
sApiServer.exchangeCoin(earnings_num).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@@ -425,7 +422,7 @@ public class RetrofitClient {
|
||||
public void onResponse(Call<BaseModel<FirstChargeBean>> call, Response<BaseModel<FirstChargeBean>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<FirstChargeBean> baseModel = response.body();
|
||||
if (baseModel.getCode()==1){
|
||||
if (baseModel != null) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else {
|
||||
ToastUtils.showShort("获取数据失败");
|
||||
@@ -1326,8 +1323,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<MyRoomBean>>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("获取房间列表失败", t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1371,8 +1367,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<TopRoom>>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("getTopRooms", t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1859,8 +1854,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<MyCpRoom>>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("myCpRoom", t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2059,7 +2053,8 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
// TODO: 2025/3/15 获取主持人列表
|
||||
public void getHostList(String roomId, String type, BaseObserver<List<HostBean>> observer) {
|
||||
public void getHostList(String roomId, String
|
||||
type, BaseObserver<List<HostBean>> observer) {
|
||||
sApiServer.getHostList(roomId, type).enqueue(new Callback<BaseModel<List<HostBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<HostBean>>> call, Response<BaseModel<List<HostBean>>> response) {
|
||||
@@ -2078,7 +2073,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getSearch(String keyWord, String type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
public void getSearch(String keyWord, String
|
||||
type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
sApiServer.getSearch(keyWord, type).enqueue(new Callback<BaseModel<List<RoomSearchResp>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomSearchResp>>> call, Response<BaseModel<List<RoomSearchResp>>> response) {
|
||||
@@ -2117,7 +2113,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getCharmList(String roomId, String stime, String etime, String p, BaseObserver<RoomDetails> observer) {
|
||||
public void getCharmList(String roomId, String stime, String etime, String
|
||||
p, BaseObserver<RoomDetails> observer) {
|
||||
sApiServer.getCharmList(roomId, stime, etime, p).enqueue(new Callback<BaseModel<RoomDetails>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RoomDetails>> call, Response<BaseModel<RoomDetails>> response) {
|
||||
@@ -2180,20 +2177,29 @@ public class RetrofitClient {
|
||||
sApiServer.roomAuctionJoin(auctionId, userId, giftId, num, type).enqueue(new ApiResponseCallback<RoomAuction.AuctionListBean>(CommonAppContext.getInstance()) {
|
||||
@Override
|
||||
public void onSuccess(RoomAuction.AuctionListBean data) {
|
||||
// 确保即使data为null也能够正确传递给observer
|
||||
if (data == null){
|
||||
data = new RoomAuction.AuctionListBean();
|
||||
}
|
||||
observer.onNext(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
super.onFailure(t);
|
||||
RoomAuction.AuctionListBean yy=new RoomAuction.AuctionListBean();
|
||||
observer.onNext(yy);
|
||||
}
|
||||
});
|
||||
});
|
||||
// .enqueue(new Callback<BaseModel<RoomAuction.AuctionListBean>>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(Call<BaseModel<RoomAuction.AuctionListBean>> call, Response<BaseModel<RoomAuction.AuctionListBean>> response) {
|
||||
// if (response.code() == 200) {
|
||||
// BaseModel<RoomAuction.AuctionListBean> baseModel = response.body();
|
||||
//
|
||||
// if (baseModel.getCode() == 1) {
|
||||
// observer.onNext( null);
|
||||
// } else {
|
||||
// ToastUtils.showShort(baseModel.getMsg());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Call<BaseModel<RoomAuction.AuctionListBean>> call, Throwable t) {
|
||||
// t.printStackTrace();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void auctionDelay(String auctionId, BaseObserver<String> observer) {
|
||||
@@ -2206,7 +2212,6 @@ public class RetrofitClient {
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("auction",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2224,7 +2229,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2238,7 +2243,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2252,7 +2257,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2268,8 +2273,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editRoom",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2284,8 +2288,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setPresidedRatio",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2301,8 +2304,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("postHostAdd",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2317,8 +2319,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("reward_zone",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2332,8 +2333,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("upSong",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2347,8 +2347,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("clearApply",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2389,8 +2388,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("helpApply",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2405,8 +2403,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setRoomApply",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2421,13 +2418,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("giveGift",t);
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number, String heart_id, BaseObserver<String> observer) {
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String
|
||||
type, String pit_number, String heart_id, BaseObserver<String> observer) {
|
||||
sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2436,9 +2433,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("解析失败:roomGift", t.toString());
|
||||
observer.onNext( "");
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2616,7 +2611,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void setMutePit(String roomId, String user_id, String isMute, BaseObserver<String> observer) {
|
||||
public void setMutePit(String roomId, String user_id, String
|
||||
isMute, BaseObserver<String> observer) {
|
||||
sApiServer.setMutePit(roomId, user_id, isMute).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2625,8 +2621,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setMutePit", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2641,8 +2636,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setLockPit", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2656,8 +2650,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("downPit", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2671,8 +2664,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("kickOutRoom", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2686,8 +2678,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("applySong", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2701,8 +2692,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("agreeSong", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2716,8 +2706,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("endSong", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2812,7 +2801,6 @@ public class RetrofitClient {
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeSong", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2827,8 +2815,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("hostUserPit", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2881,8 +2868,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("topRelationCard", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2896,8 +2882,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteRelationCard", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2953,8 +2938,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setUserDecorate", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2986,8 +2970,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("publishZone", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3001,8 +2984,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("likeZone", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3016,8 +2998,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteComment", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3033,8 +3014,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteZone", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3049,9 +3029,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("commentZone", t.toString());
|
||||
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3066,8 +3044,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("clearLoginInfo", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3082,13 +3059,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("cancel", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getPostData(String new_password, String mobile, String code, String userId, BaseObserver<String> observer) {
|
||||
public void getPostData(String new_password, String mobile, String code, String
|
||||
userId, BaseObserver<String> observer) {
|
||||
sApiServer.getPostData(new_password, mobile, code, userId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3121,8 +3098,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("forgotPassword", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3137,8 +3113,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("createAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3153,8 +3128,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3171,8 +3145,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editUserInfo", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -3185,8 +3158,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editUserBg", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3201,8 +3173,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("userGuanz", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3216,8 +3187,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
t.printStackTrace();
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3232,7 +3202,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
@@ -3282,8 +3252,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("removeBlackList", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3298,8 +3267,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("upAddAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3313,8 +3281,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("moveAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3343,8 +3310,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -3356,8 +3322,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3373,8 +3338,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("likeAlbum", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3388,8 +3352,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("getRealNameResult", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3403,8 +3366,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeRoom", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3418,13 +3380,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeRoomType", t.toString());
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onNextRetu(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
public void onNextRetu
|
||||
(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> string = response.body();
|
||||
if (string != null) {
|
||||
@@ -3450,7 +3412,8 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
/// 获取活动礼物列表
|
||||
public void getBoxGiftList(String giftBagId, String roomId, BaseObserver<BlindBoxBean> observer) {
|
||||
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) {
|
||||
@@ -3562,26 +3525,49 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
public void xlhAllRecord(String roomId, String page, String
|
||||
pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
sApiServer.xlhAllRecord(roomId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<GiftBean>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
pageSize,int type, BaseObserver<List<GiftBean>> observer) {
|
||||
if (type==1) {
|
||||
|
||||
|
||||
sApiServer.xlhAllRecord(roomId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<GiftBean>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<GiftBean>>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<GiftBean>>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}else {
|
||||
sApiServer.xlXH_RANking(roomId,page,pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<GiftBean>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
LogUtils.e("xlXH_RANking", response.body().toString());
|
||||
observer.onNext(baseModel.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<GiftBean>>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void xlhMyRecord(String roomId, String page, String pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
public void xlhMyRecord(String roomId, String page, String
|
||||
pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
sApiServer.xlhMyRecord(roomId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
@@ -3600,7 +3586,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getAllRecord(String giftBagId, String page, String pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
public void getAllRecord(String giftBagId, String page, String
|
||||
pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
sApiServer.getAllRecord(giftBagId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
public class AvatarWithDecoration extends AppCompatImageView {
|
||||
// 挂件图片
|
||||
private Drawable decoration;
|
||||
// 挂件位置偏移量
|
||||
private int decorationOffsetX = 0;
|
||||
private int decorationOffsetY = 0;
|
||||
// 挂件大小比例(相对于头像)
|
||||
private float decorationScale = 0.3f;
|
||||
|
||||
public AvatarWithDecoration(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AvatarWithDecoration(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public AvatarWithDecoration(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AvatarWithDecoration);
|
||||
decoration = a.getDrawable(R.styleable.AvatarWithDecoration_decoration);
|
||||
decorationScale = a.getFloat(R.styleable.AvatarWithDecoration_decorationScale, 0.3f);
|
||||
decorationOffsetX = a.getInt(R.styleable.AvatarWithDecoration_decorationOffsetX, 0);
|
||||
decorationOffsetY = a.getInt(R.styleable.AvatarWithDecoration_decorationOffsetY, 0);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
// 可以在这里设置默认的挂件
|
||||
decoration = getResources().getDrawable(R.mipmap.xlh_image);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
// 如果有挂件,则绘制挂件
|
||||
if (decoration != null) {
|
||||
drawDecoration(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDecoration(Canvas canvas) {
|
||||
// 获取头像的宽高
|
||||
int avatarWidth = getWidth();
|
||||
int avatarHeight = getHeight();
|
||||
|
||||
// 计算挂件的大小
|
||||
int decorationWidth = (int) (avatarWidth * decorationScale);
|
||||
int decorationHeight = (int) (avatarHeight * decorationScale);
|
||||
|
||||
// 计算挂件的位置(右下角)
|
||||
int left = avatarWidth - decorationWidth + decorationOffsetX;
|
||||
int top = avatarHeight - decorationHeight + decorationOffsetY;
|
||||
int right = left + decorationWidth;
|
||||
int bottom = top + decorationHeight;
|
||||
|
||||
// 设置挂件的绘制边界
|
||||
decoration.setBounds(left, top, right, bottom);
|
||||
|
||||
// 绘制挂件
|
||||
decoration.draw(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置挂件图片
|
||||
*/
|
||||
public void setDecoration(Drawable decoration) {
|
||||
this.decoration = decoration;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置挂件图片(通过Bitmap)
|
||||
*/
|
||||
public void setDecoration(Bitmap bitmap) {
|
||||
if (bitmap != null) {
|
||||
this.decoration = new BitmapDrawable(getResources(), bitmap);
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置挂件位置偏移量
|
||||
*/
|
||||
public void setDecorationOffset(int offsetX, int offsetY) {
|
||||
this.decorationOffsetX = offsetX;
|
||||
this.decorationOffsetY = offsetY;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置挂件大小比例
|
||||
*/
|
||||
public void setDecorationScale(float scale) {
|
||||
if (scale > 0 && scale <= 1) {
|
||||
this.decorationScale = scale;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class FashionAvatarView extends View {
|
||||
// 头像相关属性
|
||||
private Bitmap mAvatarBitmap;
|
||||
private String mAvatarUrl;
|
||||
private Drawable mPlaceholderAvatar;
|
||||
private int mAvatarRadius;
|
||||
private int mAvatarBorderWidth;
|
||||
private int mAvatarBorderColor;
|
||||
|
||||
// 顶部标签属性
|
||||
private String mTagText;
|
||||
private int mTagTextColor;
|
||||
private float mTagTextSize;
|
||||
private int mTagBackgroundColor;
|
||||
private float mTagCornerRadius;
|
||||
private int mTagPadding;
|
||||
private int mTagOffsetY; // 标签Y轴偏移量
|
||||
|
||||
// 底部文字属性
|
||||
private String mBottomText;
|
||||
private int mBottomTextColor;
|
||||
private float mBottomTextSize;
|
||||
private int mBottomTextOffsetY; // 底部文字Y轴偏移量
|
||||
|
||||
// 爱心装饰属性
|
||||
private Drawable mHeartIcon;
|
||||
private int mHeartCount;
|
||||
private int mHeartSize;
|
||||
private List<PointF> mHeartPositions = new ArrayList<>();
|
||||
private Random mRandom = new Random();
|
||||
|
||||
// 画笔
|
||||
private Paint mAvatarPaint;
|
||||
private Paint mTextPaint;
|
||||
private Paint mTagBgPaint;
|
||||
|
||||
public FashionAvatarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public FashionAvatarView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public FashionAvatarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initAttrs(context, attrs);
|
||||
initPaints();
|
||||
}
|
||||
|
||||
private void initAttrs(Context context, AttributeSet attrs) {
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.FashionAvatarView);
|
||||
|
||||
// 头像属性
|
||||
mAvatarUrl = ta.getString(R.styleable.FashionAvatarView_avatarUrl);
|
||||
mPlaceholderAvatar = ta.getDrawable(R.styleable.FashionAvatarView_placeholderAvatar);
|
||||
mAvatarRadius = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_avatarRadius, dp2px(60));
|
||||
mAvatarBorderWidth = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_avatarBorderWidth, dp2px(2));
|
||||
mAvatarBorderColor = ta.getColor(R.styleable.FashionAvatarView_avatarBorderColor, Color.parseColor("#FFD700"));
|
||||
|
||||
// 顶部标签属性
|
||||
mTagText = ta.getString(R.styleable.FashionAvatarView_tagText);
|
||||
mTagTextColor = ta.getColor(R.styleable.FashionAvatarView_tagTextColor, Color.WHITE);
|
||||
mTagTextSize = ta.getDimension(R.styleable.FashionAvatarView_tagTextSize, sp2px(12));
|
||||
mTagBackgroundColor = ta.getColor(R.styleable.FashionAvatarView_tagBackgroundColor, Color.parseColor("#FFA500"));
|
||||
mTagCornerRadius = ta.getDimension(R.styleable.FashionAvatarView_tagCornerRadius, dp2px(4));
|
||||
mTagPadding = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_tagPadding, dp2px(4));
|
||||
mTagOffsetY = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_tagOffsetY, 0);
|
||||
|
||||
// 底部文字属性
|
||||
mBottomText = ta.getString(R.styleable.FashionAvatarView_bottomText);
|
||||
mBottomTextColor = ta.getColor(R.styleable.FashionAvatarView_bottomTextColor, Color.WHITE);
|
||||
mBottomTextSize = ta.getDimension(R.styleable.FashionAvatarView_bottomTextSize, sp2px(14));
|
||||
mBottomTextOffsetY = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_bottomTextOffsetY, dp2px(10));
|
||||
|
||||
// 爱心装饰属性
|
||||
mHeartIcon = ta.getDrawable(R.styleable.FashionAvatarView_heartIcon);
|
||||
if (mHeartIcon == null) {
|
||||
try {
|
||||
mHeartIcon = context.getResources().getDrawable(R.mipmap.xlh_image);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
mHeartCount = ta.getInt(R.styleable.FashionAvatarView_heartCount, 6);
|
||||
mHeartSize = ta.getDimensionPixelSize(R.styleable.FashionAvatarView_heartSize, dp2px(16));
|
||||
|
||||
ta.recycle();
|
||||
|
||||
// 加载头像
|
||||
if (mAvatarUrl != null && !mAvatarUrl.isEmpty()) {
|
||||
loadAvatarFromNetwork();
|
||||
} else if (mPlaceholderAvatar != null) {
|
||||
mAvatarBitmap = drawableToBitmap(mPlaceholderAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
private void initPaints() {
|
||||
// 头像画笔
|
||||
mAvatarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mAvatarPaint.setDither(true);
|
||||
|
||||
// 文字画笔
|
||||
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||
|
||||
// 标签背景画笔
|
||||
mTagBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mTagBgPaint.setColor(mTagBackgroundColor);
|
||||
}
|
||||
|
||||
private void loadAvatarFromNetwork() {
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(mAvatarUrl)
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
mAvatarBitmap = resource;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
if (mPlaceholderAvatar != null) {
|
||||
mAvatarBitmap = drawableToBitmap(mPlaceholderAvatar);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Bitmap drawableToBitmap(Drawable drawable) {
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
return ((BitmapDrawable) drawable).getBitmap();
|
||||
}
|
||||
|
||||
if (drawable == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int width = drawable.getIntrinsicWidth();
|
||||
int height = drawable.getIntrinsicHeight();
|
||||
|
||||
if (width <= 0) width = mAvatarRadius * 2;
|
||||
if (height <= 0) height = mAvatarRadius * 2;
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private void initHeartPositions() {
|
||||
mHeartPositions.clear();
|
||||
|
||||
if (mHeartIcon == null || mHeartCount <= 0 || mHeartSize <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int centerX = getWidth() / 2;
|
||||
int centerY = getAvatarCenterY();
|
||||
// 爱心围绕的半径,比头像大一些
|
||||
int radius = mAvatarRadius + mAvatarBorderWidth + mHeartSize / 2;
|
||||
|
||||
for (int i = 0; i < mHeartCount; i++) {
|
||||
// 随机分布在头像周围
|
||||
double angle = 2 * Math.PI * mRandom.nextDouble();
|
||||
// 稍微随机调整距离,让分布更自然
|
||||
float distanceFactor = 0.8f + mRandom.nextFloat() * 0.4f;
|
||||
|
||||
float x = (float) (centerX + radius * distanceFactor * Math.cos(angle));
|
||||
float y = (float) (centerY + radius * distanceFactor * Math.sin(angle));
|
||||
mHeartPositions.add(new PointF(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// 计算宽度:直径 + 左右可能的爱心空间
|
||||
int width = 2 * (mAvatarRadius + mAvatarBorderWidth + mHeartSize / 2);
|
||||
|
||||
// 计算高度:头像直径 + 标签高度 + 底部文字高度 + 间距
|
||||
int tagHeight = (int) (mTagTextSize + mTagPadding * 2);
|
||||
int bottomTextHeight = (int) mBottomTextSize;
|
||||
int height = 2 * (mAvatarRadius + mAvatarBorderWidth)
|
||||
+ tagHeight / 2 // 标签一半在头像内
|
||||
+ bottomTextHeight + mBottomTextOffsetY
|
||||
+ dp2px(10);
|
||||
|
||||
setMeasuredDimension(resolveSize(width, widthMeasureSpec),
|
||||
resolveSize(height, heightMeasureSpec));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
// 视图大小确定后计算爱心位置
|
||||
initHeartPositions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
if (getWidth() == 0 || getHeight() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int centerX = getWidth() / 2;
|
||||
int avatarCenterY = getAvatarCenterY();
|
||||
|
||||
// 1. 绘制爱心装饰
|
||||
drawHearts(canvas);
|
||||
|
||||
// 2. 绘制头像边框
|
||||
mAvatarPaint.setColor(mAvatarBorderColor);
|
||||
mAvatarPaint.setStyle(Paint.Style.FILL);
|
||||
canvas.drawCircle(centerX, avatarCenterY, mAvatarRadius + mAvatarBorderWidth, mAvatarPaint);
|
||||
|
||||
// 3. 绘制头像
|
||||
if (mAvatarBitmap != null) {
|
||||
mAvatarPaint.setShader(new BitmapShader(mAvatarBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||
canvas.drawCircle(centerX, avatarCenterY, mAvatarRadius, mAvatarPaint);
|
||||
mAvatarPaint.setShader(null);
|
||||
}
|
||||
|
||||
// 4. 绘制顶部标签
|
||||
drawTag(canvas, centerX, avatarCenterY);
|
||||
|
||||
// 5. 绘制底部文字
|
||||
drawBottomText(canvas, centerX);
|
||||
}
|
||||
|
||||
private int getAvatarCenterY() {
|
||||
// 计算头像中心Y坐标,考虑标签的高度
|
||||
int tagHeight = (int) (mTagTextSize + mTagPadding * 2);
|
||||
return mAvatarRadius + mAvatarBorderWidth + tagHeight / 2 + mTagOffsetY;
|
||||
}
|
||||
|
||||
private void drawHearts(Canvas canvas) {
|
||||
if (mHeartIcon == null || mHeartPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
canvas.save();
|
||||
for (PointF point : mHeartPositions) {
|
||||
int left = (int) (point.x - mHeartSize / 2);
|
||||
int top = (int) (point.y - mHeartSize / 2);
|
||||
int right = left + mHeartSize;
|
||||
int bottom = top + mHeartSize;
|
||||
|
||||
// 只绘制在视图范围内的爱心
|
||||
if (right > 0 && bottom > 0 && left < getWidth() && top < getHeight()) {
|
||||
mHeartIcon.setBounds(left, top, right, bottom);
|
||||
mHeartIcon.draw(canvas);
|
||||
}
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void drawTag(Canvas canvas, int centerX, int avatarCenterY) {
|
||||
if (mTagText == null || mTagText.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算标签文字宽度
|
||||
mTextPaint.setTextSize(mTagTextSize);
|
||||
float textWidth = mTextPaint.measureText(mTagText);
|
||||
|
||||
// 计算标签背景矩形
|
||||
float tagLeft = centerX - textWidth / 2 - mTagPadding;
|
||||
float tagRight = centerX + textWidth / 2 + mTagPadding;
|
||||
// 标签底部与头像顶部对齐
|
||||
float tagBottom = avatarCenterY - mAvatarRadius - mAvatarBorderWidth;
|
||||
float tagTop = tagBottom - mTagTextSize - mTagPadding * 2;
|
||||
|
||||
RectF tagRect = new RectF(tagLeft, tagTop, tagRight, tagBottom);
|
||||
|
||||
// 绘制标签背景
|
||||
canvas.drawRoundRect(tagRect, mTagCornerRadius, mTagCornerRadius, mTagBgPaint);
|
||||
|
||||
// 绘制标签文字
|
||||
mTextPaint.setColor(mTagTextColor);
|
||||
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
|
||||
float baseLineY = tagBottom - mTagPadding - fontMetrics.bottom;
|
||||
canvas.drawText(mTagText, centerX, baseLineY, mTextPaint);
|
||||
}
|
||||
|
||||
private void drawBottomText(Canvas canvas, int centerX) {
|
||||
if (mBottomText == null || mBottomText.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算文字位置:头像底部下方
|
||||
int textY = getAvatarCenterY() + mAvatarRadius + mAvatarBorderWidth + mBottomTextOffsetY;
|
||||
|
||||
mTextPaint.setColor(mBottomTextColor);
|
||||
mTextPaint.setTextSize(mBottomTextSize);
|
||||
|
||||
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
|
||||
float baseLineY = textY - fontMetrics.top;
|
||||
|
||||
canvas.drawText(mBottomText, centerX, baseLineY, mTextPaint);
|
||||
}
|
||||
|
||||
// dp转px
|
||||
private int dp2px(float dp) {
|
||||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
|
||||
getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
// sp转px
|
||||
private float sp2px(float sp) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
|
||||
getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
// 设置器方法
|
||||
public void setAvatarUrl(String url) {
|
||||
this.mAvatarUrl = url;
|
||||
loadAvatarFromNetwork();
|
||||
}
|
||||
|
||||
public void setTagText(String text) {
|
||||
this.mTagText = text;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setBottomText(String text) {
|
||||
this.mBottomText = text;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setHeartIcon(Drawable heartIcon) {
|
||||
this.mHeartIcon = heartIcon;
|
||||
initHeartPositions();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
|
||||
public class QXMeetGiftView extends RelativeLayout {
|
||||
|
||||
private TextView giftNameLabel;
|
||||
private ImageView giftPriceBgView;
|
||||
private Button giftCoin;
|
||||
private ImageView bgImageView;
|
||||
private ImageView giftBgImageView;
|
||||
private ImageView giftImageView;
|
||||
|
||||
private boolean isLockGift;
|
||||
private Object model; // 这里用 Object 代替 QXDrawGiftModel
|
||||
|
||||
public QXMeetGiftView(Context context) {
|
||||
super(context);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetGiftView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
private void initSubviews(Context context) {
|
||||
// 创建背景图片视图
|
||||
bgImageView = new ImageView(context);
|
||||
bgImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
bgImageView.setImageResource(R.drawable.ac_left_gift_bg);
|
||||
LayoutParams bgParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT
|
||||
);
|
||||
addView(bgImageView, bgParams);
|
||||
|
||||
// 创建礼物图片视图(圆形)
|
||||
giftImageView = new ImageView(context);
|
||||
giftImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
LayoutParams giftImageParams = new LayoutParams(
|
||||
dpToPx(62), // 固定宽度
|
||||
dpToPx(62) // 固定高度
|
||||
);
|
||||
giftImageParams.addRule(CENTER_IN_PARENT);
|
||||
giftImageParams.topMargin = dpToPx(10);
|
||||
addView(giftImageView, giftImageParams);
|
||||
|
||||
// 创建礼物背景光效视图
|
||||
giftBgImageView = new ImageView(context);
|
||||
giftBgImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
giftBgImageView.setImageResource(R.drawable.ac_lock_gift_light_bg);
|
||||
giftBgImageView.setVisibility(View.GONE); // 初始隐藏
|
||||
LayoutParams giftBgParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT
|
||||
);
|
||||
addView(giftBgImageView, giftBgParams);
|
||||
|
||||
|
||||
|
||||
// 创建价格背景视图
|
||||
giftPriceBgView = new ImageView(context);
|
||||
giftPriceBgView.setImageResource(R.drawable.ac_meet_gift_name_bg);
|
||||
LayoutParams priceBgParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
dpToPx(15)
|
||||
);
|
||||
priceBgParams.addRule(CENTER_HORIZONTAL);
|
||||
priceBgParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
priceBgParams.bottomMargin = dpToPx(10); // 在名称标签上方
|
||||
addView(giftPriceBgView, priceBgParams);
|
||||
|
||||
|
||||
// 创建金币按钮
|
||||
giftCoin = new Button(context);
|
||||
giftCoin.setTextColor(0xFFC7BF62); // 使用直接的颜色值
|
||||
// 设置按钮图标
|
||||
Drawable coinDrawable = getResources().getDrawable(R.mipmap.jinb);
|
||||
coinDrawable.setBounds(0, 0, dpToPx(1), dpToPx(1));
|
||||
giftCoin.setCompoundDrawables(coinDrawable, null, null, null);
|
||||
giftCoin.setTextSize(10);
|
||||
giftCoin.setBackgroundColor(0x00000000); // 透明背景
|
||||
LayoutParams coinParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
coinParams.addRule(CENTER_HORIZONTAL);
|
||||
coinParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
coinParams.bottomMargin = -dpToPx(2);
|
||||
addView(giftCoin, coinParams);
|
||||
|
||||
// 创建礼物名称标签
|
||||
giftNameLabel = new TextView(context);
|
||||
giftNameLabel.setTextColor(0xFFFFFFFF);
|
||||
giftNameLabel.setTextSize(12);
|
||||
giftNameLabel.setGravity(android.view.Gravity.CENTER);
|
||||
giftNameLabel.setSingleLine(true); // 设置为单行显示
|
||||
giftNameLabel.setEllipsize(android.text.TextUtils.TruncateAt.END); // 超出部分用省略号表示
|
||||
LayoutParams nameParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
nameParams.addRule(CENTER_HORIZONTAL);
|
||||
nameParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
nameParams.bottomMargin = dpToPx(1);
|
||||
addView(giftNameLabel, nameParams);
|
||||
|
||||
// 调整视图层级 - 确保正确的层级关系
|
||||
// 按添加顺序已经确定层级,最晚添加的在最上层
|
||||
}
|
||||
|
||||
public void setIsLockGift(boolean isLockGift) {
|
||||
this.isLockGift = isLockGift;
|
||||
|
||||
// 设置背景图片
|
||||
int bgResource = isLockGift ?
|
||||
R.drawable.ac_lock_gift_bg : R.drawable.ac_left_gift_bg;
|
||||
bgImageView.setImageResource(bgResource);
|
||||
|
||||
// 显示/隐藏光效背景
|
||||
giftBgImageView.setVisibility(isLockGift ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (isLockGift) {
|
||||
// 重新设置礼物图片的约束
|
||||
LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||
params.width = dpToPx(62);
|
||||
params.height = dpToPx(62);
|
||||
params.addRule(CENTER_IN_PARENT);
|
||||
params.setMargins(0, 0, 0, 0);
|
||||
giftImageView.setLayoutParams(params);
|
||||
} else {
|
||||
// 恢复原始约束
|
||||
LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||
params.width = LayoutParams.MATCH_PARENT;
|
||||
params.height = LayoutParams.WRAP_CONTENT;
|
||||
params.addRule(CENTER_IN_PARENT);
|
||||
params.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||
giftImageView.setLayoutParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
public void setModel(BlindBoxBean.GiveGift model) {
|
||||
this.model = model;
|
||||
// 这里需要根据您的 QXDrawGiftModel 类来实现具体逻辑
|
||||
|
||||
if (model instanceof BlindBoxBean.GiveGift) {
|
||||
BlindBoxBean.GiveGift giftModel = (BlindBoxBean.GiveGift) model;
|
||||
|
||||
// 使用图片加载库加载图片
|
||||
Glide.with(getContext()).load(giftModel.getBase_image()).into(giftImageView);
|
||||
|
||||
giftNameLabel.setText(giftModel.getGift_name());
|
||||
giftCoin.setText(giftModel.getGift_price());
|
||||
}
|
||||
}
|
||||
|
||||
public void startAnimation() {
|
||||
// 礼物图片顺时针旋转动画
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(
|
||||
0, 360, // 从 0 度旋转到 360 度
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f
|
||||
);
|
||||
rotateAnimation.setDuration(3000); // 3 秒
|
||||
rotateAnimation.setRepeatCount(Animation.INFINITE);
|
||||
rotateAnimation.setRepeatMode(Animation.RESTART);
|
||||
rotateAnimation.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||
giftImageView.startAnimation(rotateAnimation);
|
||||
|
||||
// 光效背景逆时针旋转动画
|
||||
RotateAnimation rotateAnimation1 = new RotateAnimation(
|
||||
0, -360, // 从 0 度旋转到 -360 度
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f
|
||||
);
|
||||
rotateAnimation1.setDuration(3000); // 3 秒
|
||||
rotateAnimation1.setRepeatCount(Animation.INFINITE);
|
||||
rotateAnimation1.setRepeatMode(Animation.RESTART);
|
||||
rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||
giftBgImageView.startAnimation(rotateAnimation1);
|
||||
}
|
||||
|
||||
public void resetAnimation() {
|
||||
giftImageView.clearAnimation();
|
||||
giftBgImageView.clearAnimation();
|
||||
}
|
||||
|
||||
public void stopAnimation() {
|
||||
giftImageView.clearAnimation();
|
||||
giftBgImageView.clearAnimation();
|
||||
}
|
||||
|
||||
// 辅助方法:dp 转 px
|
||||
private int dpToPx(int dp) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * density);
|
||||
}
|
||||
|
||||
// 缩放宽度方法(对应 ScaleWidth)
|
||||
private int scaleWidth(int value) {
|
||||
// 这里需要根据您的缩放逻辑实现
|
||||
// 通常可以根据屏幕密度进行缩放
|
||||
float scale = getResources().getDisplayMetrics().density;
|
||||
return (int) (value * scale);
|
||||
}
|
||||
|
||||
// Getter 方法
|
||||
public TextView getGiftNameLabel() {
|
||||
return giftNameLabel;
|
||||
}
|
||||
|
||||
public ImageView getGiftPriceBgView() {
|
||||
return giftPriceBgView;
|
||||
}
|
||||
|
||||
public Button getGiftCoin() {
|
||||
return giftCoin;
|
||||
}
|
||||
|
||||
public ImageView getBgImageView() {
|
||||
return bgImageView;
|
||||
}
|
||||
|
||||
public ImageView getGiftBgImageView() {
|
||||
return giftBgImageView;
|
||||
}
|
||||
|
||||
public ImageView getGiftImageView() {
|
||||
return giftImageView;
|
||||
}
|
||||
|
||||
public boolean isLockGift() {
|
||||
return isLockGift;
|
||||
}
|
||||
|
||||
public Object getModel() {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
|
||||
public class QXMeetUserView extends RelativeLayout {
|
||||
|
||||
private GifAvatarOvalView headerImageView;
|
||||
private ImageView dressImageView;
|
||||
private TextView tagLabel;
|
||||
private TextView nameLabel;
|
||||
|
||||
private boolean isLuckUser;
|
||||
private Object model; // 这里用 Object 代替 QXUserModel
|
||||
|
||||
public QXMeetUserView(Context context) {
|
||||
super(context);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetUserView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetUserView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
private void initSubviews(Context context) {
|
||||
setClipChildren(false);
|
||||
setClipToPadding(false);
|
||||
|
||||
// 创建装饰图片视图
|
||||
dressImageView = new ImageView(context);
|
||||
dressImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
dressImageView.setImageResource(R.mipmap.xlh_image);
|
||||
|
||||
LayoutParams dressParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT
|
||||
);
|
||||
addView(dressImageView, dressParams);
|
||||
|
||||
// 创建头像图片视图
|
||||
headerImageView = new GifAvatarOvalView(context);
|
||||
headerImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); // 添加这一行
|
||||
// headerImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
// headerImageView.setImageResource(R.mipmap.default_avatar);
|
||||
|
||||
int headerSize = getMeasuredWidth() - dpToPx(18); // self.width-9*2
|
||||
LayoutParams headerParams = new LayoutParams(headerSize, headerSize);
|
||||
headerParams.setMargins(0, 10, 0, 0);
|
||||
headerParams.addRule(CENTER_IN_PARENT);
|
||||
// 将头像添加到装饰视图之上
|
||||
addView(headerImageView, headerParams);
|
||||
|
||||
// 创建标签标签
|
||||
tagLabel = new TextView(context);
|
||||
tagLabel.setTextColor(0xFFFFE554); // RGB16(0xFFE554)
|
||||
tagLabel.setTextSize(12);
|
||||
tagLabel.setGravity(android.view.Gravity.CENTER);
|
||||
tagLabel.setBackground(getRoundedRectBackground(0xFF8D6F28, dpToPx(8))); // 默认房主背景色
|
||||
|
||||
LayoutParams tagParams = new LayoutParams(dpToPx(45), dpToPx(16));
|
||||
tagParams.addRule(CENTER_HORIZONTAL);
|
||||
// 需要在测量完成后设置底部位置
|
||||
addView(tagLabel, tagParams);
|
||||
|
||||
// 创建名称标签
|
||||
nameLabel = new TextView(context);
|
||||
nameLabel.setTextColor(0xFFFFFFFF); // RGB16(0xffffff)
|
||||
nameLabel.setTextSize(12);
|
||||
nameLabel.setText("虚位以待");
|
||||
nameLabel.setGravity(android.view.Gravity.CENTER);
|
||||
|
||||
LayoutParams nameParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
nameParams.addRule(CENTER_HORIZONTAL);
|
||||
nameParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
addView(nameLabel, nameParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
// 确保在测量时设置正确的头像尺寸
|
||||
if (headerImageView != null) {
|
||||
int headerSize = getMeasuredWidth() - dpToPx(18); // width - 9dp * 2
|
||||
LayoutParams headerParams = (LayoutParams) headerImageView.getLayoutParams();
|
||||
if (headerParams != null) {
|
||||
headerParams.width = headerSize;
|
||||
headerParams.height = headerSize;
|
||||
headerParams.leftMargin = dpToPx(9);
|
||||
headerParams.topMargin = dpToPx(9);
|
||||
headerImageView.setLayoutParams(headerParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
|
||||
// 在布局完成后设置标签的位置(在头像底部-8的位置)
|
||||
if (changed && headerImageView != null && tagLabel != null) {
|
||||
int tagTop = headerImageView.getBottom() - dpToPx(8);
|
||||
int tagLeft = (getWidth() - tagLabel.getWidth()) / 2;
|
||||
tagLabel.layout(tagLeft, tagTop, tagLeft + tagLabel.getWidth(), tagTop + tagLabel.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
public void setIsLuckUser(boolean isLuckUser) {
|
||||
this.isLuckUser = isLuckUser;
|
||||
|
||||
if (isLuckUser) {
|
||||
tagLabel.setTextColor(0xFFFFFFFF); // RGB16(0xffffff)
|
||||
tagLabel.setBackground(getRoundedRectBackground(0xFF6C49E4, dpToPx(8))); // RGB16(0x6C49E4)
|
||||
// tagLabel.setBackgroundColor(getResources().getColor(R.color.color_FF6C49E4)); // RGB16(0x6C49E4)
|
||||
tagLabel.setText("幸运者");
|
||||
} else {
|
||||
tagLabel.setTextColor(0xFFFFE554); // RGB16(0xFFE554)
|
||||
tagLabel.setBackground(getRoundedRectBackground(0xFF8D6F28, dpToPx(8))); // RGB16(0x8D6F28)
|
||||
// tagLabel.setBackgroundColor(getResources().getColor(R.color.color_FF8D6F28)); // RGB16(0x6C49E4)
|
||||
|
||||
tagLabel.setText("房主");
|
||||
}
|
||||
}
|
||||
|
||||
public void setModel(BlindBoxBean.xlhUser model) {
|
||||
this.model = model;
|
||||
// 这里需要根据您的 QXUserModel 类来实现具体逻辑
|
||||
if (model instanceof BlindBoxBean.xlhUser) {
|
||||
BlindBoxBean.xlhUser userModel = (BlindBoxBean.xlhUser) model;
|
||||
|
||||
// 使用图片加载库加载头像
|
||||
// Glide.with(getContext()).load(userModel.getAvatar()).into(headerImageView);
|
||||
ImageUtils.loadHeadCC(userModel.getAvatar(), headerImageView);
|
||||
nameLabel.setText(userModel.getNickname());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetView() {
|
||||
headerImageView.setImageResource(R.mipmap.default_avatar);
|
||||
nameLabel.setText("虚位以待");
|
||||
}
|
||||
|
||||
// 创建圆角矩形背景
|
||||
private android.graphics.drawable.Drawable getRoundedRectBackground(int color, float radius) {
|
||||
GradientDrawable drawable = new GradientDrawable();
|
||||
drawable.setColor(color);
|
||||
drawable.setCornerRadius(radius);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
// 辅助方法:dp 转 px
|
||||
private int dpToPx(int dp) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * density);
|
||||
}
|
||||
|
||||
// Getter 方法
|
||||
public ImageView getHeaderImageView() {
|
||||
return headerImageView;
|
||||
}
|
||||
|
||||
public ImageView getDressImageView() {
|
||||
return dressImageView;
|
||||
}
|
||||
|
||||
public TextView getTagLabel() {
|
||||
return tagLabel;
|
||||
}
|
||||
|
||||
public TextView getNameLabel() {
|
||||
return nameLabel;
|
||||
}
|
||||
|
||||
public boolean isLuckUser() {
|
||||
return isLuckUser;
|
||||
}
|
||||
|
||||
public Object getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
// 自定义圆形 ImageView
|
||||
private static class RoundImageView extends androidx.appcompat.widget.AppCompatImageView {
|
||||
public RoundImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public RoundImageView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public RoundImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
// 创建圆形裁剪区域
|
||||
int diameter = Math.min(getWidth(), getHeight());
|
||||
Bitmap bitmap = Bitmap.createBitmap(diameter, diameter, Bitmap.Config.ARGB_8888);
|
||||
Canvas tempCanvas = new Canvas(bitmap);
|
||||
|
||||
// 绘制圆形
|
||||
Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
tempCanvas.drawCircle(diameter / 2f, diameter / 2f, diameter / 2f, paint);
|
||||
|
||||
// 设置混合模式
|
||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||
|
||||
// 绘制原始图片
|
||||
super.onDraw(tempCanvas);
|
||||
|
||||
// 将处理后的图片绘制到实际canvas
|
||||
canvas.drawBitmap(bitmap, 0, 0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
public class QXTimeDownView extends FrameLayout {
|
||||
|
||||
private ImageView bgImageView;
|
||||
private TextView titleLabel;
|
||||
private TextView timeLabel;
|
||||
private TextView bigTimeLabel;
|
||||
|
||||
private long endTime;
|
||||
private long startTime;
|
||||
private Handler timerHandler;
|
||||
private Runnable timerRunnable;
|
||||
|
||||
private TimeDownDelegate delegate;
|
||||
|
||||
public interface TimeDownDelegate {
|
||||
void timeDownStartAnimation();
|
||||
void timeDownUpdateAnimationWithTime(long time);
|
||||
void timeDownStopAnimation();
|
||||
void timeDownDidFinished();
|
||||
}
|
||||
|
||||
public QXTimeDownView(Context context) {
|
||||
super(context);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXTimeDownView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXTimeDownView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
private void initSubviews(Context context) {
|
||||
// 背景图片(最大的圆圈)
|
||||
bgImageView = new ImageView(context);
|
||||
bgImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
bgImageView.setImageResource(R.drawable.ac_time_down_bg);
|
||||
LayoutParams bgParams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT
|
||||
);
|
||||
bgParams.gravity = Gravity.CENTER;
|
||||
addView(bgImageView, bgParams);
|
||||
|
||||
// 时间标签(居中显示在背景图上)
|
||||
timeLabel = new TextView(context);
|
||||
timeLabel.setTextSize(16);
|
||||
timeLabel.setTextColor(0xFFFFECA7);
|
||||
timeLabel.setGravity(Gravity.CENTER);
|
||||
timeLabel.setTypeface(android.graphics.Typeface.create("sans-serif-condensed", android.graphics.Typeface.NORMAL));
|
||||
LayoutParams timeParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
timeParams.gravity = Gravity.CENTER;
|
||||
timeParams.topMargin = dpToPx(-10);
|
||||
addView(timeLabel, timeParams);
|
||||
|
||||
// 标题标签(显示在时间标签下方)
|
||||
titleLabel = new TextView(context);
|
||||
titleLabel.setTextSize(12);
|
||||
titleLabel.setTextColor(0xFFFFECA7);
|
||||
titleLabel.setText("倒计时");
|
||||
titleLabel.setGravity(Gravity.CENTER);
|
||||
LayoutParams titleParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
titleParams.gravity = Gravity.CENTER;
|
||||
titleParams.topMargin = dpToPx(12); // 在timeLabel下方一定距离
|
||||
addView(titleLabel, titleParams);
|
||||
|
||||
// 大时间标签(初始隐藏,用于最后30秒显示)
|
||||
bigTimeLabel = new TextView(context);
|
||||
bigTimeLabel.setTextSize(20);
|
||||
bigTimeLabel.setText("-");
|
||||
bigTimeLabel.setTextColor(0xFFFFECA7);
|
||||
bigTimeLabel.setGravity(Gravity.CENTER);
|
||||
bigTimeLabel.setVisibility(View.GONE);
|
||||
LayoutParams bigTimeParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
bigTimeParams.gravity = Gravity.CENTER;
|
||||
addView(bigTimeLabel, bigTimeParams);
|
||||
|
||||
// 初始化定时器
|
||||
timerHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
|
||||
// 获取当前时间(秒)
|
||||
long currentTime = System.currentTimeMillis() / 1000;
|
||||
this.startTime = endTime - currentTime;
|
||||
|
||||
if (this.startTime <= 0) {
|
||||
// 时间错误不进行倒计时
|
||||
showBigTimeLabel("0");
|
||||
return;
|
||||
}
|
||||
|
||||
stopTimer();
|
||||
startTimer();
|
||||
}
|
||||
|
||||
private void startTimer() {
|
||||
timerRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startTime--;
|
||||
|
||||
long min = (startTime % 3600) / 60;
|
||||
long second = startTime % 60;
|
||||
|
||||
if (startTime <= 30) {
|
||||
// 最后30秒显示大数字
|
||||
showBigTimeLabel(String.valueOf(startTime));
|
||||
|
||||
if (startTime == 30) {
|
||||
if (delegate != null) {
|
||||
delegate.timeDownStartAnimation();
|
||||
}
|
||||
} else {
|
||||
if (delegate != null) {
|
||||
delegate.timeDownUpdateAnimationWithTime(startTime);
|
||||
}
|
||||
}
|
||||
|
||||
// 弹性动画
|
||||
performScaleAnimation();
|
||||
} else {
|
||||
// 正常倒计时显示
|
||||
showNormalTime(String.format("%02d:%02d", min, second));
|
||||
|
||||
if (delegate != null) {
|
||||
delegate.timeDownStopAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
if (startTime <= 0) {
|
||||
stopTimer();
|
||||
showBigTimeLabel("0");
|
||||
|
||||
if (delegate != null) {
|
||||
delegate.timeDownDidFinished();
|
||||
delegate.timeDownStopAnimation();
|
||||
}
|
||||
} else {
|
||||
// 继续下一次计时
|
||||
timerHandler.postDelayed(this, 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 立即开始第一次执行
|
||||
timerHandler.post(timerRunnable);
|
||||
}
|
||||
|
||||
public void stopTimer() {
|
||||
if (timerHandler != null && timerRunnable != null) {
|
||||
timerHandler.removeCallbacks(timerRunnable);
|
||||
timerRunnable = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void showBigTimeLabel(String text) {
|
||||
bigTimeLabel.setVisibility(View.VISIBLE);
|
||||
timeLabel.setVisibility(View.GONE);
|
||||
titleLabel.setVisibility(View.GONE);
|
||||
bigTimeLabel.setText(text);
|
||||
}
|
||||
|
||||
private void showNormalTime(String timeText) {
|
||||
bigTimeLabel.setVisibility(View.GONE);
|
||||
timeLabel.setVisibility(View.VISIBLE);
|
||||
titleLabel.setVisibility(View.VISIBLE);
|
||||
timeLabel.setText(timeText);
|
||||
}
|
||||
|
||||
private void performScaleAnimation() {
|
||||
ScaleAnimation scaleAnimation = new ScaleAnimation(
|
||||
1.0f, 1.5f, // X轴从1.0缩放到1.5
|
||||
1.0f, 1.5f, // Y轴从1.0缩放到1.5
|
||||
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, // 缩放中心X
|
||||
ScaleAnimation.RELATIVE_TO_SELF, 0.5f // 缩放中心Y
|
||||
);
|
||||
|
||||
scaleAnimation.setDuration(600);
|
||||
scaleAnimation.setFillAfter(false);
|
||||
|
||||
bigTimeLabel.startAnimation(scaleAnimation);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
stopTimer();
|
||||
showNormalTime("00:00");
|
||||
bigTimeLabel.setVisibility(View.GONE);
|
||||
timeLabel.setVisibility(View.VISIBLE);
|
||||
titleLabel.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// 辅助方法:dp 转 px
|
||||
private int dpToPx(int dp) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * density);
|
||||
}
|
||||
|
||||
// Getter 和 Setter 方法
|
||||
public void setDelegate(TimeDownDelegate delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public TextView getTitleLabel() {
|
||||
return titleLabel;
|
||||
}
|
||||
|
||||
public TextView getTimeLabel() {
|
||||
return timeLabel;
|
||||
}
|
||||
|
||||
public TextView getBigTimeLabel() {
|
||||
return bigTimeLabel;
|
||||
}
|
||||
|
||||
public ImageView getBgImageView() {
|
||||
return bgImageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
stopTimer();
|
||||
}
|
||||
}
|
||||
@@ -384,6 +384,7 @@ public class Constants {
|
||||
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";//巡乐会
|
||||
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";//巡乐会抽奖
|
||||
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";//巡乐会榜单
|
||||
public static final String Get_XH_RANking = "/api/BlindBoxTurntable/get_xlh_ranking";//巡乐会幸运
|
||||
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";//房间用户当前魅力值列表
|
||||
|
||||
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 46 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png
Normal file
|
After Width: | Height: | Size: 406 KiB |
33
moduleUtil/src/main/res/drawable/bg_radio_selector.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 选中状态:深色背景+白色文字(背景通过shape绘制) -->
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<padding
|
||||
android:bottom="@dimen/dp_9"
|
||||
android:top="@dimen/dp_9"
|
||||
android:right="@dimen/dp_16"
|
||||
android:left="@dimen/dp_16"/>
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="16dp" />
|
||||
<!-- 选中背景色 -->
|
||||
<solid android:color="#553BAE" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 未选中状态:浅色背景+深色文字 -->
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="rectangle">
|
||||
<padding
|
||||
android:bottom="@dimen/dp_9"
|
||||
android:top="@dimen/dp_9"
|
||||
android:right="@dimen/dp_16"
|
||||
android:left="@dimen/dp_16">
|
||||
|
||||
</padding>
|
||||
<corners android:radius="16dp" />
|
||||
<!-- 未选中背景色 -->
|
||||
<solid android:color="#A48DB1" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 选中时文字颜色 -->
|
||||
<item android:state_checked="true" android:color="#E8E8E8" />
|
||||
<!-- 未选中时文字颜色 -->
|
||||
<item android:state_checked="false" android:color="#FFFFFF" />
|
||||
</selector>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?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:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/xlh"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_jc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_36"
|
||||
android:src="@mipmap/xlh_bd"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/custom_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="#80000000"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/im_jc">
|
||||
|
||||
<RadioGroup
|
||||
android:gravity="center"
|
||||
android:id="@+id/rb_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:checked="true"
|
||||
android:id="@+id/radio_all"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_radio_selector"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="抽奖榜单"
|
||||
android:textColor="@drawable/text_color_radio_selector"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
<RadioButton
|
||||
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:id="@+id/radio_electronics"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_radio_selector"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="幸运榜单"
|
||||
android:textColor="@drawable/text_color_radio_selector"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
</RadioGroup>
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/iv_view_Pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
@@ -34,48 +34,50 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/im_jc">
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView1"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_24"-->
|
||||
<!-- android:layout_marginStart="@dimen/sp_12"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||
<!-- android:background="@mipmap/tab_dy"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="我的记录"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:textSize="@dimen/sp_16"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintWidth_default="percent"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.2" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView2"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_24"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_16"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="全服记录"-->
|
||||
<!-- android:textColor="#5B5B5B"-->
|
||||
<!-- android:textSize="@dimen/sp_14"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/textView1"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/textView1"-->
|
||||
<!-- app:layout_constraintWidth_default="percent"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.2" />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView1"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_24"-->
|
||||
<!-- android:layout_marginStart="@dimen/sp_12"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||
<!-- android:background="@mipmap/tab_dy"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="我的记录"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:textSize="@dimen/sp_16"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintWidth_default="percent"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.2" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView2"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_24"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_16"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="全服记录"-->
|
||||
<!-- android:textColor="#5B5B5B"-->
|
||||
<!-- android:textSize="@dimen/sp_14"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/textView1"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/textView1"-->
|
||||
<!-- app:layout_constraintWidth_default="percent"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.2" />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smart_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_weight="1"
|
||||
app:srlEnableLoadMore="true"
|
||||
app:srlEnableRefresh="true">
|
||||
|
||||
|
||||
31
moduleUtil/src/main/res/layout/fframent_data.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/smart_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
app:srlEnableLoadMore="true"
|
||||
app:srlEnableRefresh="true">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:nestedScrollingEnabled="false"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
tools:listitem="@layout/item_prize_pool" />
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
@@ -61,6 +61,99 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_gz" />
|
||||
|
||||
|
||||
<com.xscm.moduleutil.view.QXMeetUserView
|
||||
android:id="@+id/gv_fz"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_83"
|
||||
android:layout_marginEnd="@dimen/dp_11"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv_zyx"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_zyx"
|
||||
android:translationY="@dimen/dp_78"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zyx"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:translationY="@dimen/dp_98"
|
||||
android:src="@mipmap/zyx"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<com.xscm.moduleutil.view.QXTimeDownView
|
||||
android:id="@+id/qx_djs"
|
||||
android:layout_width="@dimen/dp_88"
|
||||
android:layout_height="@dimen/dp_98"
|
||||
app:layout_constraintStart_toEndOf="@+id/gv_fz"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_zyx"
|
||||
android:translationY="@dimen/dp_98"
|
||||
/>
|
||||
|
||||
<com.xscm.moduleutil.view.QXMeetUserView
|
||||
android:id="@+id/gv_xyz"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_118"
|
||||
android:layout_marginTop="@dimen/dp_21"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv_zyx"
|
||||
android:layout_marginEnd="-13dp"
|
||||
android:translationY="@dimen/dp_78"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gv_fz"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_34"
|
||||
android:src="@mipmap/xlhxd"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintEnd_toStartOf="@+id/gv_sdlw"
|
||||
app:layout_constraintStart_toEndOf="@+id/gv_xyz"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:translationY="-70dp"
|
||||
/>
|
||||
|
||||
|
||||
<com.xscm.moduleutil.view.QXMeetGiftView
|
||||
android:id="@+id/gv_fzlw"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_76"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_zyx"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
app:layout_constraintTop_toTopOf="@+id/gv_fz"
|
||||
android:translationY="@dimen/dp_78"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="-5dp"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
app:layout_constraintStart_toEndOf="@+id/gv_sdlw"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gv_sdlw"
|
||||
app:layout_constraintTop_toTopOf="@+id/gv_sdlw"
|
||||
android:translationY="@dimen/dp_68"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:textColor="#FFBB00"
|
||||
tools:text="1"
|
||||
/>
|
||||
|
||||
<com.xscm.moduleutil.view.QXMeetGiftView
|
||||
android:id="@+id/gv_sdlw"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_118"
|
||||
android:layout_marginTop="14dp"
|
||||
app:layout_constraintTop_toTopOf="@+id/gv_xyz"
|
||||
app:layout_constraintStart_toStartOf="@+id/gv_fzlw"
|
||||
android:layout_marginStart="-11dp"
|
||||
android:translationY="@dimen/dp_68"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time1"
|
||||
android:layout_width="@dimen/dp_18"
|
||||
@@ -73,7 +166,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_bd"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||
tools:text="1" />
|
||||
tools:text="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time2"
|
||||
@@ -87,7 +181,12 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_time1"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||
tools:text="3" />
|
||||
tools:text="3"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<!-- 自定义礼物视图 -->
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time_m"
|
||||
@@ -100,7 +199,8 @@
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_time2"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd" />
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time3"
|
||||
@@ -114,7 +214,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_time_m"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||
tools:text="1" />
|
||||
tools:text="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time4"
|
||||
@@ -128,7 +229,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_time3"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||
tools:text="8" />
|
||||
tools:text="8"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -136,20 +238,21 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_195"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="@mipmap/tour_zj_bj"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_bd">
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_bd"
|
||||
android:visibility="gone">
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_z_bj"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="@dimen/dp_195"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@mipmap/tour_zj_bj"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" -->
|
||||
<!-- />-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_z_bj"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="@dimen/dp_195"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@mipmap/tour_zj_bj"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" -->
|
||||
<!-- />-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/gift_l"
|
||||
@@ -160,7 +263,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_img"
|
||||
@@ -176,8 +280,8 @@
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
tools:text="请选择礼物" />
|
||||
|
||||
<TextView
|
||||
@@ -195,10 +299,10 @@
|
||||
android:id="@+id/tv_gift_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/xlh_num"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:background="@mipmap/xlh_num"
|
||||
tools:text="999" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -207,70 +311,75 @@
|
||||
android:id="@+id/gift_l2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_25"
|
||||
android:background="@mipmap/xlh_g_2"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/give_im"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l2"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l2"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l2"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:scaleType="fitCenter"/>
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l2"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l2"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l2"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/gift_l3"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_73"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginEnd="@dimen/dp_25"
|
||||
android:background="@mipmap/xlh_gift_user"
|
||||
android:orientation="vertical"
|
||||
/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/user_pic"
|
||||
android:layout_width="@dimen/dp_36"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:scaleType="fitCenter"/>
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_43"
|
||||
android:layout_height="@dimen/dp_43"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@mipmap/xlh_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l3"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
tools:text="请选择礼物"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
tools:text="请选择礼物"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -280,25 +389,25 @@
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:orientation="horizontal"
|
||||
android:translationY="@dimen/dp_48"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cl_gift"
|
||||
app:layout_constraintBottom_toTopOf="@+id/exchange_layout"
|
||||
/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/gv_xyz" />
|
||||
|
||||
<!-- <HorizontalScrollView-->
|
||||
<!-- android:id="@+id/horizontalScrollView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="@dimen/dp_200"-->
|
||||
<!-- android:scrollbars="none"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/cl_gift"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/exchange_layout">-->
|
||||
<!-- <HorizontalScrollView-->
|
||||
<!-- android:id="@+id/horizontalScrollView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="@dimen/dp_200"-->
|
||||
<!-- android:scrollbars="none"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/cl_gift"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/exchange_layout">-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/prizeContainer"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="horizontal" />-->
|
||||
<!-- </HorizontalScrollView>-->
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/prizeContainer"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="horizontal" />-->
|
||||
<!-- </HorizontalScrollView>-->
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -307,41 +416,37 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:text="跳过动画"
|
||||
android:textColor="#ABABAB"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_checkbox"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:background="@drawable/selector_custom_checkbox"
|
||||
android:focusable="false"
|
||||
android:clickable="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_option"
|
||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
||||
android:focusable="false"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_option"
|
||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exchange_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/bg_r45_2d449f"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:paddingStart="@dimen/dp_9"
|
||||
android:paddingEnd="@dimen/dp_9"
|
||||
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
|
||||
app:layout_constraintEnd_toEndOf="@+id/lottery_buttons_layout"
|
||||
app:layout_constraintStart_toStartOf="@+id/lottery_buttons_layout"
|
||||
>
|
||||
app:layout_constraintStart_toStartOf="@+id/lottery_buttons_layout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_icon"
|
||||
@@ -349,9 +454,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:drawablePadding="@dimen/dp_5"
|
||||
tools:text="66666"
|
||||
android:textColor="#F8E837"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="66666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dh"
|
||||
@@ -364,7 +469,6 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lottery_buttons_layout"
|
||||
android:layout_width="0dp"
|
||||
@@ -401,8 +505,8 @@
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:gravity="center"
|
||||
tools:text="10币一次"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="10币一次" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -432,8 +536,8 @@
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:gravity="center"
|
||||
tools:text="100币一次"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="100币一次" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -461,8 +565,8 @@
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:drawableLeft="@mipmap/jinb"
|
||||
android:gravity="center"
|
||||
tools:text="1000币一次"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="1000币一次" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
89
moduleUtil/src/main/res/layout/item_gift_record_new.xml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
||||
<!-- 礼物数量 + 名称 -->
|
||||
<TextView
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_user_name"
|
||||
android:id="@+id/tv_gift_count_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="×1娃娃"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_gift_icon"
|
||||
app:layout_constraintRight_toLeftOf="@+id/iv_gift_icon"
|
||||
|
||||
/>
|
||||
|
||||
<!-- 用户名 -->
|
||||
<TextView
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:id="@+id/tv_user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="夏沫"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tv_issue"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_issue"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_issue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="第1期"
|
||||
android:textColor="#A085FF"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 时间 -->
|
||||
<TextView
|
||||
android:layout_marginRight="@dimen/dp_12"
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:text="2024.12.14 11:21:45"
|
||||
android:textColor="#5B5B5B"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_issue"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
<!-- 礼物图标 -->
|
||||
<ImageView
|
||||
android:layout_marginRight="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:id="@+id/iv_gift_icon"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time"
|
||||
|
||||
/>
|
||||
|
||||
<!-- 底部分割线 -->
|
||||
<View
|
||||
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_gift_icon"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,6 +3,7 @@
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_154"
|
||||
android:background="@mipmap/xlh_cj_item"
|
||||
android:id="@+id/ll_bg"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/ke_bg.png
Normal file
|
After Width: | Height: | Size: 543 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/xlhxd.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
@@ -469,4 +469,5 @@
|
||||
<attr name="selectedBackground" format="reference" />
|
||||
<attr name="normalBackground" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -1,38 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="FashionAvatarView">
|
||||
<!-- 头像相关属性 -->
|
||||
<attr name="avatarUrl" format="string" />
|
||||
<attr name="placeholderAvatar" format="reference" />
|
||||
<attr name="avatarRadius" format="dimension" />
|
||||
<attr name="avatarBorderWidth" format="dimension" />
|
||||
<attr name="avatarBorderColor" format="color" />
|
||||
|
||||
<!-- 顶部标签相关属性 -->
|
||||
<attr name="tagText" format="string" />
|
||||
<attr name="tagTextColor" format="color" />
|
||||
<attr name="tagTextSize" format="dimension" />
|
||||
<attr name="tagBackgroundColor" format="color" />
|
||||
<attr name="tagCornerRadius" format="dimension" />
|
||||
<attr name="tagPadding" format="dimension" />
|
||||
<attr name="tagOffsetY" format="dimension" />
|
||||
|
||||
<!-- 底部文字相关属性 -->
|
||||
<attr name="bottomText" format="string" />
|
||||
<attr name="bottomTextColor" format="color" />
|
||||
<attr name="bottomTextSize" format="dimension" />
|
||||
<attr name="bottomTextOffsetY" format="dimension" />
|
||||
|
||||
<!-- 爱心装饰相关属性 -->
|
||||
<attr name="heartIcon" format="reference" />
|
||||
<attr name="heartCount" format="integer" />
|
||||
<attr name="heartSize" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="AvatarWithDecoration">
|
||||
<attr name="decoration" format="reference" />
|
||||
<attr name="decorationScale" format="float" />
|
||||
<attr name="decorationOffsetX" format="integer" />
|
||||
<attr name="decorationOffsetY" format="integer" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -108,6 +108,7 @@
|
||||
<color name="color_FFB6A2FF">#FFB6A2FF</color>
|
||||
<color name="color_FFF4F4F4">#FFF4F4F4</color>
|
||||
<color name="color_FFD0D0FE">#FFD0D0FE</color>
|
||||
<color name="color_FF8D6F28">#FF8D6F28</color>
|
||||
<color name="color_FFB8B8B8">#FFB8B8B8</color>
|
||||
<color name="color_FFA0A0A0">#FFA0A0A0</color>
|
||||
<color name="color_FFFF9400">#FFFF9400</color>
|
||||
|
||||
@@ -332,6 +332,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
mBinding.ivGuanbi.setOnClickListener(this);
|
||||
mBinding.riv.setOnClickListener(this);
|
||||
mBinding.ivShouchl.setOnClickListener(this);
|
||||
//requestGpsPermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -563,7 +564,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
|
||||
// 请求GPS相关权限(精确位置+可选的后台权限)
|
||||
requestGpsPermissions();
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
@@ -574,23 +575,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
// 如需后台使用GPS,添加此权限(Android 10+)
|
||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION
|
||||
).explainReasonBeforeRequest()
|
||||
.onExplainRequestReason(new ExplainReasonCallback() {
|
||||
@Override
|
||||
public void onExplainReason(ExplainScope scope, List<String> deniedList) {
|
||||
String message = "需要GPS权限以获取您的精确位置,用于导航/定位功能";
|
||||
// 若包含后台权限,补充说明
|
||||
|
||||
scope.showRequestReasonDialog(deniedList, message, "确定", "取消");
|
||||
}
|
||||
})
|
||||
// 权限被永久拒绝时,引导至设置页面
|
||||
.onForwardToSettings(new ForwardToSettingsCallback() {
|
||||
@Override
|
||||
public void onForwardToSettings(ForwardScope scope, List<String> deniedList) {
|
||||
scope.showForwardToSettingsDialog(deniedList, "GPS权限被拒绝,无法使用定位功能,请去设置开启", "去设置", "取消");
|
||||
}
|
||||
})
|
||||
)
|
||||
// 权限请求结果回调
|
||||
.request(new RequestCallback() {
|
||||
@Override
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
//package com.example.moduleroom.view;
|
||||
//import android.content.Context;
|
||||
//import android.graphics.drawable.Drawable;
|
||||
//import android.util.AttributeSet;
|
||||
//import android.view.View;
|
||||
//import android.view.animation.Animation;
|
||||
//import android.view.animation.RotateAnimation;
|
||||
//import android.widget.Button;
|
||||
//import android.widget.ImageView;
|
||||
//import android.widget.LinearLayout;
|
||||
//import android.widget.RelativeLayout;
|
||||
//import android.widget.TextView;
|
||||
//
|
||||
//import androidx.annotation.Nullable;
|
||||
//
|
||||
//import com.example.moduleroom.R;
|
||||
//
|
||||
//public class QXMeetGiftView extends RelativeLayout {
|
||||
//
|
||||
// private TextView giftNameLabel;
|
||||
// private ImageView giftPriceBgView;
|
||||
// private Button giftCoin;
|
||||
// private ImageView bgImageView;
|
||||
// private ImageView giftBgImageView;
|
||||
// private ImageView giftImageView;
|
||||
//
|
||||
// private boolean isLockGift;
|
||||
// private Object model; // 这里用 Object 代替 QXDrawGiftModel
|
||||
//
|
||||
// public QXMeetGiftView(Context context) {
|
||||
// super(context);
|
||||
// initSubviews(context);
|
||||
// }
|
||||
//
|
||||
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
|
||||
// super(context, attrs);
|
||||
// initSubviews(context);
|
||||
// }
|
||||
//
|
||||
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
// super(context, attrs, defStyleAttr);
|
||||
// initSubviews(context);
|
||||
// }
|
||||
//
|
||||
// private void initSubviews(Context context) {
|
||||
// // 创建背景图片视图
|
||||
// bgImageView = new ImageView(context);
|
||||
// bgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
// bgImageView.setImageResource(R.drawable.ac_left_gift_bg);
|
||||
// LayoutParams bgParams = new LayoutParams(
|
||||
// LayoutParams.MATCH_PARENT,
|
||||
// LayoutParams.MATCH_PARENT
|
||||
// );
|
||||
// bgParams.addRule(ALIGN_PARENT_TOP);
|
||||
// bgParams.addRule(ALIGN_PARENT_LEFT);
|
||||
// bgParams.addRule(ALIGN_PARENT_RIGHT);
|
||||
// bgParams.bottomMargin = dpToPx(19); // 底部偏移-19
|
||||
// addView(bgImageView, bgParams);
|
||||
//
|
||||
// // 创建礼物背景光效视图
|
||||
// giftBgImageView = new ImageView(context);
|
||||
// giftBgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
// giftBgImageView.setImageResource(R.drawable.ac_lock_gift_light_bg);
|
||||
// giftBgImageView.setVisibility(View.GONE); // 初始隐藏
|
||||
// LayoutParams giftBgParams = new LayoutParams(
|
||||
// LayoutParams.MATCH_PARENT,
|
||||
// LayoutParams.MATCH_PARENT
|
||||
// );
|
||||
// giftBgParams.addRule(ALIGN_PARENT_TOP);
|
||||
// giftBgParams.addRule(ALIGN_PARENT_LEFT);
|
||||
// giftBgParams.addRule(ALIGN_PARENT_RIGHT);
|
||||
// giftBgParams.bottomMargin = dpToPx(19);
|
||||
// addView(giftBgImageView, giftBgParams);
|
||||
//
|
||||
// // 创建礼物图片视图
|
||||
// giftImageView = new ImageView(context);
|
||||
// giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
// LayoutParams giftImageParams = new LayoutParams(
|
||||
// LayoutParams.MATCH_PARENT,
|
||||
// LayoutParams.WRAP_CONTENT
|
||||
// );
|
||||
// giftImageParams.addRule(CENTER_IN_PARENT);
|
||||
// giftImageParams.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||
// addView(giftImageView, giftImageParams);
|
||||
//
|
||||
// // 创建价格背景视图
|
||||
// giftPriceBgView = new ImageView(context);
|
||||
// giftPriceBgView.setImageResource(R.drawable.ac_meet_gift_name_bg);
|
||||
// LayoutParams priceBgParams = new LayoutParams(
|
||||
// LayoutParams.MATCH_PARENT,
|
||||
// dpToPx(15)
|
||||
// );
|
||||
// priceBgParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
// priceBgParams.bottomMargin = dpToPx(15); // 在名称标签上方
|
||||
// addView(giftPriceBgView, priceBgParams);
|
||||
//
|
||||
// // 创建金币按钮
|
||||
// giftCoin = new Button(context);
|
||||
// giftCoin.setTextColor(0xFFC7BF62);
|
||||
// // 设置按钮图标
|
||||
// Drawable coinDrawable = getResources().getDrawable(R.drawable.sky_item_coin);
|
||||
// coinDrawable.setBounds(0, 0, dpToPx(12), dpToPx(12));
|
||||
// giftCoin.setCompoundDrawables(coinDrawable, null, null, null);
|
||||
// giftCoin.setTextSize(10);
|
||||
// giftCoin.setBackgroundColor(0x00000000); // 透明背景
|
||||
// LayoutParams coinParams = new LayoutParams(
|
||||
// LayoutParams.WRAP_CONTENT,
|
||||
// LayoutParams.WRAP_CONTENT
|
||||
// );
|
||||
// coinParams.addRule(CENTER_IN_PARENT, TRUE);
|
||||
// addView(giftCoin, coinParams);
|
||||
//
|
||||
// // 创建礼物名称标签
|
||||
// giftNameLabel = new TextView(context);
|
||||
// giftNameLabel.setTextColor(0xFFFFFFFF);
|
||||
// giftNameLabel.setTextSize(12);
|
||||
// giftNameLabel.setGravity(android.view.Gravity.CENTER);
|
||||
// LayoutParams nameParams = new LayoutParams(
|
||||
// LayoutParams.MATCH_PARENT,
|
||||
// dpToPx(15)
|
||||
// );
|
||||
// nameParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
// addView(giftNameLabel, nameParams);
|
||||
//
|
||||
// // 调整视图层级
|
||||
// bringChildToFront(giftPriceBgView);
|
||||
// bringChildToFront(giftCoin);
|
||||
// }
|
||||
//
|
||||
// public void setIsLockGift(boolean isLockGift) {
|
||||
// this.isLockGift = isLockGift;
|
||||
//
|
||||
// // 设置背景图片
|
||||
// int bgResource = isLockGift ?
|
||||
// R.drawable.ac_lock_gift_bg : R.drawable.ac_meet_gift_name_bg;
|
||||
// bgImageView.setImageResource(bgResource);
|
||||
//
|
||||
// // 显示/隐藏光效背景
|
||||
// giftBgImageView.setVisibility(isLockGift ? View.VISIBLE : View.GONE);
|
||||
//
|
||||
// if (isLockGift) {
|
||||
// // 重新设置礼物图片的约束
|
||||
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||
// params.width = scaleWidth(62);
|
||||
// params.height = scaleWidth(62);
|
||||
// params.addRule(CENTER_IN_PARENT);
|
||||
// params.setMargins(0, 0, 0, 0);
|
||||
// giftImageView.setLayoutParams(params);
|
||||
// } else {
|
||||
// // 恢复原始约束
|
||||
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||
// params.width = LayoutParams.MATCH_PARENT;
|
||||
// params.height = LayoutParams.WRAP_CONTENT;
|
||||
// params.addRule(CENTER_IN_PARENT);
|
||||
// params.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||
// giftImageView.setLayoutParams(params);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void setModel(Object model) {
|
||||
// this.model = model;
|
||||
// // 这里需要根据您的 QXDrawGiftModel 类来实现具体逻辑
|
||||
// /*
|
||||
// if (model instanceof QXDrawGiftModel) {
|
||||
// QXDrawGiftModel giftModel = (QXDrawGiftModel) model;
|
||||
//
|
||||
// // 使用图片加载库加载图片
|
||||
// // Glide.with(getContext()).load(giftModel.getBaseImage()).into(giftImageView);
|
||||
//
|
||||
// giftNameLabel.setText(giftModel.getGiftName());
|
||||
// giftCoin.setText(giftModel.getGiftPrice());
|
||||
// }
|
||||
// */
|
||||
// }
|
||||
//
|
||||
// public void startAnimation() {
|
||||
// // 礼物图片顺时针旋转动画
|
||||
// RotateAnimation rotateAnimation = new RotateAnimation(
|
||||
// 0, 360, // 从 0 度旋转到 360 度
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f
|
||||
// );
|
||||
// rotateAnimation.setDuration(3000); // 3 秒
|
||||
// rotateAnimation.setRepeatCount(Animation.INFINITE);
|
||||
// rotateAnimation.setRepeatMode(Animation.RESTART);
|
||||
// rotateAnimation.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||
// giftImageView.startAnimation(rotateAnimation);
|
||||
//
|
||||
// // 光效背景逆时针旋转动画
|
||||
// RotateAnimation rotateAnimation1 = new RotateAnimation(
|
||||
// 0, -360, // 从 0 度旋转到 -360 度
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
// Animation.RELATIVE_TO_SELF, 0.5f
|
||||
// );
|
||||
// rotateAnimation1.setDuration(3000); // 3 秒
|
||||
// rotateAnimation1.setRepeatCount(Animation.INFINITE);
|
||||
// rotateAnimation1.setRepeatMode(Animation.RESTART);
|
||||
// rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||
// giftBgImageView.startAnimation(rotateAnimation1);
|
||||
// }
|
||||
//
|
||||
// public void resetAnimation() {
|
||||
// giftImageView.clearAnimation();
|
||||
// giftBgImageView.clearAnimation();
|
||||
// }
|
||||
//
|
||||
// public void stopAnimation() {
|
||||
// giftImageView.clearAnimation();
|
||||
// giftBgImageView.clearAnimation();
|
||||
// }
|
||||
//
|
||||
// // 辅助方法:dp 转 px
|
||||
// private int dpToPx(int dp) {
|
||||
// float density = getResources().getDisplayMetrics().density;
|
||||
// return Math.round(dp * density);
|
||||
// }
|
||||
//
|
||||
// // 缩放宽度方法(对应 ScaleWidth)
|
||||
// private int scaleWidth(int value) {
|
||||
// // 这里需要根据您的缩放逻辑实现
|
||||
// // 通常可以根据屏幕密度进行缩放
|
||||
// float scale = getResources().getDisplayMetrics().density;
|
||||
// return (int) (value * scale);
|
||||
// }
|
||||
//
|
||||
// // Getter 方法
|
||||
// public TextView getGiftNameLabel() {
|
||||
// return giftNameLabel;
|
||||
// }
|
||||
//
|
||||
// public ImageView getGiftPriceBgView() {
|
||||
// return giftPriceBgView;
|
||||
// }
|
||||
//
|
||||
// public Button getGiftCoin() {
|
||||
// return giftCoin;
|
||||
// }
|
||||
//
|
||||
// public ImageView getBgImageView() {
|
||||
// return bgImageView;
|
||||
// }
|
||||
//
|
||||
// public ImageView getGiftBgImageView() {
|
||||
// return giftBgImageView;
|
||||
// }
|
||||
//
|
||||
// public ImageView getGiftImageView() {
|
||||
// return giftImageView;
|
||||
// }
|
||||
//
|
||||
// public boolean isLockGift() {
|
||||
// return isLockGift;
|
||||
// }
|
||||
//
|
||||
// public Object getModel() {
|
||||
// return model;
|
||||
// }
|
||||
//}
|
||||
@@ -483,6 +483,9 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:visibility="visible" />
|
||||
<!--https://tmd.xscmmidi.site/data/avatar/head_pic.png-->
|
||||
|
||||
|
||||
|
||||
<com.xscm.moduleutil.widget.DropViewRoom
|
||||
android:id="@+id/xlh_rk"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -8,13 +8,16 @@ import com.xscm.moduleutil.bean.UserInfo;
|
||||
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 UserHomepagePresenter extends BasePresenter<UserHomepageConacts.View> implements UserHomepageConacts.IMePre {
|
||||
UserHomepageConacts.View mView;
|
||||
public UserHomepagePresenter(UserHomepageConacts.View view, Context context) {
|
||||
super(view, context);
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,6 +30,9 @@ public class UserHomepagePresenter extends BasePresenter<UserHomepageConacts.Vie
|
||||
|
||||
@Override
|
||||
public void onNext(UserInfo userInfo) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setUserDetails(userInfo);
|
||||
}
|
||||
});
|
||||
@@ -43,6 +49,9 @@ public class UserHomepagePresenter extends BasePresenter<UserHomepageConacts.Vie
|
||||
|
||||
@Override
|
||||
public void onNext(List<CircleListBean> circleListBeans) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setCircleList(circleListBeans);
|
||||
}
|
||||
});
|
||||
@@ -58,6 +67,9 @@ public class UserHomepagePresenter extends BasePresenter<UserHomepageConacts.Vie
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().userGuanzSuccess(s);
|
||||
}
|
||||
});
|
||||
@@ -74,6 +86,9 @@ public class UserHomepagePresenter extends BasePresenter<UserHomepageConacts.Vie
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setLikeZone();
|
||||
}
|
||||
});
|
||||
|
||||