1.合并分支

This commit is contained in:
2025-09-26 16:00:01 +08:00
parent 7a084b6b2b
commit 5c5d2550bd
6 changed files with 370 additions and 349 deletions

View File

@@ -0,0 +1,269 @@
//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.RelativeLayout;
//import android.widget.TextView;
//
//import androidx.annotation.Nullable;
//
//import com.xscm.moduleutil.R;
//
//
//public class QXMeetGiftView extends RelativeLayout {
//
// private TextView giftNameLabel;
// private ImageView giftPriceBgView;
// private Button giftCoin;
// private ImageView bgImageView;
// private ImageView giftBgImageView;
// private ImageView giftImageView;
//
// // 自定义属性变量
// private 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;
//
// public QXMeetGiftView(Context context) {
// this(context, null);
// }
//
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
// this(context, attrs, 0);
// }
//
// 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.drawable.ac_left_gift_bg);
// lockBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_lockBg, R.drawable.ac_lock_gift_bg);
// giftLightBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_giftLightBg, R.drawable.ac_lock_gift_light_bg);
// priceBgRes = ta.getResourceId(R.styleable.QXMeetGiftView_priceBg, R.drawable.ac_meet_gift_name_bg);
// coinIconRes = ta.getResourceId(R.styleable.QXMeetGiftView_coinIcon, R.drawable.sky_item_coin);
//
// // 文字样式
// 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; // 使用自定义属性
// 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);
// giftImageParams.addRule(CENTER_IN_PARENT);
// giftImageParams.setMargins(giftImageMargin, giftImageMargin, giftImageMargin, 0); // 使用自定义属性
// 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);
//
// // 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.setCompoundDrawables(coinDrawable, null, null, null);
// giftCoin.setBackgroundColor(0x00000000); // 透明背景
// LayoutParams coinParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// coinParams.addRule(CENTER_IN_PARENT, TRUE);
// 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);
// addView(giftNameLabel, nameParams);
//
// // 调整层级
// bringChildToFront(giftPriceBgView);
// bringChildToFront(giftCoin);
// }
//
// public void setIsLockGift(boolean isLockGift) {
// this.isLockGift = isLockGift;
//
// // 设置背景图片(使用自定义属性)
// int bgResource = isLockGift ? lockBgRes : normalBgRes;
// bgImageView.setImageResource(bgResource);
//
// // 显示/隐藏光效背景
// giftBgImageView.setVisibility(isLockGift ? View.VISIBLE : View.GONE);
//
// // 调整礼物图片尺寸(使用自定义属性)
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
// if (isLockGift) {
// params.width = lockGiftSize;
// params.height = lockGiftSize;
// params.setMargins(0, 0, 0, 0);
// } else {
// params.width = LayoutParams.MATCH_PARENT;
// params.height = LayoutParams.WRAP_CONTENT;
// params.setMargins(giftImageMargin, giftImageMargin, giftImageMargin, 0);
// }
// giftImageView.setLayoutParams(params);
// }
//
// public void setModel(Object 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);
// }
// */
// }
//
// public void startAnimation() {
// // 礼物图片顺时针旋转(使用自定义动画时长)
// RotateAnimation rotateAnimation = new RotateAnimation(
// 0, 360,
// Animation.RELATIVE_TO_SELF, 0.5f,
// Animation.RELATIVE_TO_SELF, 0.5f
// );
// rotateAnimation.setDuration(rotateDuration);
// 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,
// Animation.RELATIVE_TO_SELF, 0.5f,
// Animation.RELATIVE_TO_SELF, 0.5f
// );
// rotateAnimation1.setDuration(rotateDuration);
// rotateAnimation1.setRepeatCount(Animation.INFINITE);
// rotateAnimation1.setRepeatMode(Animation.RESTART);
// rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
// giftBgImageView.startAnimation(rotateAnimation1);
// }
//
// public void resetAnimation() {
// giftImageView.clearAnimation();
// giftBgImageView.clearAnimation();
// }
//
// public void stopAnimation() {
// giftImageView.clearAnimation();
// giftBgImageView.clearAnimation();
// }
//
// // dp转px
// private int dp2px(int dp) {
// return (int) TypedValue.applyDimension(
// TypedValue.COMPLEX_UNIT_DIP,
// dp,
// getResources().getDisplayMetrics()
// );
// }
//
// // sp转px
// private int sp2px(int sp) {
// return (int) TypedValue.applyDimension(
// TypedValue.COMPLEX_UNIT_SP,
// sp,
// getResources().getDisplayMetrics()
// );
// }
//
// // 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; }
//}

