login ui test

This commit is contained in:
2025-07-24 14:48:42 +05:00
parent 08e9693997
commit 039fcd690f
3 changed files with 292 additions and 1 deletions

View File

@@ -12,7 +12,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.GridFlow">
<activity
android:name=".MainActivity"
android:name=".LoginActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.GridFlow.NoActionBar">
@@ -22,6 +22,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false"
android:label="@string/app_name"
android:theme="@style/Theme.GridFlow.NoActionBar" />
</application>
</manifest>

View File

@@ -0,0 +1,89 @@
package sh.sar.gridflow
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import sh.sar.gridflow.databinding.ActivityLoginBinding
class LoginActivity : AppCompatActivity() {
private lateinit var binding: ActivityLoginBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
setupClickListeners()
}
private fun setupClickListeners() {
binding.btnSignIn.setOnClickListener {
handleSignIn()
}
binding.btnRegister.setOnClickListener {
handleRegister()
}
binding.btnForgotPassword.setOnClickListener {
handleForgotPassword()
}
binding.btnPayWithoutAccount.setOnClickListener {
handlePayWithoutAccount()
}
}
private fun handleSignIn() {
val mobileNumber = binding.etMobileNumber.text.toString().trim()
val password = binding.etPassword.text.toString().trim()
if (validateInput(mobileNumber, password)) {
// TODO: Implement actual authentication logic
// For now, just navigate to main activity
Toast.makeText(this, "Signing in...", Toast.LENGTH_SHORT).show()
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
}
}
private fun handleRegister() {
Toast.makeText(this, "Register functionality coming soon", Toast.LENGTH_SHORT).show()
// TODO: Navigate to registration screen
}
private fun handleForgotPassword() {
Toast.makeText(this, "Forgot password functionality coming soon", Toast.LENGTH_SHORT).show()
// TODO: Navigate to forgot password screen
}
private fun handlePayWithoutAccount() {
Toast.makeText(this, "Guest payment functionality coming soon", Toast.LENGTH_SHORT).show()
// TODO: Navigate to guest payment flow
}
private fun validateInput(mobileNumber: String, password: String): Boolean {
if (mobileNumber.isEmpty()) {
binding.etMobileNumber.error = "Mobile number is required"
return false
}
if (password.isEmpty()) {
binding.etPassword.error = "Password is required"
return false
}
// Basic Maldives mobile number validation (7xxxxxx format)
if (!mobileNumber.matches(Regex("^[79]\\d{6}$"))) {
binding.etMobileNumber.error = "Enter a valid Maldives mobile number"
return false
}
return true
}
}

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:fillViewport="true"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="32dp"
android:gravity="center">
<!-- App Logo Section -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/iv_app_logo"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginBottom="24dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="GridFlow Logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GridFlow"
android:textSize="28sp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_marginBottom="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your Personal Fenaka Client"
android:textSize="14sp"
android:textColor="@color/black"
android:alpha="0.7" />
</LinearLayout>
<!-- Login Form Section -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="32dp">
<!-- Mobile Number Input -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Mobile Number"
app:boxStrokeColor="@color/design_default_color_primary"
app:hintTextColor="@color/design_default_color_primary"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_mobile_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:maxLength="7"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Password Input -->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:hint="Password"
app:boxStrokeColor="@color/design_default_color_primary"
app:hintTextColor="@color/design_default_color_primary"
app:passwordToggleEnabled="true"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
<!-- Action Buttons Row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="32dp"
android:weightSum="3">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_sign_in"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="4dp"
android:text="Sign In"
android:textSize="12sp"
app:cornerRadius="8dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_register"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:text="Register"
android:textSize="12sp"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
app:cornerRadius="8dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_forgot_password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="4dp"
android:text="Forgot?"
android:textSize="12sp"
style="@style/Widget.MaterialComponents.Button.TextButton"
app:cornerRadius="8dp" />
</LinearLayout>
<!-- Divider -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="24dp">
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:background="@color/black"
android:alpha="0.3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OR"
android:textSize="14sp"
android:textColor="@color/black"
android:alpha="0.7"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:background="@color/black"
android:alpha="0.3" />
</LinearLayout>
<!-- Pay Without Account Button -->
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_pay_without_account"
android:layout_width="match_parent"
android:layout_height="56dp"
android:text="Pay without an account"
android:textSize="16sp"
android:textAllCaps="false"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
app:cornerRadius="8dp"
app:strokeColor="@color/design_default_color_primary"
app:strokeWidth="2dp" />
</LinearLayout>
<!-- Spacer for bottom -->
<View
android:layout_width="match_parent"
android:layout_height="32dp" />
</LinearLayout>
</ScrollView>