diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/bean/blindboxwheel/BlindBoxBean.java b/moduleUtil/src/main/java/com/xscm/moduleutil/bean/blindboxwheel/BlindBoxBean.java index bd42255..ec7b288 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/bean/blindboxwheel/BlindBoxBean.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/bean/blindboxwheel/BlindBoxBean.java @@ -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; diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/dialog/giftLottery/GiftLotteryDialog.java b/moduleUtil/src/main/java/com/xscm/moduleutil/dialog/giftLottery/GiftLotteryDialog.java index c532ee4..7530371 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/dialog/giftLottery/GiftLotteryDialog.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/dialog/giftLottery/GiftLotteryDialog.java @@ -99,14 +99,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment0) { + 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> call, Response> response) { if (response.code() == 200) { BaseModel body = response.body(); - observer.onNext(body.getMsg()); } @@ -391,7 +389,6 @@ public class RetrofitClient { sApiServer.exchangeCoin(earnings_num).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { - onNextRetu(response, observer); } @@ -425,7 +422,7 @@ public class RetrofitClient { public void onResponse(Call> call, Response> response) { if (response.code() == 200) { BaseModel 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>> 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>> 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>> 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> observer) { + public void getHostList(String roomId, String + type, BaseObserver> observer) { sApiServer.getHostList(roomId, type).enqueue(new Callback>>() { @Override public void onResponse(Call>> call, Response>> response) { @@ -2078,7 +2073,8 @@ public class RetrofitClient { }); } - public void getSearch(String keyWord, String type, BaseObserver> observer) { + public void getSearch(String keyWord, String + type, BaseObserver> observer) { sApiServer.getSearch(keyWord, type).enqueue(new Callback>>() { @Override public void onResponse(Call>> call, Response>> response) { @@ -2117,7 +2113,8 @@ public class RetrofitClient { }); } - public void getCharmList(String roomId, String stime, String etime, String p, BaseObserver observer) { + public void getCharmList(String roomId, String stime, String etime, String + p, BaseObserver observer) { sApiServer.getCharmList(roomId, stime, etime, p).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { @@ -2180,20 +2177,29 @@ public class RetrofitClient { sApiServer.roomAuctionJoin(auctionId, userId, giftId, num, type).enqueue(new ApiResponseCallback(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>() { +// +// @Override +// public void onResponse(Call> call, Response> response) { +// if (response.code() == 200) { +// BaseModel baseModel = response.body(); +// +// if (baseModel.getCode() == 1) { +// observer.onNext( null); +// } else { +// ToastUtils.showShort(baseModel.getMsg()); +// } +// } +// } +// +// @Override +// public void onFailure(Call> call, Throwable t) { +// t.printStackTrace(); +// } +// }); } public void auctionDelay(String auctionId, BaseObserver observer) { @@ -2206,7 +2212,6 @@ public class RetrofitClient { @Override public void onFailure(Call> call, Throwable t) { ToastUtils.showShort(t.toString()); - LogUtils.e("auction",t); } }); } @@ -2224,7 +2229,7 @@ public class RetrofitClient { @Override public void onFailure(Call> call, Throwable t) { -// ToastUtils.showShort(t.toString()); + ToastUtils.showShort(t.toString()); } }); } @@ -2238,7 +2243,7 @@ public class RetrofitClient { @Override public void onFailure(Call> call, Throwable t) { -// ToastUtils.showShort(t.toString()); + ToastUtils.showShort(t.toString()); } }); } @@ -2252,7 +2257,7 @@ public class RetrofitClient { @Override public void onFailure(Call> call, Throwable t) { -// ToastUtils.showShort(t.toString()); + ToastUtils.showShort(t.toString()); } }); } @@ -2268,8 +2273,7 @@ public class RetrofitClient { @Override public void onFailure(Call> 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> 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> 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> 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> 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> 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> 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> 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> 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 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 observer) { sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { @@ -2436,9 +2433,7 @@ public class RetrofitClient { @Override public void onFailure(Call> 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 observer) { + public void setMutePit(String roomId, String user_id, String + isMute, BaseObserver observer) { sApiServer.setMutePit(roomId, user_id, isMute).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { @@ -2625,8 +2621,7 @@ public class RetrofitClient { @Override public void onFailure(Call> 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> 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> 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> 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> 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> 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> 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> call, Throwable t) { ToastUtils.showShort(t.toString()); - LogUtils.e("changeSong", t.toString()); } }); } @@ -2827,8 +2815,7 @@ public class RetrofitClient { @Override public void onFailure(Call> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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 observer) { + public void getPostData(String new_password, String mobile, String code, String + userId, BaseObserver observer) { sApiServer.getPostData(new_password, mobile, code, userId).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { @@ -3121,8 +3098,7 @@ public class RetrofitClient { @Override public void onFailure(Call> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> call, Throwable t) { -// ToastUtils.showShort(t.toString()); - LogUtils.e("changeRoomType", t.toString()); + ToastUtils.showShort(t.toString()); } }); } - public void onNextRetu(Response> response, BaseObserver observer) { + public void onNextRetu + (Response> response, BaseObserver observer) { if (response.code() == 200) { BaseModel string = response.body(); if (string != null) { @@ -3450,7 +3412,8 @@ public class RetrofitClient { } /// 获取活动礼物列表 - public void getBoxGiftList(String giftBagId, String roomId, BaseObserver observer) { + public void getBoxGiftList(String giftBagId, String + roomId, BaseObserver observer) { sApiServer.getBoxGiftList(giftBagId, roomId).enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { @@ -3603,7 +3566,8 @@ public class RetrofitClient { } } - public void xlhMyRecord(String roomId, String page, String pageSize, BaseObserver> observer) { + public void xlhMyRecord(String roomId, String page, String + pageSize, BaseObserver> observer) { sApiServer.xlhMyRecord(roomId, page, pageSize).enqueue(new Callback>>() { @Override public void onResponse(Call>> call, Response>> response) { @@ -3622,7 +3586,8 @@ public class RetrofitClient { }); } - public void getAllRecord(String giftBagId, String page, String pageSize, BaseObserver> observer) { + public void getAllRecord(String giftBagId, String page, String + pageSize, BaseObserver> observer) { sApiServer.getAllRecord(giftBagId, page, pageSize).enqueue(new Callback>>() { @Override public void onResponse(Call>> call, Response>> response) { diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/view/AvatarWithDecoration.java b/moduleUtil/src/main/java/com/xscm/moduleutil/view/AvatarWithDecoration.java deleted file mode 100644 index 3112883..0000000 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/view/AvatarWithDecoration.java +++ /dev/null @@ -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(); - } - } -} - diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/view/FashionAvatarView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/view/FashionAvatarView.java deleted file mode 100644 index e0ab8c0..0000000 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/view/FashionAvatarView.java +++ /dev/null @@ -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 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() { - @Override - public void onResourceReady(Bitmap resource, Transition 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(); - } -} - diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetGiftView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetGiftView.java index 7e370fa..73a357d 100644 --- a/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetGiftView.java +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetGiftView.java @@ -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; + } +} \ No newline at end of file diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetUserView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetUserView.java new file mode 100644 index 0000000..392b242 --- /dev/null +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXMeetUserView.java @@ -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); + } + } +} \ No newline at end of file diff --git a/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXTimeDownView.java b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXTimeDownView.java new file mode 100644 index 0000000..9e0a9a9 --- /dev/null +++ b/moduleUtil/src/main/java/com/xscm/moduleutil/view/QXTimeDownView.java @@ -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(); + } +} \ No newline at end of file diff --git a/moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png new file mode 100644 index 0000000..5f0eff0 Binary files /dev/null and b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_left_gift_bg.png differ diff --git a/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png new file mode 100644 index 0000000..b67b241 Binary files /dev/null and b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_bg.png differ diff --git a/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_light_bg.png b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_light_bg.png new file mode 100644 index 0000000..f3258cc Binary files /dev/null and b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_lock_gift_light_bg.png differ diff --git a/moduleUtil/src/main/res/drawable-xxxhdpi/ac_meet_gift_name_bg.png b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_meet_gift_name_bg.png new file mode 100644 index 0000000..ff17a58 Binary files /dev/null and b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_meet_gift_name_bg.png differ diff --git a/moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png new file mode 100644 index 0000000..ec5d9a4 Binary files /dev/null and b/moduleUtil/src/main/res/drawable-xxxhdpi/ac_time_down_bg.png differ diff --git a/moduleUtil/src/main/res/layout/fragment_tour_club_dialog.xml b/moduleUtil/src/main/res/layout/fragment_tour_club_dialog.xml index 906b842..1f23785 100644 --- a/moduleUtil/src/main/res/layout/fragment_tour_club_dialog.xml +++ b/moduleUtil/src/main/res/layout/fragment_tour_club_dialog.xml @@ -61,6 +61,73 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/tv_gz" /> + + + + + + + + + + + + + + + + tools:text="1" + android:visibility="gone"/> + 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"/> + tools:text="1" + android:visibility="gone"/> + tools:text="8" + android:visibility="gone"/> + app:layout_constraintTop_toBottomOf="@+id/tv_bd" + android:visibility="gone"> @@ -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"> + app:layout_constraintTop_toTopOf="parent" + android:visibility="gone"/> + app:layout_constraintTop_toTopOf="@+id/gift_l2" + android:visibility="gone"/> + app:layout_constraintTop_toTopOf="parent" + android:visibility="gone"/> + app:layout_constraintTop_toTopOf="@+id/gift_l3" + android:visibility="gone"/> + app:layout_constraintTop_toTopOf="@+id/gift_l3" + android:visibility="gone"/> + tools:text="请选择礼物" + android:visibility="gone"/> @@ -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" /> diff --git a/moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png b/moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png new file mode 100644 index 0000000..a0e9f94 Binary files /dev/null and b/moduleUtil/src/main/res/mipmap-xxhdpi/zyx.png differ diff --git a/moduleUtil/src/main/res/values/attrs.xml b/moduleUtil/src/main/res/values/attrs.xml deleted file mode 100644 index 8cff417..0000000 --- a/moduleUtil/src/main/res/values/attrs.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/moduleUtil/src/main/res/values/colors.xml b/moduleUtil/src/main/res/values/colors.xml index cf6075f..a569f84 100644 --- a/moduleUtil/src/main/res/values/colors.xml +++ b/moduleUtil/src/main/res/values/colors.xml @@ -108,6 +108,7 @@ #FFB6A2FF #FFF4F4F4 #FFD0D0FE + #FF8D6F28 #FFB8B8B8 #FFA0A0A0 #FFFF9400 diff --git a/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java b/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java index a1e19ca..90deee2 100644 --- a/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java +++ b/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java @@ -8,13 +8,16 @@ import com.xscm.moduleutil.bean.UserInfo; import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.presenter.BasePresenter; +import java.lang.ref.WeakReference; import java.util.List; import io.reactivex.disposables.Disposable; public class UserHomepagePresenter extends BasePresenter implements UserHomepageConacts.IMePre { + UserHomepageConacts.View mView; public UserHomepagePresenter(UserHomepageConacts.View view, Context context) { super(view, context); + this.mView = view; } @Override @@ -27,6 +30,9 @@ public class UserHomepagePresenter extends BasePresenter(mView); + } MvpRef.get().setUserDetails(userInfo); } }); @@ -43,6 +49,9 @@ public class UserHomepagePresenter extends BasePresenter circleListBeans) { + if (MvpRef==null){ + MvpRef=new WeakReference<>(mView); + } MvpRef.get().setCircleList(circleListBeans); } }); @@ -58,6 +67,9 @@ public class UserHomepagePresenter extends BasePresenter(mView); + } MvpRef.get().userGuanzSuccess(s); } }); @@ -74,6 +86,9 @@ public class UserHomepagePresenter extends BasePresenter(mView); + } MvpRef.get().setLikeZone(); } });