|
@@ -5,17 +5,20 @@ import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
|
import android.content.SharedPreferences
|
|
|
import android.os.Bundle
|
|
|
+import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
+import android.view.animation.Animation
|
|
|
+import android.view.animation.LinearInterpolator
|
|
|
+import android.view.animation.RotateAnimation
|
|
|
+import android.view.animation.ScaleAnimation
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
+import jx.cn.escort.R
|
|
|
import jx.cn.escort.databinding.ActivityLoginBinding
|
|
|
import jx.cn.escort.extension.ExtensionBinding.Companion.binding
|
|
|
import jx.cn.escort.utils.ActivityUtils
|
|
|
-import jx.cn.escort.utils.ActivityUtils.Companion.startActivity
|
|
|
import kotlinx.coroutines.delay
|
|
|
import kotlinx.coroutines.launch
|
|
|
-
|
|
|
-
|
|
|
import org.koin.core.component.KoinComponent
|
|
|
import org.koin.core.component.inject
|
|
|
|
|
@@ -33,13 +36,27 @@ class LoginActivity : AppCompatActivity(), KoinComponent {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
setContentView(mBinding.root)
|
|
|
- mBinding.btnLogin
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
mBinding.btnLoginAction.setOnClickListener {
|
|
|
lifecycleScope.launch {
|
|
|
- mBinding.loginTitle.text = "正在登陆中......"
|
|
|
+ mBinding.loginTitle.text = "加载中..."
|
|
|
+ var density=resources.displayMetrics.density
|
|
|
+ var drawable=resources.getDrawableForDensity(R.drawable.ic_login_loding,65*density.hashCode(),null)
|
|
|
+
|
|
|
+ mBinding.btnLoginAction.icon=drawable
|
|
|
+
|
|
|
+ val rotateAnimation=RotateAnimation(0f,360f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f)
|
|
|
+ rotateAnimation.setRepeatCount(Animation.INFINITE);
|
|
|
+ rotateAnimation.duration=1000L
|
|
|
+ rotateAnimation.fillAfter=true
|
|
|
+ mBinding.btnLoginAction.startAnimation(rotateAnimation)
|
|
|
+
|
|
|
delay(5000L)
|
|
|
defaultSharedPreferences.edit().putString("isAuth", "是").apply()
|
|
|
ActivityUtils.startActivity(this@LoginActivity,MainActivity::class.java)
|