android 信息验证动画效果

发布于:2025-07-19 ⋅ 阅读:(12) ⋅ 点赞:(0)

在这里插入图片描述
layout_check_pro

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/line"
        android:layout_width="@dimen/dp_2"
        android:layout_height="@dimen/dp_20"
        android:layout_marginStart="@dimen/dp_9"
        android:background="#D3D3D3" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/iv_pro"
            android:layout_width="@dimen/dp_20"
            android:layout_height="@dimen/dp_20"
            android:src="@mipmap/icon_proc" />

        <TextView
            android:id="@+id/tv_pro"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp_16"
            android:text="大额提现3000元税款缴纳成功"
            android:textColor="@color/_333333"
            android:textSize="@dimen/sp_14"
            android:textStyle="bold" />
    </LinearLayout>
</LinearLayout>

dialog_act_info_verify

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <ImageView
        android:id="@+id/iv_bg"
        android:layout_width="@dimen/dp_280"
        android:layout_height="@dimen/dp_350"
        android:background="@mipmap/bg_info_verify"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <LinearLayout
        android:layout_width="@dimen/dp_244"
        android:layout_height="@dimen/dp_228"
        android:layout_marginBottom="@dimen/dp_18"
        android:gravity="center_horizontal"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="@id/iv_bg"
        app:layout_constraintEnd_toEndOf="@id/iv_bg"
        app:layout_constraintStart_toStartOf="@id/iv_bg">

        <LinearLayout
            android:layout_width="@dimen/dp_244"
            android:layout_height="@dimen/dp_228"
            android:layout_marginTop="@dimen/dp_20"
            android:orientation="vertical"
            android:paddingStart="@dimen/dp_22">

            <include
                android:id="@+id/ll_pro1"
                layout="@layout/layout_check_pro" />

            <include
                android:id="@+id/ll_pro2"
                layout="@layout/layout_check_pro" />

            <include
                android:id="@+id/ll_pro3"
                layout="@layout/layout_check_pro" />

            <include
                android:id="@+id/ll_pro4"
                layout="@layout/layout_check_pro" />

            <include
                android:id="@+id/ll_pro5"
                layout="@layout/layout_check_pro" />
        </LinearLayout>

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
package com.zhe.song.wo.will.zgwh.dialog

import android.content.Context
import android.view.LayoutInflater
import androidx.core.graphics.toColorInt
import com.zhe.song.wo.will.zgwh.R
import com.zhe.song.wo.will.zgwh.constans.DialogCon
import com.zhe.song.wo.will.zgwh.databinding.DialogActInfoVerifyBinding
import com.zhe.song.wo.will.zgwh.databinding.LayoutCheckProBinding
import com.zhe.song.wo.will.zgwh.spf.SPFUserInfo
import com.zhe.song.wo.will.zgwh.utils.animationRotate
import com.zhe.song.wo.will.zgwh.utils.gone
import com.zhe.song.wo.will.zgwh.utils.hide
import com.zhe.song.wo.will.zgwh.utils.show
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

/**
 * 个人信息验证表格
 * @author zph
 * @date 2025/07/15
 * @constructor 创建DialogActInfoVerify
 * @param context 语境
 */
class DialogActInfoVerify(context: Context) : DialogBase<DialogActInfoVerifyBinding>(context) {


    override fun postDismiss() {
        iDialogActionListener?.onDialogActionListener(DialogCon.DIALOG_信息验证)
    }

    /**
     * 后续连续登录X天,且(6-x)*10关;提现条件为5-X天,且每天过(6-x)*10关;
     * 直到条件为:在登录0天,且过60关,即可进入第七个档位
     */
    override fun postShow() {
        SPFUserInfo.withDrawalState = true
        var day = SPFUserInfo.needLoginDay
        if (day <= 0) {
            day = 0
            SPFUserInfo.wxBannerLevel8 = 1
        }
        val needLevel = 60 - (day * 10)
        if (SPFUserInfo.needGameLevel == 0) {
            SPFUserInfo.needGameLevel = SPFUserInfo.gameLevel + needLevel
        }
        val finishLevel = SPFUserInfo.needGameLevel - SPFUserInfo.gameLevel
        viewBinding.llPro1.line.gone()
        viewBinding.llPro1.parent.hide()
        viewBinding.llPro2.parent.hide()
        viewBinding.llPro3.parent.hide()
        viewBinding.llPro4.parent.hide()
        viewBinding.llPro5.parent.hide()
        coroutineScope.launch {
            loadLayout(
                viewBinding.llPro1, "登陆验证中..."
            )
            delay(1500)
            loadLayoutSucccess(
                viewBinding.llPro1, "需要再登录(${6 - day}/6)天"
            )
            loadLayout(
                viewBinding.llPro2, "网络环境验证中..."
            )
            delay(1500)
            loadLayoutSucccess(
                viewBinding.llPro2, "网络环境安全验证通过"
            )
            loadLayout(
                viewBinding.llPro3, "游戏行为验证中..."
            )
            delay(1500)
            loadLayoutSucccess(
                viewBinding.llPro3, "游戏外挂行为验证通过"
            )
            loadLayout(
                viewBinding.llPro4, "小助手解锁验证中..."
            )
            delay(1500)
            loadLayoutSucccess(
                viewBinding.llPro4, "小助手解锁数量(${SPFUserInfo.assistantId})"
            )
            loadLayout(
                viewBinding.llPro5, "闯关关卡验证中..."
            )
            delay(1500)
            if (day == 0) {
                loadLayoutError(
                    viewBinding.llPro5, "今日需要通过最后一关"
                )
            } else {
                if (finishLevel <= 0) {
                    loadLayoutSucccess(
                        viewBinding.llPro5, "今日闯关已完成"
                    )
                } else {
                    loadLayoutError(
                        viewBinding.llPro5, "今日需要通过${needLevel - finishLevel}/${needLevel}关"
                    )
                }

            }

            delay(3000)
            dismiss()
        }
    }

    fun loadLayout(llPro: LayoutCheckProBinding, str: String) {
        llPro.parent.show()
        llPro.line.setBackgroundColor("#D3D3D3".toColorInt())
        llPro.ivPro.setImageResource(R.mipmap.icon_proc)
        llPro.ivPro.animationRotate()
        llPro.tvPro.setTextColor("#999999".toColorInt())
        llPro.tvPro.text = str
    }

    fun loadLayoutSucccess(llPro: LayoutCheckProBinding, str: String) {
        llPro.line.setBackgroundColor("#20C403".toColorInt())
        llPro.ivPro.clearAnimation()
        llPro.ivPro.setImageResource(R.mipmap.icon_suc)
        llPro.tvPro.setTextColor("#333333".toColorInt())
        llPro.tvPro.text = str
    }

    fun loadLayoutError(llPro: LayoutCheckProBinding, str: String) {
        llPro.line.setBackgroundColor("#FF0000".toColorInt())
        llPro.ivPro.clearAnimation()
        llPro.ivPro.setImageResource(R.mipmap.icon_error)
        llPro.tvPro.setTextColor("#FF0000".toColorInt())
        llPro.tvPro.text = str
    }

    override fun createViewBinding(): DialogActInfoVerifyBinding {
        return DialogActInfoVerifyBinding.inflate(LayoutInflater.from(context))
    }


}

网站公告

今日签到

点亮在社区的每一天
去签到