View File

@@ -89,6 +89,10 @@
app:layout_constraintTop_toTopOf="@+id/tv_bd" app:layout_constraintTop_toTopOf="@+id/tv_bd"
tools:text="3" /> tools:text="3" />
<!-- 自定义礼物视图 -->
<TextView <TextView
android:id="@+id/tv_time_m" android:id="@+id/tv_time_m"
android:layout_width="@dimen/dp_18" android:layout_width="@dimen/dp_18"
@@ -136,20 +140,20 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_195" android:layout_height="@dimen/dp_195"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
app:layout_constraintEnd_toEndOf="parent"
android:background="@mipmap/tour_zj_bj" android:background="@mipmap/tour_zj_bj"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_bd"> app:layout_constraintTop_toBottomOf="@+id/tv_bd">
<!-- <ImageView--> <!-- <ImageView-->
<!-- android:id="@+id/iv_z_bj"--> <!-- android:id="@+id/iv_z_bj"-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_195"--> <!-- android:layout_height="@dimen/dp_195"-->
<!-- android:scaleType="fitCenter"--> <!-- android:scaleType="fitCenter"-->
<!-- android:src="@mipmap/tour_zj_bj"--> <!-- android:src="@mipmap/tour_zj_bj"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"--> <!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" --> <!-- app:layout_constraintTop_toTopOf="parent" -->
<!-- />--> <!-- />-->
<LinearLayout <LinearLayout
android:id="@+id/gift_l" android:id="@+id/gift_l"
@@ -176,8 +180,8 @@
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:textColor="@color/black" android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
android:textStyle="bold"
tools:text="请选择礼物" /> tools:text="请选择礼物" />
<TextView <TextView
@@ -195,10 +199,10 @@
android:id="@+id/tv_gift_count" android:id="@+id/tv_gift_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@mipmap/xlh_num"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
android:background="@mipmap/xlh_num"
tools:text="999" /> tools:text="999" />
</LinearLayout> </LinearLayout>
@@ -207,70 +211,69 @@
android:id="@+id/gift_l2" android:id="@+id/gift_l2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="@dimen/dp_25" android:layout_marginStart="@dimen/dp_25"
android:background="@mipmap/xlh_g_2" android:background="@mipmap/xlh_g_2"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/give_im" android:id="@+id/give_im"
android:layout_width="@dimen/dp_40" android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
app:layout_constraintStart_toStartOf="@+id/gift_l2"
app:layout_constraintEnd_toEndOf="@+id/gift_l2"
app:layout_constraintTop_toTopOf="@+id/gift_l2"
android:layout_marginBottom="@dimen/dp_20" android:layout_marginBottom="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="@+id/gift_l2" android:scaleType="fitCenter"
android:src="@mipmap/ic_launcher" android:src="@mipmap/ic_launcher"
android:scaleType="fitCenter"/> app:layout_constraintBottom_toBottomOf="@+id/gift_l2"
app:layout_constraintEnd_toEndOf="@+id/gift_l2"
app:layout_constraintStart_toStartOf="@+id/gift_l2"
app:layout_constraintTop_toTopOf="@+id/gift_l2" />
<LinearLayout <LinearLayout
android:id="@+id/gift_l3" android:id="@+id/gift_l3"
android:layout_width="@dimen/dp_56" android:layout_width="@dimen/dp_56"
android:layout_height="@dimen/dp_73" android:layout_height="@dimen/dp_73"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="@dimen/dp_25" android:layout_marginEnd="@dimen/dp_25"
android:background="@mipmap/xlh_gift_user" android:background="@mipmap/xlh_gift_user"
android:orientation="vertical" android:orientation="vertical"
/> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.xscm.moduleutil.widget.GifAvatarOvalView <com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/user_pic" android:id="@+id/user_pic"
android:layout_width="@dimen/dp_36" android:layout_width="@dimen/dp_36"
android:layout_height="@dimen/dp_36" android:layout_height="@dimen/dp_36"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintTop_toTopOf="@+id/gift_l3"
android:layout_marginTop="@dimen/dp_2" android:layout_marginTop="@dimen/dp_2"
android:scaleType="fitCenter"/> android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
app:layout_constraintTop_toTopOf="@+id/gift_l3" />
<ImageView <ImageView
android:layout_width="@dimen/dp_43" android:layout_width="@dimen/dp_43"
android:layout_height="@dimen/dp_43" android:layout_height="@dimen/dp_43"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintTop_toTopOf="@+id/gift_l3"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:scaleType="fitCenter"
android:src="@mipmap/xlh_image" android:src="@mipmap/xlh_image"
android:scaleType="fitCenter"/> app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
app:layout_constraintTop_toTopOf="@+id/gift_l3" />
<TextView <TextView
android:id="@+id/user_name" android:id="@+id/user_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_14" android:layout_height="@dimen/dp_14"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintBottom_toBottomOf="@+id/gift_l3"
android:layout_marginBottom="@dimen/dp_5" android:layout_marginBottom="@dimen/dp_5"
tools:text="请选择礼物"
android:gravity="center" android:gravity="center"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="@dimen/sp_10"/> android:textSize="@dimen/sp_10"
app:layout_constraintBottom_toBottomOf="@+id/gift_l3"
app:layout_constraintEnd_toEndOf="@+id/gift_l3"
app:layout_constraintStart_toStartOf="@+id/gift_l3"
tools:text="请选择礼物" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@@ -281,24 +284,23 @@
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/dp_15"
android:orientation="horizontal" android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/cl_gift"
app:layout_constraintBottom_toTopOf="@+id/exchange_layout" app:layout_constraintBottom_toTopOf="@+id/exchange_layout"
/> app:layout_constraintTop_toBottomOf="@+id/cl_gift" />
<!-- <HorizontalScrollView--> <!-- <HorizontalScrollView-->
<!-- android:id="@+id/horizontalScrollView"--> <!-- android:id="@+id/horizontalScrollView"-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_200"--> <!-- android:layout_height="@dimen/dp_200"-->
<!-- android:scrollbars="none"--> <!-- android:scrollbars="none"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/cl_gift"--> <!-- app:layout_constraintTop_toBottomOf="@+id/cl_gift"-->
<!-- app:layout_constraintBottom_toTopOf="@+id/exchange_layout">--> <!-- app:layout_constraintBottom_toTopOf="@+id/exchange_layout">-->
<!-- <LinearLayout--> <!-- <LinearLayout-->
<!-- android:id="@+id/prizeContainer"--> <!-- android:id="@+id/prizeContainer"-->
<!-- android:layout_width="wrap_content"--> <!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"--> <!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal" />--> <!-- android:orientation="horizontal" />-->
<!-- </HorizontalScrollView>--> <!-- </HorizontalScrollView>-->
<TextView <TextView
@@ -307,41 +309,39 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:textSize="@dimen/sp_10"
android:text="跳过动画" android:text="跳过动画"
android:textColor="#ABABAB" android:textColor="#ABABAB"
app:layout_constraintEnd_toEndOf="parent" android:textSize="@dimen/sp_10"
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
android:visibility="gone" android:visibility="gone"
/> app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/exchange_layout" />
<View <View
android:id="@+id/v_checkbox" android:id="@+id/v_checkbox"
android:layout_width="@dimen/dp_20" android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:background="@drawable/selector_custom_checkbox" android:background="@drawable/selector_custom_checkbox"
android:focusable="false"
android:clickable="true" android:clickable="true"
app:layout_constraintEnd_toStartOf="@+id/tv_option" android:focusable="false"
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
android:visibility="gone" android:visibility="gone"
/> app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
app:layout_constraintEnd_toStartOf="@+id/tv_option"
app:layout_constraintTop_toTopOf="@+id/exchange_layout" />
<LinearLayout <LinearLayout
android:id="@+id/exchange_layout" android:id="@+id/exchange_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28" android:layout_height="@dimen/dp_28"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/bg_r45_2d449f" android:background="@drawable/bg_r45_2d449f"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginBottom="@dimen/dp_20"
android:paddingStart="@dimen/dp_9" android:paddingStart="@dimen/dp_9"
android:paddingEnd="@dimen/dp_9" android:paddingEnd="@dimen/dp_9"
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintEnd_toEndOf="@+id/lottery_buttons_layout" app:layout_constraintEnd_toEndOf="@+id/lottery_buttons_layout"
app:layout_constraintStart_toStartOf="@+id/lottery_buttons_layout" app:layout_constraintStart_toStartOf="@+id/lottery_buttons_layout">
>
<TextView <TextView
android:id="@+id/tv_icon" android:id="@+id/tv_icon"
@@ -349,9 +349,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:drawablePadding="@dimen/dp_5" android:drawablePadding="@dimen/dp_5"
tools:text="66666"
android:textColor="#F8E837" android:textColor="#F8E837"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10"
tools:text="66666" />
<TextView <TextView
android:id="@+id/tv_dh" android:id="@+id/tv_dh"
@@ -364,7 +364,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/lottery_buttons_layout" android:id="@+id/lottery_buttons_layout"
android:layout_width="0dp" android:layout_width="0dp"
@@ -401,8 +400,8 @@
android:layout_marginBottom="@dimen/dp_5" android:layout_marginBottom="@dimen/dp_5"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
tools:text="10币一次" android:textSize="@dimen/sp_10"
android:textSize="@dimen/sp_10" /> tools:text="10币一次" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -432,8 +431,8 @@
android:layout_marginBottom="@dimen/dp_5" android:layout_marginBottom="@dimen/dp_5"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
tools:text="100币一次" android:textSize="@dimen/sp_10"
android:textSize="@dimen/sp_10" /> tools:text="100币一次" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -461,8 +460,8 @@
android:layout_marginBottom="@dimen/dp_5" android:layout_marginBottom="@dimen/dp_5"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
tools:text="1000币一次" android:textSize="@dimen/sp_10"
android:textSize="@dimen/sp_10" /> tools:text="1000币一次" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -35,4 +35,28 @@
<attr name="decorationOffsetX" format="integer" /> <attr name="decorationOffsetX" format="integer" />
<attr name="decorationOffsetY" format="integer" /> <attr name="decorationOffsetY" format="integer" />
</declare-styleable> </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> </resources>

