Task 5:- Registra on page
Ac vity_registra [Link]:-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".RegistrationActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</ScrollView>
<ImageView
android:id="@+id/ivLoginLogo"
android:layout_width="220sp"
android:layout_height="220sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="1dp"
android:layout_marginBottom="10sp"
android:src="@drawable/netflix2"
/>
<[Link]
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cvLogin"
android:layout_margin="5sp"
app:cardBackgroundColor="@color/verylightred"
app:cardCornerRadius="18sp"
app:cardElevation="28dp"
android:layout_marginTop="122sp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="22dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/acme"
android:gravity="center"
android:text="@string/register"
android:textColor="@color/black"
android:textSize="27sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
/>
<EditText
android:id="@+id/etLRegistrationUserName"
android:layout_width="match_parent"
android:layout_height="55sp"
android:layout_margin="4sp"
android:fontFamily="sans-serif-condensed"
android:hint="Full Name :-"
android:inputType="text"
android:textColorHint="@color/black"
android:textSize="21dp"
android:textStyle="bold"
android:background="@drawable/etpgshape"
android:paddingLeft="16sp"
/>
<EditText
android:id="@+id/etRegistrationMobile"
android:layout_width="match_parent"
android:layout_height="55sp"
android:layout_margin="4sp"
android:fontFamily="sans-serif-condensed"
android:hint="Mobile No :-"
android:inputType="phone"
android:textColorHint="@color/black"
android:textSize="21dp"
android:textStyle="bold"
android:background="@drawable/etpgshape"
android:paddingLeft="16sp"
/>
<EditText
android:id="@+id/etRegistrationEmail"
android:layout_width="match_parent"
android:layout_height="55sp"
android:layout_margin="4sp"
android:fontFamily="sans-serif-condensed"
android:hint="Email :-"
android:inputType="textEmailAddress"
android:textColorHint="@color/black"
android:textSize="21dp"
android:textStyle="bold"
android:background="@drawable/etpgshape"
android:paddingLeft="16sp"
/>
<EditText
android:id="@+id/etRegistrationPassword"
android:layout_width="match_parent"
android:layout_height="55sp"
android:layout_margin="4sp"
android:fontFamily="sans-serif-condensed"
android:hint="@string/password"
android:inputType="textPassword"
android:textColorHint="@color/black"
android:textSize="21dp"
android:textStyle="bold"
android:background="@drawable/etpgshape"
android:paddingLeft="16sp"
/>
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cbRegistrationShowHidePassword"
android:text="@string/show_password"
android:textSize="16sp"
android:textColor="@color/black"
android:fontFamily="sans-serif-condensed"
android:textStyle="bold"
android:checked="false"
android:layout_marginTop="1dp"/>
<[Link]
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnRegister"
android:text="Register"
android:textColor="@color/lightred"
android:textStyle="bold"
android:textSize="16sp"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
</[Link]>
</LinearLayout>
Registra [Link]:-
package [Link].mytask1;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class RegistrationActivity extends AppCompatActivity {
EditText
etLRegistrationUserName,etRegistrationPassword,etRegistrationMobile,etRegistr
ationEmail;
CheckBox cbRegistrationShowHidePassword;
Button btnRegister;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
[Link](this);
setContentView([Link].activity_registration);
setTitle("Registration Page");
etLRegistrationUserName = findViewById([Link]);
etRegistrationPassword = findViewById([Link]);
etRegistrationMobile = findViewById([Link]);
etRegistrationEmail = findViewById([Link]);
cbRegistrationShowHidePassword =
findViewById([Link]);
btnRegister = findViewById([Link]);
[Link](new
[Link]() {
@Override
public void onCheckedChanged(CompoundButton buttonview , boolean
isChecked) {
if (isChecked)
{
[Link](HideReturnsTransformationMetho
[Link]());
}else
{
[Link](PasswordTransformationMethod.g
etInstance());
}
}
});
[Link](new [Link]() {
@Override
public void onClick(View view) {
if ([Link]().toString().isEmpty())
{
[Link]("Please Enter Your
Name");
} else if
([Link]().toString().isEmpty()) {
[Link]("Please Enter Your
Password");
} else if
([Link]().toString().length()<8) {
[Link]("Please Enter 8 Character
Password");
} else if
([Link]().toString().length()<8){
[Link]("Please Enter 8
Character Username");
else if ([Link]().toString().isEmpty())
{
[Link]("Please Enter Your Mobile
Number");
} else if
([Link]().toString().length()!=10) {
[Link]("Invalid Mobile
Number");
} else if
([Link]().toString().isEmpty()){
[Link]("Please Enter Your Email");
} else if
(![Link]().toString().contains("@")) {
[Link]("Invalid Email");
} else if
(![Link]().toString().contains(".com")) {
[Link]("Invalid Email");
} else if
(![Link]().toString().matches(".*[A-Z].*")) {
[Link]("Please Used 1 UpperCase
Letter");
} else if
(![Link]().toString().matches(".*[a-z].*")) {
[Link]("Please Used 1 LowerCase
Letter");
}else if
(![Link]().toString().matches(".*[0-9].*")) {
[Link]("Please Used 1 Number
Letter");
}else if
(![Link]().toString().matches(".*[@,#,$,!].*")) {
[Link]("Please Used 1 Special
Symbol");
}
else
{
[Link]([Link],"Registration
Successfully Done",Toast.LENGTH_SHORT).show();
}
}
});
[Link](findViewById([Link]),
(v, insets) -> {
Insets systemBars =
[Link]([Link]());
[Link]([Link], [Link], [Link],
[Link]);
return insets;
});
}
}