|
@@ -5,17 +5,20 @@ import android.annotation.SuppressLint
|
|
import android.content.Context
|
|
import android.content.Context
|
|
import android.content.SharedPreferences
|
|
import android.content.SharedPreferences
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
|
|
+import android.view.MotionEvent
|
|
import android.view.View
|
|
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.appcompat.app.AppCompatActivity
|
|
import androidx.lifecycle.lifecycleScope
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
|
+import jx.cn.escort.R
|
|
import jx.cn.escort.databinding.ActivityLoginBinding
|
|
import jx.cn.escort.databinding.ActivityLoginBinding
|
|
import jx.cn.escort.extension.ExtensionBinding.Companion.binding
|
|
import jx.cn.escort.extension.ExtensionBinding.Companion.binding
|
|
import jx.cn.escort.utils.ActivityUtils
|
|
import jx.cn.escort.utils.ActivityUtils
|
|
-import jx.cn.escort.utils.ActivityUtils.Companion.startActivity
|
|
|
|
import kotlinx.coroutines.delay
|
|
import kotlinx.coroutines.delay
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
-
|
|
|
|
-
|
|
|
|
import org.koin.core.component.KoinComponent
|
|
import org.koin.core.component.KoinComponent
|
|
import org.koin.core.component.inject
|
|
import org.koin.core.component.inject
|
|
|
|
|
|
@@ -33,13 +36,27 @@ class LoginActivity : AppCompatActivity(), KoinComponent {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
super.onCreate(savedInstanceState)
|
|
setContentView(mBinding.root)
|
|
setContentView(mBinding.root)
|
|
- mBinding.btnLogin
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
mBinding.btnLoginAction.setOnClickListener {
|
|
mBinding.btnLoginAction.setOnClickListener {
|
|
lifecycleScope.launch {
|
|
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)
|
|
delay(5000L)
|
|
defaultSharedPreferences.edit().putString("isAuth", "是").apply()
|
|
defaultSharedPreferences.edit().putString("isAuth", "是").apply()
|
|
ActivityUtils.startActivity(this@LoginActivity,MainActivity::class.java)
|
|
ActivityUtils.startActivity(this@LoginActivity,MainActivity::class.java)
|