1:修改所有的充值自定义金额

2:修改小时榜滑动出现的图片复用问题
This commit is contained in:
2025-10-01 00:35:49 +08:00
parent 47ce1c9462
commit aae94d15e0
19 changed files with 391 additions and 272 deletions

View File

@@ -761,7 +761,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
// 发送广播通知所有Activity刷新状态
Intent refreshIntent = new Intent("com.xscm.moduleutil.ACTION_USER_LOGOUT");
sendBroadcast(refreshIntent);
Intent intent = new Intent("com.xscm.action.LAUNCH_PAGE");
Intent intent = new Intent("com.xscm.midi.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
}

View File

@@ -126,7 +126,7 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
if (type!=null){
mBinding.r4.setVisibility(View.GONE);
}else{
mBinding.r4.setVisibility(View.VISIBLE);
mBinding.r4.setVisibility(View.GONE);
}
}
@@ -137,11 +137,11 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
@Override
public void setRechargeData(List<RechargeBean> rechargeData) {
RechargeBean customItem = new RechargeBean();
customItem.setCoins("自定义");
customItem.setMoney("");
customItem.setItemViewType(1);
rechargeData.add(customItem);
// RechargeBean customItem = new RechargeBean();
// customItem.setCoins("自定义");
// customItem.setMoney("");
// customItem.setItemViewType(1);
// rechargeData.add(customItem);
rechargeAdapter = new BalanceRechargeAdapter(rechargeData);
rechargeAdapter.setNewData(rechargeData);
rechargeAdapter.setListener(new BalanceRechargeAdapter.OnRechargeItemClickListener() {

View File

@@ -51,11 +51,11 @@ public class EnvironmentPrefs {
// }
// 默认使用生产环境
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.TEST.name());
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.PRODUCTION.name());
try {
return EnvironmentEnum.valueOf(envName);
} catch (IllegalArgumentException e) {
return EnvironmentEnum.TEST; // 出错时默认返回生产环境
return EnvironmentEnum.PRODUCTION; // 出错时默认返回生产环境
}
}
}

View File

