parent
6177143582
commit
a0ff98ae48
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,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,59 @@
|
||||
package org.tensorflow.lite.examples.poseestimation
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
class SignupActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_signup)
|
||||
|
||||
// 绑定控件
|
||||
val usernameEdit = findViewById<EditText>(R.id.editUsername)
|
||||
val passwordEdit = findViewById<EditText>(R.id.editPassword)
|
||||
val passwordAgainEdit = findViewById<EditText>(R.id.editPasswordAgain)
|
||||
val signupBtn = findViewById<Button>(R.id.btnSignup)
|
||||
val loginTab = findViewById<TextView>(R.id.tabLogin)
|
||||
|
||||
// 注册按钮点击事件
|
||||
signupBtn.setOnClickListener {
|
||||
val username = usernameEdit.text.toString().trim()
|
||||
val password = passwordEdit.text.toString().trim()
|
||||
val passwordAgain = passwordAgainEdit.text.toString().trim()
|
||||
|
||||
// 表单验证
|
||||
if (username.isEmpty()) {
|
||||
usernameEdit.error = "请输入用户名"
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (password.isEmpty()) {
|
||||
passwordEdit.error = "请输入密码"
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (passwordAgain.isEmpty()) {
|
||||
passwordAgainEdit.error = "请确认密码"
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
// 验证两次密码是否一致
|
||||
if (password != passwordAgain) {
|
||||
passwordAgainEdit.error = "请确认密码"
|
||||
Toast.makeText(this, "两次输入的密码不一致", Toast.LENGTH_SHORT).show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
// TODO: 这里添加实际的注册逻辑
|
||||
Toast.makeText(this, "注册成功", Toast.LENGTH_SHORT).show()
|
||||
finish()
|
||||
}
|
||||
|
||||
// Login Tab点击事件
|
||||
loginTab.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#BF5AF2" />
|
||||
<corners android:radius="28dp" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 920 KiB |
@ -0,0 +1,146 @@
|
||||
<?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/signup_man"
|
||||
app:layout_constraintDimensionRatio="417:515"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
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"
|
||||
android:elevation="4dp"
|
||||
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="#99FFFFFF"
|
||||
android:textSize="18sp"/>
|
||||
<View
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="@android:color/transparent"
|
||||
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="#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>
|
||||
</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/editUsername"
|
||||
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"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- 确认密码输入框 -->
|
||||
<EditText
|
||||
android:id="@+id/editPasswordAgain"
|
||||
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"/>
|
||||
|
||||
<!-- 注册按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnSignup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:text="Sign up"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:backgroundTint="#BF5AF2"
|
||||
android:stateListAnimator="@null"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in new issue