CodingMSTR LogoCodingMSTR
Login & Registration Form UI Material Design with Form Validation Android Studio

Login & Registration Form UI Material Design with Form Validation Android Studio

Free

Login & Registration(Sign up) Form UI Material Design with Form(EditText) Validation Implemented in Android Studio

Category: Android
Added On: August 19, 2022
Developer: By Praveen
Youtube Video

For any customization or code setup, feel free to contact us. We also offer deployment on live servers.

For any issues related to downloading, email me at devpraveenkr@gmail.com

Need additional support or customization? Contact me!

Project Screenshots

No screenshots available

Project Description

Login & Registration(Sign up) Form UI Material Design with Form(EditText) Validation Implemented in Android Studio

MainActivity.Java

 
         
		
package com.trickuweb.logindesign;

import android.content.Intent;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.basgeekball.awesomevalidation.AwesomeValidation;
import com.basgeekball.awesomevalidation.ValidationStyle;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    Button requestButton;
    TextView alreadySignin;
    private AwesomeValidation awesomeValidation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);

        requestButton = (Button) findViewById(R.id.buttonSubmit);
        alreadySignin = (TextView) findViewById(R.id.already_signin);
        requestButton.setOnClickListener(mMyListener);
        alreadySignin.setOnClickListener(mMyListener);

        String regexPassword = "(?=.*[a-z])(?=.*[A-Z])(?=.*[\\d])(?=.*[~`!@#\\$%\\^&\\*\\(\\)\\-_\\+=\\{\\}\\[\\]\\|\\;:\"<>,./\\?]).{8,}";
        //adding validation to edittexts
        awesomeValidation.addValidation(this, R.id.editTextName, "^[A-Za-z\\s]{1,}[\\.]{0,1}[A-Za-z\\s]{0,}$", R.string.nameerror);
        awesomeValidation.addValidation(this, R.id.editTextEmail, Patterns.EMAIL_ADDRESS, R.string.emailerror);
        awesomeValidation.addValidation(this, R.id.editTextMobile, "^[2-9]{2}[0-9]{8}$", R.string.mobileerror);
        awesomeValidation.addValidation(this, R.id.editPassword, regexPassword, R.string.passworderror);
    }
    private View.OnClickListener mMyListener = new View.OnClickListener() {
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.buttonSubmit:
                    if (awesomeValidation.validate()) {
                        Toast.makeText(getApplicationContext(), "Its Working!", Toast.LENGTH_LONG).show();
                    }
                    break;
                case R.id.already_signin:
                    Intent i = new Intent(getApplicationContext(), LoginActivity.class);
                    startActivity(i);
                    break;
                default:
                    break;
            }
        }
    };

}


		
            
         
    



activity_main.xml

 
         
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@drawable/screen_background"
    android:orientation="vertical"
    tools:context=".MainActivity"
    android:id="@+id/register_activity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:orientation="horizontal"
        android:background="@drawable/top_gradient"/>

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="vertical">

            <ImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:src="@drawable/login"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="30dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:textColor="@color/colorWhite"
                android:textSize="25sp"
                android:textAlignment="center"
                android:text="CODING MASTER"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/colorWhite"
                android:textAlignment="center"
                android:text="SIGN UP TO LEARN QUICKLY"/>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/form_username">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editTextName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/form_email">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editTextEmail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textEmailAddress"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/form_phone">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editTextMobile"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="phone"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:endIconMode="password_toggle"
                android:hint="@string/form_password">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textPassword"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <Button
                android:id="@+id/buttonSubmit"
                android:layout_margin="20dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/colorWhite"
                android:background="@drawable/btn_round"
                android:text="Sign Up" />

            <TextView
                android:id="@+id/already_signin"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:textColor="@color/colorWhite"
                android:textAlignment="center"
                android:text="@string/already_member"/>

        </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:orientation="horizontal"
        android:background="@drawable/top_gradient"/>

</LinearLayout>
            
         
    



LoginActivity.Java

 
         