@@ -24,6 +24,7 @@ public class DropHourlView extends LinearLayout {
private int rightMargin = 0;
private float lastX, lastY;
private int screenWidth;
private int screenHeight; // 添加屏幕高度变量
public DropHourlView(Context context) {
super(context);
@@ -42,6 +43,9 @@ public class DropHourlView extends LinearLayout {
void init() {
// 初始化屏幕尺寸
screenWidth = ScreenUtils.getScreenWidth();
screenHeight = ScreenUtils.getScreenHeight();
post(new Runnable() {
@Override
@@ -51,6 +55,8 @@ public class DropHourlView extends LinearLayout {
int sw = ScreenUtils.getScreenWidth()-200;
// setBackgroundResource(R.drawable.bg_home_drop_view);
int y = (int) (0.5f * sh) - getHeight();
// 确保Y坐标不会超出屏幕范围
y = Math.max(0, Math.min(y, sh - getHeight()));
int x = sw - getWidth();
setTranslationX(x);
setTranslationY(y);
@@ -64,19 +70,25 @@ public class DropHourlView extends LinearLayout {
float X2;
float Y1;
float Y2;
// 记录视图初始位置
private float originalX;
private float originalY;
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (starDrap) return true;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
X1 = event.getX();
Y1 = event.getY();
X1 = event.getRawX();
Y1 = event.getRawY();
// 记录视图当前位置
originalX = getTranslationX();
originalY = getTranslationY();
break;
case MotionEvent.ACTION_MOVE:
X2 = event.getX();//当手指抬起时再次获取屏幕位置的X值
Y2 = event.getY();//同理
X2 = event.getRawX();
Y2 = event.getRawY();
Action(X1, X2, Y1, Y2);
break;
@@ -111,17 +123,35 @@ public class DropHourlView extends LinearLayout {
case MotionEvent.ACTION_MOVE:
// setBackgroundResource(R.drawable.bg_home_drop_view);
setTranslationX(getX() + (event.getX() - X1));
setTranslationY(getY() + (event.getY() - Y1));
X2 = event.getX();
// 使用屏幕绝对坐标计算新位置
float newX = originalX + (event.getRawX() - X1);
float newY = originalY + (event.getRawY() - Y1);
// 限制X和Y坐标在屏幕范围内
newX = Math.max(0, Math.min(newX, screenWidth - getWidth()));
newY = Math.max(0, Math.min(newY, screenHeight - getHeight()));
setTranslationX(newX);
setTranslationY(newY);
X2 = event.getRawX();
break;
case MotionEvent.ACTION_UP:
starDrap = false;
int sw = ScreenUtils.getScreenWidth();
Log.i(TAG, "onTouchEvent: " + sw + "," + X2);
boolean isR = getTranslationX() + getWidth() / 2 >= sw / 2;//贴边方向
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", isR ? sw - getWidth()+10 : 0f).setDuration(200);
anim.start();
// 获取当前Y坐标
float currentY = getTranslationY();
// 创建X轴和Y轴的动画
ObjectAnimator animX = ObjectAnimator.ofFloat(this, "translationX", isR ? sw - getWidth() : 0f).setDuration(200);
// Y轴保持当前位置但确保在屏幕范围内
currentY = Math.max(0, Math.min(currentY, screenHeight - getHeight()));
ObjectAnimator animY = ObjectAnimator.ofFloat(this, "translationY", currentY).setDuration(200);
animX.start();
animY.start();
break;
@@ -186,4 +216,4 @@ public class DropHourlView extends LinearLayout {
}
}
}

View File

@@ -1,221 +1,223 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".dialog.RechargeDialogFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".dialog.RechargeDialogFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_r16_fff">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_r16_fff">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_num"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_24"
android:layout_margin="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_27"
android:gravity="center"
android:text="充值"
android:textColor="@color/color_FF333333"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintTop_toBottomOf="@id/tv_num" />
<RelativeLayout
android:id="@+id/r_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintBottom_toTopOf="@+id/v_view"
app:layout_constraintTop_toBottomOf="@+id/rv_comment">
<TextView
android:id="@+id/t_4"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_27"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_16"
android:gravity="center"
android:text="¥"
android:textColor="@color/color_FF000000"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_custom_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/t_4"
android:background="@null"
android:hint="请输入充值金额(300-50000元)"
android:inputType="numberDecimal"
android:textColorHint="@color/color_FF999999"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/t_5"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_27"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginStart="@dimen/dp_4"
android:gravity="center"
android:text="将获得0金币"
android:textStyle="bold"
android:visibility="gone"/>
</RelativeLayout>
<View
android:id="@+id/v_view"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/color_FF999999"
app:layout_constraintTop_toBottomOf="@id/r_4" />
<TextView
android:id="@+id/t_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
android:text="@string/payment_method"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
app:layout_constraintTop_toBottomOf="@id/v_view" />
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_weixin_pay"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/dp_16"-->
<!-- android:layout_marginTop="@dimen/dp_10"-->
<!-- android:layout_marginEnd="@dimen/dp_16"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/t_2">-->
<!-- <ImageView-->
<!-- android:id="@+id/im_wx"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/wx_zf" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:layout_toRightOf="@+id/im_wx"-->
<!-- android:text="@string/wechat_payment"-->
<!-- android:textColor="@color/color_FF333333"-->
<!-- android:textSize="@dimen/sp_14" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_weixin"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_2"-->
<!-- android:src="@drawable/level_pay" />-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_three_pay"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/dp_16"-->
<!-- android:layout_marginTop="@dimen/dp_12"-->
<!-- android:layout_marginEnd="@dimen/dp_16"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/rl_weixin_pay">-->
<!-- <ImageView-->
<!-- android:id="@+id/im_zfb"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/sign_icon_zfb" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:layout_toRightOf="@+id/im_zfb"-->
<!-- android:text="@string/alipay_payment"-->
<!-- android:textColor="@color/color_FF333333"-->
<!-- android:textSize="@dimen/sp_14" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_three_pay"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_2"-->
<!-- android:src="@drawable/level_pay" />-->
<!-- </RelativeLayout>-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent">
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintTop_toBottomOf="@+id/t_2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_payment"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_38"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/cs"
android:gravity="center"
android:text="确认支付"
android:textColor="@color/color_FF333333"
app:layout_constraintTop_toBottomOf="@+id/rl_three_pay"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="parent"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_num"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_24"
android:layout_margin="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_27"
android:gravity="center"
android:text="充值"
android:textColor="@color/color_FF333333"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textSize="@dimen/sp_16"
android:textStyle="bold"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintTop_toBottomOf="@id/tv_num"/>
<RelativeLayout
android:id="@+id/r_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintBottom_toTopOf="@+id/v_view"
app:layout_constraintTop_toBottomOf="@+id/rv_comment"
android:visibility="gone">
<TextView
android:id="@+id/t_4"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_27"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_16"
android:gravity="center"
android:text="¥"
android:textColor="@color/color_FF000000"
android:textSize="@dimen/sp_18"
android:textStyle="bold"/>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_custom_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/t_4"
android:background="@null"
android:hint="请输入充值金额(300-50000元)"
android:inputType="numberDecimal"
android:textColorHint="@color/color_FF999999"
android:textSize="@dimen/sp_12"/>
<TextView
android:id="@+id/t_5"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_27"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginStart="@dimen/dp_4"
android:gravity="center"
android:text="将获得0金币"
android:textStyle="bold"
android:visibility="gone"/>
</RelativeLayout>
<View
android:id="@+id/v_view"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
android:background="@color/color_FF999999"
app:layout_constraintTop_toBottomOf="@id/r_4"/>
<TextView
android:id="@+id/t_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
android:text="@string/payment_method"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
app:layout_constraintTop_toBottomOf="@id/v_view"/>
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_weixin_pay"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/dp_16"-->
<!-- android:layout_marginTop="@dimen/dp_10"-->
<!-- android:layout_marginEnd="@dimen/dp_16"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/t_2">-->
<!-- <ImageView-->
<!-- android:id="@+id/im_wx"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/wx_zf" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:layout_toRightOf="@+id/im_wx"-->
<!-- android:text="@string/wechat_payment"-->
<!-- android:textColor="@color/color_FF333333"-->
<!-- android:textSize="@dimen/sp_14" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_weixin"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_2"-->
<!-- android:src="@drawable/level_pay" />-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_three_pay"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/dp_16"-->
<!-- android:layout_marginTop="@dimen/dp_12"-->
<!-- android:layout_marginEnd="@dimen/dp_16"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/rl_weixin_pay">-->
<!-- <ImageView-->
<!-- android:id="@+id/im_zfb"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/sign_icon_zfb" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:layout_toRightOf="@+id/im_zfb"-->
<!-- android:text="@string/alipay_payment"-->
<!-- android:textColor="@color/color_FF333333"-->
<!-- android:textSize="@dimen/sp_14" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_three_pay"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_2"-->
<!-- android:src="@drawable/level_pay" />-->
<!-- </RelativeLayout>-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintTop_toBottomOf="@+id/t_2"/>
<TextView
android:id="@+id/tv_payment"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_38"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/cs"
android:gravity="center"
android:text="确认支付"
android:textColor="@color/color_FF333333"
app:layout_constraintTop_toBottomOf="@+id/rl_three_pay"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="parent"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_90">
android:layout_height="@dimen/dp_90"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/im_h_t"
@@ -22,7 +23,7 @@
android:layout_marginEnd="@dimen/dp_2"
android:ellipsize="start"
android:maxLines="1"
android:text="礼品"
tools:text="礼品"
android:textColor="#FFDE77"
android:textSize="@dimen/sp_12"
android:textStyle="bold"