everywindchase 5 ヶ月 前
コミット
c5d903e15a

+ 15 - 4
app/src/main/java/jx/cn/escort/ui/activity/LoginActivity.kt

@@ -1,15 +1,19 @@
 package jx.cn.escort.ui.activity
 
 
+import android.annotation.SuppressLint
 import android.content.Context
 import android.content.SharedPreferences
 import android.os.Bundle
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.lifecycleScope
 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
@@ -28,13 +32,20 @@ class LoginActivity : AppCompatActivity(), KoinComponent {
 
 
 
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(mBinding.root)
-        mBinding.btnLogin.setOnClickListener {
-            defaultSharedPreferences.edit().putString("isAuth", "是").apply()
-            ActivityUtils.startActivity(this,MainActivity::class.java)
-            finish()
+        mBinding.btnLogin
+        mBinding.btnLoginAction.setOnClickListener {
+            lifecycleScope.launch {
+                mBinding.loginTitle.text = "正在登陆中......"
+                delay(5000L)
+                defaultSharedPreferences.edit().putString("isAuth", "是").apply()
+                ActivityUtils.startActivity(this@LoginActivity,MainActivity::class.java)
+                finish()
+
+            }
         }
     }
 

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


+ 13 - 0
app/src/main/res/drawable/btn_login_action_bg.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="oval"
+
+>
+
+
+<solid  android:color="#C5DDDA"/>
+
+
+<stroke android:width="1dp" android:color="#F1FAF9"/>
+    <size   android:width="60dp"    android:height="60dp"/>
+</shape>

+ 24 - 2
app/src/main/res/layout/activity_login.xml

@@ -37,7 +37,8 @@
         <androidx.appcompat.widget.AppCompatTextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="Login"
+                android:text="加入"
+                android:id="@+id/login_title"
                 android:textColor="@color/black"
                 android:textSize="30sp"
                 android:layout_gravity="left"
@@ -83,7 +84,28 @@
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
 
-            app:layout_constraintTop_toTopOf="@+id/login_compose" android:layout_marginTop="320dp"/>
+            app:layout_constraintTop_toTopOf="@+id/login_compose" android:layout_marginTop="320dp">
+
+
+        <com.google.android.material.button.MaterialButton
+                android:layout_width="70dp" android:layout_height="70dp"
+                android:layout_gravity="center"
+                android:background="@drawable/btn_login_action_bg"
+                android:id="@+id/btn_login_action"
+                app:backgroundTint="#C5DDDA"
+                app:icon="@drawable/ic_btn_login_action"
+                app:iconSize="65dp"
+                app:iconGravity="top"
+        />
+
+
+
+
+
+
+
+
+    </androidx.appcompat.widget.LinearLayoutCompat>
 
 </androidx.constraintlayout.widget.ConstraintLayout>