everywindchase 5 månader sedan
förälder
incheckning
ddb3163efa

+ 22 - 5
app/src/main/java/jx/cn/escort/ui/activity/LoginActivity.kt

@@ -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)

+ 11 - 2
app/src/main/java/jx/cn/escort/utils/ActivityUtils.kt

@@ -1,6 +1,7 @@
 package jx.cn.escort.utils
 
 
+import android.app.ActivityOptions
 import android.content.Context
 import android.content.Intent
 
@@ -15,13 +16,21 @@ import android.content.Intent
           * </p>
           */
          @JvmStatic
-         inline  fun <reified  T> startActivity( context: Context,cls: Class<T>) {
+         inline  fun <reified  T> startActivity( context: Context,cls: Class<T>,options: ActivityOptions?) {
              val intent=Intent(context,cls)
-             context.startActivity(intent)
+             if(null==options) {
+                 context.startActivity(intent)
+             }else{
+                 context.startActivity(intent,options.toBundle())
+             }
 
          }
 
 
+         @JvmStatic
+         inline  fun <reified  T> startActivity( context: Context,cls: Class<T>) {
+             startActivity(context,cls,null)
+         }
 
      }
 

BIN
app/src/main/res/drawable-hdpi/ic_login_loding.png


+ 8 - 25
app/src/main/res/layout/activity_login.xml

@@ -45,33 +45,13 @@
         />
 
 
-        <androidx.appcompat.widget.AppCompatEditText
-                android:layout_width="match_parent"
-                android:layout_height="62dp"
-                android:layout_marginTop="45dp"
-                android:hint="请输入账号"
-                android:imeOptions="actionNext"
-                android:inputType="text"
-                android:lines="1"
-                android:paddingStart="7.5dp"
-                android:paddingEnd="2dp"
-                android:textColorHint="@color/xui_config_color_blue"
-                tools:ignore="HardcodedText"
-                tools:text="账号"/>
-
-        <androidx.appcompat.widget.AppCompatEditText
+
+        <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
                 android:layout_width="match_parent"
-                android:layout_height="62dp"
-                android:layout_marginTop="48dp"
-                android:hint="请输入账号"
-                android:imeOptions="actionNext"
+                android:layout_height="match_parent"
                 android:inputType="text"
-                android:lines="1"
-                android:paddingStart="7.5dp"
-                android:paddingEnd="2dp"
-                android:textColorHint="@color/xui_config_color_blue"
-                tools:ignore="HardcodedText"
-                tools:text="密码"/>
+                tools:text="23112"
+        />
 
 
     </androidx.appcompat.widget.LinearLayoutCompat>
@@ -107,6 +87,9 @@
 
     </androidx.appcompat.widget.LinearLayoutCompat>
 
+
+
+
 </androidx.constraintlayout.widget.ConstraintLayout>