Dola TENG vor 1 Jahr
Ursprung
Commit
fd22d61d6b

+ 15 - 14
app/src/main/AndroidManifest.xml

@@ -2,42 +2,43 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="com.sambath.sbc">
+
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.BLUETOOTH" />
     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-<!--    <meta-data-->
-<!--        android:name="firebase_crashlytics_collection_enabled"-->
-<!--        android:value="${enableCrashlytic}" />-->
 
     <application
-        android:name="com.sambath.sbc.app.App"
+        android:name=".app.App"
         android:allowBackup="false"
+        android:hardwareAccelerated="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
-        android:hardwareAccelerated="true"
         android:supportsRtl="true"
         android:theme="@style/AppTheme"
         android:usesCleartextTraffic="true"
         tools:targetApi="m">
         <activity
-            android:name="com.sambath.sbc.app.ShareActivity"
-            android:label="@string/app_name"
+            android:name=".screen.register.RegisterActivity"
+            android:exported="false" />
+        <activity
+            android:name=".app.ShareActivity"
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
+            android:label="@string/app_name"
             android:screenOrientation="sensorPortrait"
             android:windowSoftInputMode="adjustResize" />
         <activity
-            android:name="com.sambath.sbc.screen.login.LoginActivity"
-            android:label="@string/app_name"
+            android:name=".screen.login.LoginActivity"
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
+            android:label="@string/app_name"
             android:screenOrientation="sensorPortrait"
-            android:windowSoftInputMode="adjustResize"/>
-
-        <activity android:name="com.sambath.sbc.screen.splash.SplashScreenActivity"
+            android:windowSoftInputMode="adjustResize" />
+        <activity
+            android:name=".screen.splash.SplashScreenActivity"
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
+            android:exported="true"
             android:screenOrientation="sensorPortrait"
-            android:windowSoftInputMode="adjustResize"
-            android:exported="true">
+            android:windowSoftInputMode="adjustResize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 

+ 7 - 0
app/src/main/java/com/sambath/sbc/screen/login/LoginActivity.kt

@@ -8,6 +8,7 @@ import com.sambath.sbc.R
 import com.sambath.sbc.app.App
 import com.sambath.sbc.app.ShareActivity
 import com.sambath.sbc.remote.User
+import com.sambath.sbc.screen.register.RegisterActivity
 import com.sambath.sbc.util.Const
 import com.sambath.sbc.util.ModelPreferencesManager
 import kotlinx.android.synthetic.main.activity_login.*
@@ -43,6 +44,12 @@ class LoginActivity : AppCompatActivity() {
             }
             loginViewModel.login(username.toString(), password.toString())
         }
+
+        btn_signup.setOnClickListener {
+            val intent = Intent(this, RegisterActivity::class.java)
+            startActivity(intent)
+            finishAffinity()
+        }
     }
 
     private fun render(state: LoginViewState) {

+ 20 - 0
app/src/main/java/com/sambath/sbc/screen/register/RegisterActivity.kt

@@ -0,0 +1,20 @@
+package com.sambath.sbc.screen.register
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.ArrayAdapter
+import com.sambath.sbc.R
+import kotlinx.android.synthetic.main.activity_register.et_gender
+
+class RegisterActivity : AppCompatActivity() {
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_register)
+
+        val spinnerData = listOf("Select Gender", "Female", "Male", "Other")
+        val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, spinnerData)
+        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
+        et_gender.adapter = adapter
+        et_gender.setSelection(0)
+    }
+}

+ 217 - 0
app/src/main/res/layout/activity_register.xml

