修改动画
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -99,14 +99,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
private String blind_box_turntable_id = "";//本次抽奖标识id
|
||||
private BlindBoxBean.XlhData xlhData;
|
||||
private int icon;//金币金额
|
||||
private String heart_id="";
|
||||
private String heart_id = "";
|
||||
|
||||
@Override
|
||||
protected GiftLotteryPresenter bindPresenter() {
|
||||
return new GiftLotteryPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static GiftLotteryDialog newInstance(String giftBagId, String roomId, String userIds,String heart_id) {
|
||||
public static GiftLotteryDialog newInstance(String giftBagId, String roomId, String userIds, String heart_id) {
|
||||
GiftLotteryDialog dialog = new GiftLotteryDialog();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("giftBagId", giftBagId);
|
||||
@@ -135,9 +135,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
userIds = getArguments().getString("userIds");
|
||||
// 根据userIds确定类型
|
||||
userIdType = LotteryEvent.fromLotteryEvent(giftBagId);
|
||||
heart_id=getArguments().getString("heart_id");
|
||||
heart_id = getArguments().getString("heart_id");
|
||||
|
||||
if (!EventBus.getDefault().isRegistered( this)){
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
}
|
||||
@@ -149,8 +149,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.mirroeSky.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -158,8 +158,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.cityTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -167,8 +167,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.pinnacleTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSound= check;//音效
|
||||
if(!check){
|
||||
isOpenSound = check;//音效
|
||||
if (!check) {
|
||||
stopPlay();
|
||||
}
|
||||
}
|
||||
@@ -176,36 +176,36 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
mBinding.mirroeSky.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
mBinding.cityTime.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
mBinding.pinnacleTime.swTex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||
isOpenSpecial= check;
|
||||
isOpenSpecial = check;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void stopPlay(){
|
||||
if(mediaPlayer!=null&&player!=null){
|
||||
private void stopPlay() {
|
||||
if (mediaPlayer != null && player != null) {
|
||||
player.stop();
|
||||
player.reset();
|
||||
player=null;
|
||||
player = null;
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.reset();
|
||||
mediaPlayer=null;
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// 根据不同的用户类型显示不同的界面
|
||||
@@ -379,7 +379,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(1);
|
||||
startType = 1;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1", heart_id);
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
return;
|
||||
@@ -389,7 +389,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(2);
|
||||
startType = 2;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6", heart_id);
|
||||
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
@@ -399,7 +399,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
isDrawing = true;
|
||||
// init(3);
|
||||
startType = 3;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9",heart_id);
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9", heart_id);
|
||||
} else {
|
||||
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
}
|
||||
@@ -579,17 +579,18 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceived(MqttXlhEnd event) {
|
||||
XLHBean xlhBean= GsonUtils.fromJson(event.getMessage(), XLHBean.class);
|
||||
XLHBean xlhBean = GsonUtils.fromJson(event.getMessage(), XLHBean.class);
|
||||
// if (xlhBean.getFrom_type()==3) {
|
||||
// dismiss();
|
||||
// }
|
||||
// BlindBoxBean.XlhData xlhData =new BlindBoxBean.XlhData();
|
||||
if (xlhBean.getFrom_type()==3) {
|
||||
if (xlhBean.getFrom_type() == 3) {
|
||||
xlhData.setCurrent_num(0);
|
||||
xlhData.setStatus(0);
|
||||
UpView(xlhData);
|
||||
}
|
||||
}
|
||||
|
||||
/// 定时器
|
||||
public void startFastAnimate() {
|
||||
if (allViewsArray.isEmpty()) {
|
||||
@@ -606,10 +607,10 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
// 停止之前的定时器
|
||||
stopFastAnimate();
|
||||
Log.e("isOpenSound===","isOpenSound111"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound111" + isOpenSound);
|
||||
if (isOpenSound) {
|
||||
// 假设此处有播放音乐的逻辑
|
||||
Log.e("isOpenSound===","raw_music.mp");
|
||||
Log.e("isOpenSound===", "raw_music.mp");
|
||||
playSound("draw_music.mp3");
|
||||
// isOpenSound=false;
|
||||
}
|
||||
@@ -708,7 +709,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
|
||||
private MediaPlayer player;
|
||||
MediaPlayer mediaPlayer ;
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
// 播放音频的方法
|
||||
private void playSound(String fileName) {
|
||||
try {
|
||||
@@ -734,12 +736,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
player.prepare();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// 如果assets中没有找到文件,尝试从raw资源目录加载
|
||||
// try {
|
||||
// player = MediaPlayer.create(getContext(), R.raw.draw_music);
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
AssetFileDescriptor afd = getContext().getAssets().openFd(fileName);
|
||||
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
|
||||
player.prepare();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return player;
|
||||
@@ -883,7 +887,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
if (blindReslutBean.getBlind_box_turntable_id() != null) {
|
||||
blind_box_turntable_id = blindReslutBean.getBlind_box_turntable_id();
|
||||
}
|
||||
if (allViewsArray.size()>0) {
|
||||
if (allViewsArray.size() > 0) {
|
||||
for (int i = 0; i < blindReslutBean.getReslut_list().size(); i++) {
|
||||
BlindReslutBean.ReslutList reslutList = blindReslutBean.getReslut_list().get(i);
|
||||
|
||||
@@ -910,25 +914,25 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MvpPre==null){
|
||||
if (MvpPre == null) {
|
||||
MvpPre = new GiftLotteryPresenter(this, getActivity());
|
||||
}
|
||||
MvpPre.wallet();
|
||||
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound1222" + isOpenSound);
|
||||
if (isOpenSpecial) {//特效
|
||||
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);
|
||||
Log.e("isOpenSound===", "isOpenSound333" + isOpenSound);
|
||||
startFastAnimate();
|
||||
}else{
|
||||
if(isOpenSound){//音效
|
||||
} else {
|
||||
if (isOpenSound) {//音效
|
||||
isDrawing = false;
|
||||
playSound("xuanz.mp3");
|
||||
}else {
|
||||
} else {
|
||||
isDrawing = false;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
isDrawing = false;
|
||||
}
|
||||
|
||||
@@ -966,7 +970,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
} else if (type == 12) {
|
||||
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// dialog 已关闭,不进行 UI 更新
|
||||
return;
|
||||
}
|
||||
@@ -1050,7 +1054,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
player = null;
|
||||
}
|
||||
|
||||
if (EventBus.getDefault().isRegistered( this)){
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = (int) (screenHeight * 0.79);
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
int heightInPx = (int) (screenHeight * 0.85);
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
@@ -175,6 +175,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
mBinding.recycleView.scrollToPosition(middlePosition);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 添加自动滚动相关的方法
|
||||
@@ -323,6 +324,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
@Override
|
||||
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||
if (blindBoxBean != null) {
|
||||
|
||||
getRule_url = blindBoxBean.getRule_url();
|
||||
upTitle(blindBoxBean.getBox_price());
|
||||
giftLists = blindBoxBean.getGift_list();
|
||||
@@ -332,9 +334,10 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
// 获取结束时间并启动倒计时
|
||||
if (blindBoxBean.getXlh_end_time() != null && !blindBoxBean.getXlh_end_time().isEmpty()) {
|
||||
try {
|
||||
// 假设 end_time 是时间戳字符串
|
||||
endTime = Long.parseLong(blindBoxBean.getXlh_end_time());
|
||||
startCountdown();
|
||||
mBinding.qxDjs.setEndTime(endTime);
|
||||
// 假设 end_time 是时间戳字符串
|
||||
// startCountdown();
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果不是时间戳,可能是日期字符串,需要相应解析
|
||||
// 例如:2025-08-26 19:10:47
|
||||
@@ -344,20 +347,30 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
}
|
||||
|
||||
if (blindBoxBean.getGive_homeowner_gift() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getGive_homeowner_gift().getBase_image(), mBinding.giveIm);
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getGive_homeowner_gift().getBase_image(), mBinding.giveIm);
|
||||
mBinding.gvFzlw.setModel(blindBoxBean.getGive_homeowner_gift());
|
||||
}
|
||||
if (blindBoxBean.getLocking_gift() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getLocking_gift().getBase_image(), mBinding.giftImg);
|
||||
mBinding.tvGiftName.setText(blindBoxBean.getLocking_gift().getGift_name());
|
||||
mBinding.tvGiftPrice.setText(blindBoxBean.getLocking_gift().getGift_price());
|
||||
mBinding.tvGiftCount.setText(blindBoxBean.getLocking_gift().getGift_num());
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getLocking_gift().getBase_image(), mBinding.giftImg);
|
||||
// mBinding.tvGiftName.setText(blindBoxBean.getLocking_gift().getGift_name());
|
||||
// mBinding.tvGiftPrice.setText(blindBoxBean.getLocking_gift().getGift_price());
|
||||
// mBinding.tvGiftCount.setText(blindBoxBean.getLocking_gift().getGift_num());
|
||||
|
||||
mBinding.gvSdlw.setModel(blindBoxBean.getLocking_gift());
|
||||
mBinding.gvSdlw.setIsLockGift(true);
|
||||
mBinding.gvSdlw.stopAnimation();
|
||||
mBinding.gvSdlw.startAnimation();
|
||||
}
|
||||
|
||||
if (blindBoxBean.getXlh_user() != null) {
|
||||
ImageUtils.loadHeadCC(blindBoxBean.getXlh_user().getAvatar(), mBinding.userPic);
|
||||
mBinding.userName.setText(blindBoxBean.getXlh_user().getNickname());
|
||||
// ImageUtils.loadHeadCC(blindBoxBean.getXlh_user().getAvatar(), mBinding.userPic);
|
||||
// mBinding.userName.setText(blindBoxBean.getXlh_user().getNickname());
|
||||
|
||||
mBinding.gvXyz.setModel(blindBoxBean.getXlh_user());
|
||||
}
|
||||
|
||||
}
|
||||
mBinding.gvFz.setIsLuckUser(false);
|
||||
giftXlhChouAdapter.setNewData(giftLists);
|
||||
// // 数据加载完成后启动自动滚动
|
||||
// if (giftLists != null && !giftLists.isEmpty()) {
|
||||
@@ -434,6 +447,9 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
long remainingSeconds = seconds % 60;
|
||||
updateCountdownDisplay((int) minutes, (int) remainingSeconds);
|
||||
}
|
||||
mBinding.gvXyz.setIsLuckUser(true);
|
||||
if (blindBoxBean.getHomeowner_user()!=null){
|
||||
mBinding.gvFz.setModel(blindBoxBean.getHomeowner_user());
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
@@ -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) {
|
||||
@@ -3603,7 +3566,8 @@ public class RetrofitClient {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -3622,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
package com.xscm.moduleutil.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
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 {
|
||||
|
||||
@@ -31,198 +28,160 @@ public class QXMeetGiftView extends RelativeLayout {
|
||||
private ImageView giftBgImageView;
|
||||
private ImageView giftImageView;
|
||||
|
||||
// 自定义属性变量
|
||||
private int normalBgRes;
|
||||
private int lockBgRes;
|
||||
private int giftLightBgRes;
|
||||
private int priceBgRes;
|
||||
private int coinIconRes;
|
||||
private int giftNameColor;
|
||||
private int coinTextColor;
|
||||
private float giftNameSize;
|
||||
private float coinTextSize;
|
||||
private int bgBottomMargin;
|
||||
private int giftImageMargin;
|
||||
private int priceBgHeight;
|
||||
private int priceBgBottomMargin;
|
||||
private int lockGiftSize;
|
||||
private int rotateDuration;
|
||||
|
||||
private boolean isLockGift;
|
||||
private Object model;
|
||||
private Object model; // 这里用 Object 代替 QXDrawGiftModel
|
||||
|
||||
public QXMeetGiftView(Context context) {
|
||||
this(context, null);
|
||||
super(context);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
super(context, attrs);
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
public QXMeetGiftView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
// 解析自定义属性
|
||||
initAttrs(context, attrs);
|
||||
// 初始化子视图
|
||||
initSubviews(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析自定义属性,设置默认值
|
||||
*/
|
||||
private void initAttrs(Context context, AttributeSet attrs) {
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.QXMeetGiftView);
|
||||
|
||||
// 背景资源(默认使用原代码中的资源)
|
||||
normalBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_normalBg, R.mipmap.xlh_g_2);
|
||||
lockBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_lockBg, R.mipmap.ic_launcher);
|
||||
giftLightBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_giftLightBg, R.mipmap.jinb);
|
||||
priceBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_priceBg, R.mipmap.ic_launcher);
|
||||
coinIconRes = ta.getResourceId(R.styleable.QXMeetGiftView_coinIcon, R.mipmap.ic_launcher);
|
||||
|
||||
// 文字样式
|
||||
giftNameColor = ta.getColor(R.styleable.QXMeetGiftView_giftNameColor, 0xFFFFFFFF);
|
||||
coinTextColor = ta.getColor(R.styleable.QXMeetGiftView_coinTextColor, 0xFFC7BF62);
|
||||
giftNameSize = ta.getDimension(R.styleable.QXMeetGiftView_giftNameSize, sp2px(12));
|
||||
coinTextSize = ta.getDimension(R.styleable.QXMeetGiftView_coinTextSize, sp2px(10));
|
||||
|
||||
// 尺寸配置
|
||||
bgBottomMargin = ta.getDimensionPixelOffset(R.styleable.QXMeetGiftView_bgBottomMargin, dp2px(19));
|
||||
giftImageMargin = ta.getDimensionPixelOffset(R.styleable.QXMeetGiftView_giftImageMargin, dp2px(6));
|
||||
priceBgHeight = ta.getDimensionPixelOffset(R.styleable.QXMeetGiftView_priceBgHeight, dp2px(15));
|
||||
priceBgBottomMargin = ta.getDimensionPixelOffset(R.styleable.QXMeetGiftView_priceBgBottomMargin, dp2px(15));
|
||||
lockGiftSize = ta.getDimensionPixelOffset(R.styleable.QXMeetGiftView_lockGiftSize, dp2px(62));
|
||||
|
||||
// 动画时长
|
||||
rotateDuration = ta.getInt(R.styleable.QXMeetGiftView_rotateDuration, 3000);
|
||||
|
||||
ta.recycle(); // 回收资源,避免内存泄漏
|
||||
}
|
||||
|
||||
private void initSubviews(Context context) {
|
||||
// 1. 主背景
|
||||
// 创建背景图片视图
|
||||
bgImageView = new ImageView(context);
|
||||
bgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
bgImageView.setImageResource(normalBgRes); // 使用自定义属性
|
||||
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 = bgBottomMargin; // 使用自定义属性
|
||||
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);
|
||||
|
||||
// 2. 礼物光效背景
|
||||
giftBgImageView = new ImageView(context);
|
||||
giftBgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
giftBgImageView.setImageResource(giftLightBgRes); // 使用自定义属性
|
||||
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 = bgBottomMargin; // 使用自定义属性
|
||||
addView(giftBgImageView, giftBgParams);
|
||||
|
||||
// 3. 礼物图片
|
||||
// 创建礼物图片视图(圆形)
|
||||
giftImageView = new ImageView(context);
|
||||
giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
LayoutParams giftImageParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
||||
giftImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
LayoutParams giftImageParams = new LayoutParams(
|
||||
dpToPx(60), // 固定宽度
|
||||
dpToPx(60) // 固定高度
|
||||
);
|
||||
giftImageParams.addRule(CENTER_IN_PARENT);
|
||||
giftImageParams.setMargins(giftImageMargin, giftImageMargin, giftImageMargin, 0); // 使用自定义属性
|
||||
giftImageParams.topMargin = dpToPx(10);
|
||||
addView(giftImageView, giftImageParams);
|
||||
|
||||
// 4. 价格背景
|
||||
giftPriceBgView = new ImageView(context);
|
||||
giftPriceBgView.setImageResource(priceBgRes); // 使用自定义属性
|
||||
LayoutParams priceBgParams = new LayoutParams(LayoutParams.MATCH_PARENT, priceBgHeight); // 使用自定义属性
|
||||
priceBgParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
priceBgParams.bottomMargin = priceBgBottomMargin; // 使用自定义属性
|
||||
addView(giftPriceBgView, priceBgParams);
|
||||
// 创建礼物背景光效视图
|
||||
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);
|
||||
|
||||
// 5. 金币按钮
|
||||
// 创建金币按钮
|
||||
giftCoin = new Button(context);
|
||||
giftCoin.setTextColor(coinTextColor); // 使用自定义属性
|
||||
giftCoin.setTextSize(TypedValue.COMPLEX_UNIT_PX, coinTextSize); // 使用自定义属性
|
||||
// 金币图标
|
||||
Drawable coinDrawable = getResources().getDrawable(coinIconRes); // 使用自定义属性
|
||||
coinDrawable.setBounds(0, 0, dp2px(12), dp2px(12));
|
||||
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_IN_PARENT, TRUE);
|
||||
LayoutParams coinParams = new LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
coinParams.addRule(CENTER_HORIZONTAL);
|
||||
coinParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
coinParams.bottomMargin = dpToPx(25);
|
||||
addView(giftCoin, coinParams);
|
||||
|
||||
// 6. 礼物名称
|
||||
// 创建礼物名称标签
|
||||
giftNameLabel = new TextView(context);
|
||||
giftNameLabel.setTextColor(giftNameColor); // 使用自定义属性
|
||||
giftNameLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, giftNameSize); // 使用自定义属性
|
||||
giftNameLabel.setGravity(Gravity.CENTER);
|
||||
LayoutParams nameParams = new LayoutParams(LayoutParams.MATCH_PARENT, priceBgHeight); // 使用自定义属性
|
||||
nameParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||
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(BELOW, giftCoin.getId());
|
||||
nameParams.topMargin = dpToPx(5);
|
||||
addView(giftNameLabel, nameParams);
|
||||
|
||||
// 调整层级
|
||||
bringChildToFront(giftPriceBgView);
|
||||
bringChildToFront(giftCoin);
|
||||
// 调整视图层级 - 确保正确的层级关系
|
||||
// 按添加顺序已经确定层级,最晚添加的在最上层
|
||||
}
|
||||
|
||||
public void setIsLockGift(boolean isLockGift) {
|
||||
this.isLockGift = isLockGift;
|
||||
|
||||
// 设置背景图片(使用自定义属性)
|
||||
int bgResource = isLockGift ? lockBgRes : normalBgRes;
|
||||
// 设置背景图片
|
||||
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);
|
||||
|
||||
// 调整礼物图片尺寸(使用自定义属性)
|
||||
LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||
if (isLockGift) {
|
||||
params.width = lockGiftSize;
|
||||
params.height = lockGiftSize;
|
||||
// 重新设置礼物图片的约束
|
||||
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.setMargins(giftImageMargin, giftImageMargin, giftImageMargin, 0);
|
||||
params.addRule(CENTER_IN_PARENT);
|
||||
params.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||
giftImageView.setLayoutParams(params);
|
||||
}
|
||||
giftImageView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
public void setModel(Object model) {
|
||||
public void setModel(BlindBoxBean.GiveGift model) {
|
||||
this.model = model;
|
||||
// 实际业务中解析模型数据
|
||||
/*
|
||||
if (model instanceof QXDrawGiftModel) {
|
||||
QXDrawGiftModel giftModel = (QXDrawGiftModel) model;
|
||||
giftNameLabel.setText(giftModel.getGiftName());
|
||||
giftCoin.setText(giftModel.getGiftPrice());
|
||||
// Glide.with(getContext()).load(giftModel.getBaseImage()).into(giftImageView);
|
||||
// 这里需要根据您的 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, // 从 0 度旋转到 360 度
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f
|
||||
);
|
||||
rotateAnimation.setDuration(rotateDuration);
|
||||
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, // 从 0 度旋转到 -360 度
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f
|
||||
);
|
||||
rotateAnimation1.setDuration(rotateDuration);
|
||||
rotateAnimation1.setDuration(3000); // 3 秒
|
||||
rotateAnimation1.setRepeatCount(Animation.INFINITE);
|
||||
rotateAnimation1.setRepeatMode(Animation.RESTART);
|
||||
rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||
@@ -239,31 +198,50 @@ public class QXMeetGiftView extends RelativeLayout {
|
||||
giftBgImageView.clearAnimation();
|
||||
}
|
||||
|
||||
// dp转px
|
||||
private int dp2px(int dp) {
|
||||
return (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
getResources().getDisplayMetrics()
|
||||
);
|
||||
// 辅助方法:dp 转 px
|
||||
private int dpToPx(int dp) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * density);
|
||||
}
|
||||
|
||||
// sp转px
|
||||
private int sp2px(int sp) {
|
||||
return (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
sp,
|
||||
getResources().getDisplayMetrics()
|
||||
);
|
||||
// 缩放宽度方法(对应 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; }
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png
Normal file
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png
Normal file
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png
Normal file
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 KiB |
@@ -61,6 +61,73 @@
|
||||
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"
|
||||
/>
|
||||
|
||||
|
||||
<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"
|
||||
/>
|
||||
|
||||
|
||||
<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 +140,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 +155,8 @@
|
||||
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"/>
|
||||
|
||||
|
||||
<!-- 自定义礼物视图 -->
|
||||
@@ -104,7 +173,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"
|
||||
@@ -118,7 +188,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"
|
||||
@@ -132,7 +203,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
|
||||
@@ -143,7 +215,8 @@
|
||||
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"-->
|
||||
@@ -164,7 +237,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"
|
||||
@@ -216,7 +290,8 @@
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/give_im"
|
||||
@@ -228,7 +303,8 @@
|
||||
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" />
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l2"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
@@ -240,7 +316,8 @@
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/user_pic"
|
||||
@@ -250,7 +327,8 @@
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3" />
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_43"
|
||||
@@ -260,7 +338,8 @@
|
||||
android:src="@mipmap/xlh_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3" />
|
||||
app:layout_constraintTop_toTopOf="@+id/gift_l3"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
@@ -273,7 +352,8 @@
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
|
||||
app:layout_constraintStart_toStartOf="@+id/gift_l3"
|
||||
tools:text="请选择礼物" />
|
||||
tools:text="请选择礼物"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -283,9 +363,10 @@
|
||||
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_constraintBottom_toTopOf="@+id/exchange_layout"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cl_gift" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/gv_xyz" />
|
||||
|
||||
<!-- <HorizontalScrollView-->
|
||||
<!-- android:id="@+id/horizontalScrollView"-->
|
||||
|
||||
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png
Normal file
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,62 +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>
|
||||
<declare-styleable name="QXMeetGiftView">
|
||||
<!-- 背景图片配置 -->
|
||||
<attr name="normalBg" format="reference" /> <!-- 正常状态背景 -->
|
||||
<attr name="lockBg" format="reference" /> <!-- 锁定状态背景 -->
|
||||
<attr name="giftLightBg" format="reference" /> <!-- 礼物光效背景 -->
|
||||
<attr name="priceBg" format="reference" /> <!-- 价格背景 -->
|
||||
<attr name="coinIcon" format="reference" /> <!-- 金币图标 -->
|
||||
|
||||
<!-- 文字样式配置 -->
|
||||
<attr name="giftNameColor" format="color" /> <!-- 礼物名称颜色 -->
|
||||
<attr name="coinTextColor" format="color" /> <!-- 金币文字颜色 -->
|
||||
<attr name="giftNameSize" format="dimension" /> <!-- 礼物名称字号 -->
|
||||
<attr name="coinTextSize" format="dimension" /> <!-- 金币文字字号 -->
|
||||
|
||||
<!-- 尺寸配置 -->
|
||||
<attr name="bgBottomMargin" format="dimension" /> <!-- 背景底部边距 -->
|
||||
<attr name="giftImageMargin" format="dimension" /> <!-- 礼物图片边距 -->
|
||||
<attr name="priceBgHeight" format="dimension" /> <!-- 价格背景高度 -->
|
||||
<attr name="priceBgBottomMargin" format="dimension" /> <!-- 价格背景底部边距 -->
|
||||
<attr name="lockGiftSize" format="dimension" /> <!-- 锁定状态礼物图片尺寸 -->
|
||||
|
||||
<!-- 动画配置 -->
|
||||
<attr name="rotateDuration" format="integer" /> <!-- 旋转动画时长(ms) -->
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user