anyh
parent
391c5f1410
commit
6177143582
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,60 @@
|
||||
package org.tensorflow.lite.examples.poseestimation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import android.widget.EditText
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
|
||||
// 获取从上一个页面传递的数据
|
||||
val selectedGender = intent.getStringExtra("selected_gender")
|
||||
val selectedAge = intent.getIntExtra("selected_age", 0)
|
||||
val selectedWeight = intent.getIntExtra("selected_weight", 0)
|
||||
val selectedHeight = intent.getIntExtra("selected_height", 0)
|
||||
|
||||
// 绑定控件
|
||||
val emailEdit = findViewById<EditText>(R.id.editEmail)
|
||||
val passwordEdit = findViewById<EditText>(R.id.editPassword)
|
||||
val loginBtn = findViewById<Button>(R.id.btnLogin)
|
||||
val forgotPassword = findViewById<TextView>(R.id.forgotPassword)
|
||||
|
||||
// 登录按钮点击事件
|
||||
loginBtn.setOnClickListener {
|
||||
val email = emailEdit.text.toString().trim()
|
||||
val password = passwordEdit.text.toString().trim()
|
||||
|
||||
// 表单验证
|
||||
if (email.isEmpty()) {
|
||||
emailEdit.error = "请输入邮箱"
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (password.isEmpty()) {
|
||||
passwordEdit.error = "请输入密码"
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
// TODO: 这里添加实际的登录验证逻辑
|
||||
// 目前仅做演示,直接跳转到主页面
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
intent.putExtra("selected_gender", selectedGender)
|
||||
intent.putExtra("selected_age", selectedAge)
|
||||
intent.putExtra("selected_weight", selectedWeight)
|
||||
intent.putExtra("selected_height", selectedHeight)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
// 忘记密码点击事件
|
||||
forgotPassword.setOnClickListener {
|
||||
Toast.makeText(this, "忘记密码功能开发中", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#B266FF" android:state_focused="true"/>
|
||||
<item android:color="#FFFFFF"/>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#BF5AF2"/>
|
||||
<corners android:radius="28dp"/>
|
||||
</shape>
|
After Width: | Height: | Size: 882 KiB |
@ -0,0 +1,144 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#19191B">
|
||||
|
||||
<!-- 背景大图 -->
|
||||
<ImageView
|
||||
android:id="@+id/bgImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/login_woman"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="417:515"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="1.0"/>
|
||||
|
||||
<!-- 顶部Tab切换栏 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/tabBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="48dp"
|
||||
android:paddingEnd="32dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tabLogin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Login"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"/>
|
||||
<View
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="#BF5AF2"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tabSignup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sign up"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="18sp"/>
|
||||
<View
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 下半部分遮罩和表单 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/formCard"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:cardCornerRadius="32dp"
|
||||
app:cardBackgroundColor="#19191B"
|
||||
app:layout_constraintTop_toBottomOf="@id/bgImage"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<!-- 用户名输入框 -->
|
||||
<EditText
|
||||
android:id="@+id/editEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:hint="用户名"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorHint="#FFFFFF"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="text"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- 密码输入框 -->
|
||||
<EditText
|
||||
android:id="@+id/editPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:hint="密码"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorHint="#FFFFFF"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
<!-- 忘记密码 -->
|
||||
<TextView
|
||||
android:id="@+id/forgotPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Forgot Password"
|
||||
android:textColor="#BF5AF2"
|
||||
android:textSize="14sp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<!-- 主按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnLogin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="Login"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/btn_purple_rounded"
|
||||
android:stateListAnimator="@null"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in new issue