@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/text_black"
+    android:orientation="vertical"
+    tools:context=".screen.register.RegisterActivity">
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <androidx.cardview.widget.CardView
+            android:id="@+id/backgroundCard"
+            android:layout_width="match_parent"
+            android:layout_height="200dp"
+            app:cardBackgroundColor="@color/cardview_dark_background"
+            app:cardElevation="0dp" />
+
+        <ImageView
+            android:id="@+id/profileImage"
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="150dp"
+            android:src="@drawable/ic_user_white" />
+    </FrameLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:padding="15dp">
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/til_firstname"
+            style="@style/BoxInputLayout"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            app:endIconMode="clear_text"
+            app:hintEnabled="false">
+
+            <androidx.appcompat.widget.AppCompatEditText
+                android:id="@+id/et_firstname"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_white"
+                android:hint="@string/hint_firstname"
+                android:inputType="text"
+                android:maxLength="50"
+                android:padding="0dp" />
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/til_lastname"
+            style="@style/BoxInputLayout"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            app:endIconMode="clear_text"
+            app:hintEnabled="false">
+
+            <androidx.appcompat.widget.AppCompatEditText
+                android:id="@+id/et_lastname"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_white"
+                android:hint="@string/hint_lastname"
+                android:inputType="text"
+                android:maxLength="50"
+                android:padding="0dp" />
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/til_gender"
+            style="@style/BoxInputLayout"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            app:endIconMode="clear_text"
+            app:hintEnabled="false">
+
+            <androidx.appcompat.widget.AppCompatSpinner
+                android:id="@+id/et_gender"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_white"
+                android:hint="@string/hint_lastname"
+                android:inputType="text"
+                android:maxLength="50"
+                android:padding="0dp" />
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@color/color_gray_300"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <RadioGroup
+                    android:id="@+id/radioGroup"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
+                    <RadioButton
+                        android:id="@+id/radioButtonEmail"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:checked="true"
+                        android:text="Email" />
+
+                    <RadioButton
+                        android:id="@+id/radioButtonPhone"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="Phone Number" />
+                </RadioGroup>
+            </LinearLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/til_email"
+                style="@style/BoxInputLayout"
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                app:endIconMode="clear_text"
+                app:hintEnabled="false">
+
+                <androidx.appcompat.widget.AppCompatEditText
+                    android:id="@+id/et_email"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/color_white"
+                    android:hint="@string/hint_email"
+                    android:inputType="text"
+                    android:maxLength="50"
+                    android:padding="0dp" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/til_phone"
+                style="@style/BoxInputLayout"
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:visibility="gone"
+                app:endIconMode="clear_text"
+                app:hintEnabled="false">
+
+                <androidx.appcompat.widget.AppCompatEditText
+                    android:id="@+id/et_phone"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/color_white"
+                    android:hint="@string/hint_phone"
+                    android:inputType="text"
+                    android:maxLength="50"
+                    android:padding="0dp" />
+            </com.google.android.material.textfield.TextInputLayout>
+        </LinearLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/til_password"
+            style="@style/BoxInputLayout"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            app:endIconMode="clear_text"
+            app:hintEnabled="false">
+
+            <androidx.appcompat.widget.AppCompatEditText
+                android:id="@+id/et_password"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_white"
+                android:hint="@string/hint_password"
+                android:inputType="text"
+                android:maxLength="50"
+                android:padding="0dp" />
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/til_confirm_password"
+            style="@style/BoxInputLayout"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            app:endIconMode="clear_text"
+            app:hintEnabled="false">
+
+            <androidx.appcompat.widget.AppCompatEditText
+                android:id="@+id/et_confirm_password"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_white"
+                android:hint="@string/hint_confirm_password"
+                android:inputType="text"
+                android:maxLength="50"
+                android:padding="0dp" />
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <Button
+            android:id="@+id/registerButton"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="32dp"
+            android:layout_marginTop="32dp"
+            android:layout_marginEnd="32dp"
+            android:text="Register"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/confirmPasswordEditText" />
+    </LinearLayout>
+
+</androidx.appcompat.widget.LinearLayoutCompat>

+ 6 - 2
app/src/main/res/values/strings.xml

@@ -62,6 +62,10 @@
     <string name="type">"ប្រភេទ: "</string>
     <string name="btn_forgot">Forgot Password?</string>
     <string name="btn_signup">Sign Up\n</string>
-    <!--    <string name="hello_first_fragment">Hello first fragment</string>-->
-    <!--    <string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>-->
+    <string name="hint_firstname">First Name</string>
+    <string name="hint_lastname">Last Name</string>
+    <string name="hint_gender">Gender</string>
+    <string name="hint_email">Email</string>
+    <string name="hint_phone">Phone Number</string>
+    <string name="hint_confirm_password">Confirm Password</string>
 </resources>