Create login activity
This commit is contained in:
parent
d9cc16e3d7
commit
9fd62f9565
@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".WelcomeActivity"
|
android:name=".WelcomeActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".LoginActivity"
|
||||||
|
android:exported="false" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,29 @@
|
|||||||
|
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 LoginActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_login)
|
||||||
|
|
||||||
|
findViewById<Button>(R.id.login).setOnClickListener {
|
||||||
|
// TODO authenticate
|
||||||
|
|
||||||
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK // Prevent going back to login screen
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
findViewById<Button>(R.id.back).setOnClickListener {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package tech.mercantec.easyeat
|
package tech.mercantec.easyeat
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
|
|
||||||
class SplashActivity : AppCompatActivity() {
|
class SplashActivity : Activity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package tech.mercantec.easyeat
|
package tech.mercantec.easyeat
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
@ -13,5 +15,13 @@ class WelcomeActivity : AppCompatActivity() {
|
|||||||
supportActionBar?.hide()
|
supportActionBar?.hide()
|
||||||
|
|
||||||
setContentView(R.layout.activity_welcome)
|
setContentView(R.layout.activity_welcome)
|
||||||
|
|
||||||
|
findViewById<Button>(R.id.login).setOnClickListener {
|
||||||
|
startActivity(Intent(this, LoginActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
|
findViewById<Button>(R.id.register).setOnClickListener {
|
||||||
|
startActivity(Intent(this, LoginActivity::class.java))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
65
app/app/src/main/res/layout/activity_login.xml
Normal file
65
app/app/src/main/res/layout/activity_login.xml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?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/login_heading"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="50sp"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
|
android:layout_marginTop="20sp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/login_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>
|
@ -24,6 +24,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
android:layout_marginTop="80sp"
|
android:layout_marginTop="80sp"
|
||||||
android:backgroundTint="@color/dark_gray"
|
android:backgroundTint="@color/dark_gray"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -32,6 +33,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/register"
|
||||||
android:layout_marginTop="10sp"
|
android:layout_marginTop="10sp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -6,5 +6,11 @@
|
|||||||
<string name="title_notifications">Notifications</string>
|
<string name="title_notifications">Notifications</string>
|
||||||
<string name="welcome_heading">Welcome to <font color="#0099BA">EasyEat</font></string>
|
<string name="welcome_heading">Welcome to <font color="#0099BA">EasyEat</font></string>
|
||||||
<string name="login_label">Login</string>
|
<string name="login_label">Login</string>
|
||||||
|
<string name="login_heading">Login to EasyEat</string>
|
||||||
<string name="register_label">Register</string>
|
<string name="register_label">Register</string>
|
||||||
|
<string name="email_label">Email</string>
|
||||||
|
<string name="email_hint">john@doe.com</string>
|
||||||
|
<string name="password_label">Password</string>
|
||||||
|
<string name="password_hint">••••••••</string>
|
||||||
|
<string name="back_label">Back</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user