View File

@@ -574,23 +574,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
// 如需后台使用GPS添加此权限Android 10+ // 如需后台使用GPS添加此权限Android 10+
Manifest.permission.ACCESS_BACKGROUND_LOCATION Manifest.permission.ACCESS_BACKGROUND_LOCATION
).explainReasonBeforeRequest() )
.onExplainRequestReason(new ExplainReasonCallback() {
@Override
public void onExplainReason(ExplainScope scope, List<String> deniedList) {
String message = "需要GPS权限以获取您的精确位置用于导航/定位功能";
// 若包含后台权限,补充说明
scope.showRequestReasonDialog(deniedList, message, "确定", "取消");
}
})
// 权限被永久拒绝时,引导至设置页面
.onForwardToSettings(new ForwardToSettingsCallback() {
@Override
public void onForwardToSettings(ForwardScope scope, List<String> deniedList) {
scope.showForwardToSettingsDialog(deniedList, "GPS权限被拒绝无法使用定位功能请去设置开启", "去设置", "取消");
}
})
// 权限请求结果回调 // 权限请求结果回调
.request(new RequestCallback() { .request(new RequestCallback() {
@Override @Override

View File

@@ -1,258 +0,0 @@
//package com.example.moduleroom.view;
//import android.content.Context;
//import android.graphics.drawable.Drawable;
//import android.util.AttributeSet;
//import android.view.View;
//import android.view.animation.Animation;
//import android.view.animation.RotateAnimation;
//import android.widget.Button;
//import android.widget.ImageView;
//import android.widget.LinearLayout;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import androidx.annotation.Nullable;
//
//import com.example.moduleroom.R;
//
//public class QXMeetGiftView extends RelativeLayout {
//
// private TextView giftNameLabel;
// private ImageView giftPriceBgView;
// private Button giftCoin;
// private ImageView bgImageView;
// private ImageView giftBgImageView;
// private ImageView giftImageView;
//
// private boolean isLockGift;
// private Object model; // 这里用 Object 代替 QXDrawGiftModel
//
// public QXMeetGiftView(Context context) {
// super(context);
// initSubviews(context);
// }
//
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
// super(context, attrs);
// initSubviews(context);
// }
//
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
// super(context, attrs, defStyleAttr);
// initSubviews(context);
// }
//
// private void initSubviews(Context context) {
// // 创建背景图片视图
// bgImageView = new ImageView(context);
// bgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
// bgImageView.setImageResource(R.drawable.ac_left_gift_bg);
// LayoutParams bgParams = new LayoutParams(
// LayoutParams.MATCH_PARENT,
// LayoutParams.MATCH_PARENT
// );
// bgParams.addRule(ALIGN_PARENT_TOP);
// bgParams.addRule(ALIGN_PARENT_LEFT);
// bgParams.addRule(ALIGN_PARENT_RIGHT);
// bgParams.bottomMargin = dpToPx(19); // 底部偏移-19
// addView(bgImageView, bgParams);
//
// // 创建礼物背景光效视图
// giftBgImageView = new ImageView(context);
// giftBgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
// giftBgImageView.setImageResource(R.drawable.ac_lock_gift_light_bg);
// giftBgImageView.setVisibility(View.GONE); // 初始隐藏
// LayoutParams giftBgParams = new LayoutParams(
// LayoutParams.MATCH_PARENT,
// LayoutParams.MATCH_PARENT
// );
// giftBgParams.addRule(ALIGN_PARENT_TOP);
// giftBgParams.addRule(ALIGN_PARENT_LEFT);
// giftBgParams.addRule(ALIGN_PARENT_RIGHT);
// giftBgParams.bottomMargin = dpToPx(19);
// addView(giftBgImageView, giftBgParams);
//
// // 创建礼物图片视图
// giftImageView = new ImageView(context);
// giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
// LayoutParams giftImageParams = new LayoutParams(
// LayoutParams.MATCH_PARENT,
// LayoutParams.WRAP_CONTENT
// );
// giftImageParams.addRule(CENTER_IN_PARENT);
// giftImageParams.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
// addView(giftImageView, giftImageParams);
//
// // 创建价格背景视图
// giftPriceBgView = new ImageView(context);
// giftPriceBgView.setImageResource(R.drawable.ac_meet_gift_name_bg);
// LayoutParams priceBgParams = new LayoutParams(
// LayoutParams.MATCH_PARENT,
// dpToPx(15)
// );
// priceBgParams.addRule(ALIGN_PARENT_BOTTOM);
// priceBgParams.bottomMargin = dpToPx(15); // 在名称标签上方
// addView(giftPriceBgView, priceBgParams);
//
// // 创建金币按钮
// giftCoin = new Button(context);
// giftCoin.setTextColor(0xFFC7BF62);
// // 设置按钮图标
// Drawable coinDrawable = getResources().getDrawable(R.drawable.sky_item_coin);
// coinDrawable.setBounds(0, 0, dpToPx(12), dpToPx(12));
// giftCoin.setCompoundDrawables(coinDrawable, null, null, null);
// giftCoin.setTextSize(10);
// giftCoin.setBackgroundColor(0x00000000); // 透明背景
// LayoutParams coinParams = new LayoutParams(
// LayoutParams.WRAP_CONTENT,
// LayoutParams.WRAP_CONTENT
// );
// coinParams.addRule(CENTER_IN_PARENT, TRUE);
// addView(giftCoin, coinParams);
//
// // 创建礼物名称标签
// giftNameLabel = new TextView(context);
// giftNameLabel.setTextColor(0xFFFFFFFF);
// giftNameLabel.setTextSize(12);
// giftNameLabel.setGravity(android.view.Gravity.CENTER);
// LayoutParams nameParams = new LayoutParams(
// LayoutParams.MATCH_PARENT,
// dpToPx(15)
// );
// nameParams.addRule(ALIGN_PARENT_BOTTOM);
// addView(giftNameLabel, nameParams);
//
// // 调整视图层级
// bringChildToFront(giftPriceBgView);
// bringChildToFront(giftCoin);
// }
//
// public void setIsLockGift(boolean isLockGift) {
// this.isLockGift = isLockGift;
//
// // 设置背景图片
// int bgResource = isLockGift ?
// R.drawable.ac_lock_gift_bg : R.drawable.ac_meet_gift_name_bg;
// bgImageView.setImageResource(bgResource);
//
// // 显示/隐藏光效背景
// giftBgImageView.setVisibility(isLockGift ? View.VISIBLE : View.GONE);
//
// if (isLockGift) {
// // 重新设置礼物图片的约束
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
// params.width = scaleWidth(62);
// params.height = scaleWidth(62);
// params.addRule(CENTER_IN_PARENT);
// params.setMargins(0, 0, 0, 0);
// giftImageView.setLayoutParams(params);
// } else {
// // 恢复原始约束
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
// params.width = LayoutParams.MATCH_PARENT;
// params.height = LayoutParams.WRAP_CONTENT;
// params.addRule(CENTER_IN_PARENT);
// params.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
// giftImageView.setLayoutParams(params);
// }
// }
//
// public void setModel(Object model) {
// this.model = model;
// // 这里需要根据您的 QXDrawGiftModel 类来实现具体逻辑
// /*
// if (model instanceof QXDrawGiftModel) {
// QXDrawGiftModel giftModel = (QXDrawGiftModel) model;
//
// // 使用图片加载库加载图片
// // Glide.with(getContext()).load(giftModel.getBaseImage()).into(giftImageView);
//
// giftNameLabel.setText(giftModel.getGiftName());
// giftCoin.setText(giftModel.getGiftPrice());
// }
// */
// }
//
// public void startAnimation() {
// // 礼物图片顺时针旋转动画
// RotateAnimation rotateAnimation = new RotateAnimation(
// 0, 360, // 从 0 度旋转到 360 度
// Animation.RELATIVE_TO_SELF, 0.5f,
// Animation.RELATIVE_TO_SELF, 0.5f
// );
// rotateAnimation.setDuration(3000); // 3 秒
// rotateAnimation.setRepeatCount(Animation.INFINITE);
// rotateAnimation.setRepeatMode(Animation.RESTART);
// rotateAnimation.setInterpolator(getContext(), android.R.anim.linear_interpolator);
// giftImageView.startAnimation(rotateAnimation);
//
// // 光效背景逆时针旋转动画
// RotateAnimation rotateAnimation1 = new RotateAnimation(
// 0, -360, // 从 0 度旋转到 -360 度
// Animation.RELATIVE_TO_SELF, 0.5f,
// Animation.RELATIVE_TO_SELF, 0.5f
// );
// rotateAnimation1.setDuration(3000); // 3 秒
// rotateAnimation1.setRepeatCount(Animation.INFINITE);
// rotateAnimation1.setRepeatMode(Animation.RESTART);
// rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
// giftBgImageView.startAnimation(rotateAnimation1);
// }
//
// public void resetAnimation() {
// giftImageView.clearAnimation();
// giftBgImageView.clearAnimation();
// }
//
// public void stopAnimation() {
// giftImageView.clearAnimation();
// giftBgImageView.clearAnimation();
// }
//
// // 辅助方法dp 转 px
// private int dpToPx(int dp) {
// float density = getResources().getDisplayMetrics().density;
// return Math.round(dp * density);
// }
//
// // 缩放宽度方法(对应 ScaleWidth
// private int scaleWidth(int value) {
// // 这里需要根据您的缩放逻辑实现
// // 通常可以根据屏幕密度进行缩放
// float scale = getResources().getDisplayMetrics().density;
// return (int) (value * scale);
// }
//
// // Getter 方法
// public TextView getGiftNameLabel() {
// return giftNameLabel;
// }
//
// public ImageView getGiftPriceBgView() {
// return giftPriceBgView;
// }
//
// public Button getGiftCoin() {
// return giftCoin;
// }
//
// public ImageView getBgImageView() {
// return bgImageView;
// }
//
// public ImageView getGiftBgImageView() {
// return giftBgImageView;
// }
//
// public ImageView getGiftImageView() {
// return giftImageView;
// }
//
// public boolean isLockGift() {
// return isLockGift;
// }
//
// public Object getModel() {
// return model;
// }
//}

View File

@@ -483,6 +483,9 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible" /> tools:visibility="visible" />
<!--https://tmd.xscmmidi.site/data/avatar/head_pic.png--> <!--https://tmd.xscmmidi.site/data/avatar/head_pic.png-->
<com.xscm.moduleutil.widget.DropViewRoom <com.xscm.moduleutil.widget.DropViewRoom
android:id="@+id/xlh_rk" android:id="@+id/xlh_rk"
android:layout_width="wrap_content" android:layout_width="wrap_content"