Create register activity

This commit is contained in:
Reimar 2025-04-23 13:25:25 +02:00
parent 9fd62f9565
commit 9fae8ce5b5
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
7 changed files with 138 additions and 7 deletions

View File

@ -24,7 +24,7 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:exported="false"
android:label="@string/title_activity_main" />
<activity
@ -34,6 +34,10 @@
<activity
android:name=".LoginActivity"
android:exported="false" />
<activity
android:name=".RegisterActivity"
android:exported="false" />
</application>
</manifest>
</manifest>

View File

@ -0,0 +1,28 @@
package tech.mercantec.easyeat
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
class RegisterActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_register)
findViewById<Button>(R.id.register).setOnClickListener {
// TODO create account
startActivity(Intent(this, LoginActivity::class.java))
finish()
}
findViewById<Button>(R.id.back).setOnClickListener {
finish()
}
}
}

View File

@ -21,7 +21,7 @@ class WelcomeActivity : AppCompatActivity() {
}
findViewById<Button>(R.id.register).setOnClickListener {
startActivity(Intent(this, LoginActivity::class.java))
startActivity(Intent(this, RegisterActivity::class.java))
}
}
}

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="30sp"
android:paddingEnd="30sp"
android:gravity="center">
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textAlignment="center"
android:textSize="24sp"
android:text="@string/register_heading"
/>
<TextView
android:layout_marginTop="50sp"
android:layout_marginLeft="2sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username_label"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username_hint"
android:autofillHints="emailAddress"
/>
<TextView
android:layout_marginTop="20sp"
android:layout_marginLeft="2sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email_label"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email_hint"
android:autofillHints="emailAddress"
/>
<TextView
android:layout_marginTop="20sp"
android:layout_marginLeft="2sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_label"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password_hint"
android:autofillHints="password"
android:inputType="textPassword"
/>
<TextView
android:layout_marginTop="20sp"
android:layout_marginLeft="2sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/confirm_password_label"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password_hint"
android:autofillHints="password"
android:inputType="textPassword"
/>
<Button
android:id="@+id/register"
android:layout_marginTop="20sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/register_label"
/>
<Button
android:id="@+id/back"
android:layout_marginTop="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/back_label"
style="@style/Widget.MaterialComponents.Button.TextButton"
/>
</LinearLayout>

View File

@ -1,10 +1,10 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EasyEat" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.EasyEat" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/cyan</item>
<item name="colorPrimaryVariant">@color/dark_cyan</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/dark_gray</item>
<item name="colorSurface">@color/dark_cyan</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<item name="android:colorBackground">@color/black</item>
</style>

View File

@ -8,9 +8,13 @@
<string name="login_label">Login</string>
<string name="login_heading">Login to EasyEat</string>
<string name="register_label">Register</string>
<string name="register_heading">Register an account</string>
<string name="username_label">Username</string>
<string name="username_hint">John Doe</string>
<string name="email_label">Email</string>
<string name="email_hint">john@doe.com</string>
<string name="password_label">Password</string>
<string name="confirm_password_label">Confirm password</string>
<string name="password_hint">&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;</string>
<string name="back_label">Back</string>
</resources>

View File

@ -1,6 +1,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EasyEat" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.EasyEat" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/cyan</item>
<item name="colorPrimaryVariant">@color/dark_cyan</item>
<item name="colorOnPrimary">@color/white</item>