From 8559ac16c1b3581a88a5693df5c857cb6532e720 Mon Sep 17 00:00:00 2001 From: renhaoting <370797079@qq.com> Date: Fri, 26 Dec 2025 15:42:25 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=20-=20=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E7=9A=84=E6=89=8B=E6=8C=87=E9=9C=80=E8=A6=81=E5=8A=A0=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=EF=BC=88=E9=A1=BA=E7=9D=80=E6=8C=87=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E5=90=91=E5=89=8D=E5=90=8E=E7=A7=BB=E5=8A=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gamedog/vididin/widget/AnimImageView.kt | 63 +++++++++++++++++++ app/src/main/res/layout/guide_step_cash.xml | 5 +- app/src/main/res/layout/guide_step_gold.xml | 5 +- .../main/res/layout/guide_step_withdraw.xml | 2 +- .../main/res/layout/guide_step_zerobuy.xml | 7 +-- .../main/res/layout/layout_anim_imageview.xml | 18 ++++++ 6 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 app/src/main/java/com/gamedog/vididin/widget/AnimImageView.kt create mode 100644 app/src/main/res/layout/layout_anim_imageview.xml diff --git a/app/src/main/java/com/gamedog/vididin/widget/AnimImageView.kt b/app/src/main/java/com/gamedog/vididin/widget/AnimImageView.kt new file mode 100644 index 0000000..fd9e58e --- /dev/null +++ b/app/src/main/java/com/gamedog/vididin/widget/AnimImageView.kt @@ -0,0 +1,63 @@ +package com.gamedog.vididin.widget + + +import android.animation.AnimatorSet +import android.animation.ObjectAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.animation.AnimationSet +import android.widget.LinearLayout +import com.ama.core.architecture.util.ResUtil.dp +import com.vididin.real.money.game.databinding.LayoutAnimImageviewBinding +import kotlin.math.min + + +class AnimImageView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : LinearLayout(context, attrs, defStyleAttr) { + private var mBinding: LayoutAnimImageviewBinding + private val animationFraction = 0.2f + private var animatorSet: AnimatorSet = AnimatorSet() + + init { + mBinding = LayoutAnimImageviewBinding.inflate(LayoutInflater.from(context), this, true) + startAnim() + } + + + + private fun startAnim() { + with(mBinding) { + // 1. move distance + /*val moveDistanceX = -min(ivImage.width, ivImage.height) * animationFraction + val moveDistanceY = -min(ivImage.width, ivImage.height) * animationFraction*/ + val moveDistanceX = -20.dp + val moveDistanceY = -20.dp + + // 2. x and y + val animatorX = ObjectAnimator.ofFloat(ivImage, "translationX", 0f, moveDistanceX.toFloat()) + val animatorY = ObjectAnimator.ofFloat(ivImage, "translationY", 0f, moveDistanceY.toFloat()) + animatorX.repeatMode = ObjectAnimator.REVERSE + animatorX.repeatCount = ObjectAnimator.INFINITE + animatorY.repeatMode = ObjectAnimator.REVERSE + animatorY.repeatCount = ObjectAnimator.INFINITE + + // 3. set + animatorSet.playTogether(animatorX, animatorY) + animatorSet.duration = 600 + + animatorSet.start() + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + animatorSet.cancel() + } + +} + + diff --git a/app/src/main/res/layout/guide_step_cash.xml b/app/src/main/res/layout/guide_step_cash.xml index 57b12e1..2289a38 100644 --- a/app/src/main/res/layout/guide_step_cash.xml +++ b/app/src/main/res/layout/guide_step_cash.xml @@ -1,9 +1,10 @@ + android:layout_height="wrap_content" + android:clipChildren="false"> - + android:layout_height="wrap_content" + android:clipChildren="false"> - - - + android:layout_gravity="right" + android:layout_marginStart="100dp" /> + + + + + \ No newline at end of file