package com.trickuweb.logindesign;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.basgeekball.awesomevalidation.AwesomeValidation;

public class LoginActivity extends AppCompatActivity {
    Button requestButton;
    TextView alreadySignup;
    private AwesomeValidation awesomeValidation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
		
		awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);

        requestButton = (Button) findViewById(R.id.buttonLogin);
        alreadySignup = (TextView) findViewById(R.id.already_signup);
        requestButton.setOnClickListener(mMyListener);
        alreadySignup.setOnClickListener(mMyListener);

        awesomeValidation.addValidation(this, R.id.editTextEmail, Patterns.EMAIL_ADDRESS, R.string.emailerror);
    }
    private View.OnClickListener mMyListener = new View.OnClickListener() {
        public void onClick(View v) {
            switch (v.getId() /*to get clicked view id**/) {
                case R.id.buttonSubmit:
                    if (awesomeValidation.validate()) {
                        Toast.makeText(getApplicationContext(), "Login In Working!", Toast.LENGTH_LONG).show();
                    }
                    break;
                case R.id.already_signup:
                    Intent i = new Intent(getApplicationContext(), MainActivity.class);
                    startActivity(i);
                    break;
                default:
                    break;
            }
        }
    };
}
		
            
         
    



activity_login.xml

 
         
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:background="@drawable/screen_background"
    tools:context=".LoginActivity"
    android:id="@+id/register_activity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:orientation="horizontal"
        android:background="@drawable/top_gradient"/>

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="vertical">


            <ImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:src="@drawable/login"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="30dp"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:textColor="@color/colorWhite"
                android:textSize="25sp"
                android:textAlignment="center"
                android:text="WELCOME BACK"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/colorWhite"
                android:textAlignment="center"
                android:text="SIGN I TO LEARN QUICKLY"/>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/form_email">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editTextEmail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textEmailAddress"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:endIconMode="password_toggle"
                android:hint="@string/form_password">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/editPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textPassword"
                    android:layout_margin="10dp"
                    android:ems="10" />

            </com.google.android.material.textfield.TextInputLayout>

            <Button
                android:id="@+id/buttonLogin"
                android:layout_margin="20dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/colorWhite"
                android:background="@drawable/btn_round"
                android:text="Login" />

            <TextView
                android:id="@+id/already_signup"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:textColor="@color/colorWhite"
                android:textAlignment="center"
                android:text="@string/new_member"/>

        </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:orientation="horizontal"
        android:background="@drawable/top_gradient"/>

</LinearLayout>
            
         
    



colors.xml

 
         
			
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#623FD7</color>
    <color name="colorPrimaryDark">#833AC7</color>
    <color name="colorAccent">#03DAC5</color>
    <color name="colorWhite">#FFFFFF</color>
</resources>
		
            
         
    



string.xml

 
         
			
<resources>
    <string name="app_name">LoginDesign</string>
    <string name="user_name">UserName</string>
    <string name="form_username">User Name</string>
    <string name="form_email">Email ID</string>
    <string name="form_phone">Phone No</string>
    <string name="form_password">Password</string>
    <string name="already_member">I am already a member.</string>
    <string name="new_member">New Here ? Sign up instead.</string>
    <string name="nameerror">Enter a valid name</string>
    <string name="emailerror">Enter a valid email</string>
    <string name="mobileerror">Enter a valid mobile</string>
    <string name="passworderror">The password must contain at least 8 character containing, at least one letter and one number</string>
</resources>
		
            
         
    



style.xml

 
         
<resources>

    
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>
		
            
         
    



build.gradle

 
         
			

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'com.google.android.material:material:1.1.0' implementation 'com.basgeekball:awesome-validation:4.2' }




AndroidMenifest.xml

 
         
			

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.trickuweb.mydesign"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".LoginActivity" android:theme="@style/Theme.AppCompat.NoActionBar"></activity> <activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.NoActionBar"> <intent-filter> </intent-filter> </activity> </application> </manifest>


Project Demo Video