Skip to content

Instantly share code, notes, and snippets.

@peterpazmandi
Created June 2, 2020 12:52
Show Gist options
  • Select an option

  • Save peterpazmandi/d5581e063d9c54745213e761a9ab6917 to your computer and use it in GitHub Desktop.

Select an option

Save peterpazmandi/d5581e063d9c54745213e761a9ab6917 to your computer and use it in GitHub Desktop.
activity_main.xml of password checker
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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/colorPrimary"
android:fillViewport="true"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
app:cardBackgroundColor="@color/colorFormBackground">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="30dp"
android:paddingBottom="30dp">
<RelativeLayout
android:id="@+id/email_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/email_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/email_title"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_large" />
<androidx.cardview.widget.CardView
android:id="@+id/email_input_box_parent"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/email_title"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
app:cardBackgroundColor="@color/colorFormInputBackground"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/input_box_style">
<EditText
android:id="@+id/email_input_field"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="@null"
android:hint="@string/email_hint_title"
android:inputType="textEmailAddress"
android:maxLines="1"
android:paddingStart="@dimen/padding_medium"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_large"
android:textStyle="bold" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/email_error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/email_input_box_parent"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:layout_marginRight="15dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/email_error_text"
android:textColor="@color/colorError"
android:textSize="@dimen/textsize_medium"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/password_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/email_parent"
android:layout_marginTop="15dp">
<TextView
android:id="@+id/password_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/password_title"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_large" />
<androidx.cardview.widget.CardView
android:id="@+id/password_input_box_parent"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/password_title"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
app:cardBackgroundColor="@color/colorFormInputBackground"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/input_box_style">
<EditText
android:id="@+id/password_input_field"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="@null"
android:hint="@string/password_title"
android:inputType="textPassword"
android:maxLines="1"
android:paddingStart="@dimen/padding_medium"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_large"
android:textStyle="bold" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/password_error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/password_input_box_parent"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:layout_marginRight="15dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/email_error_text"
android:textColor="@color/colorError"
android:textSize="@dimen/textsize_medium"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/password_error_text"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
<TextView
android:id="@+id/password_items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:lines="1"
android:text="@string/password_items_title"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_large" />
<!--At least 8 characters-->
<RelativeLayout
android:id="@+id/p_item_1_parent"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@+id/password_items"
android:layout_marginTop="10dp">
<androidx.cardview.widget.CardView
android:id="@+id/p_item_1_icon_parent"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_centerVertical="true"
app:cardBackgroundColor="@color/colorCheckNo"
app:cardCornerRadius="11dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_done" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_small"
android:layout_toEndOf="@+id/p_item_1_icon_parent"
android:ellipsize="end"
android:lines="1"
android:text="@string/p_item_1"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_medium" />
</RelativeLayout>
<!--Minimum one uppercase-->
<RelativeLayout
android:id="@+id/p_item_2_parent"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@+id/p_item_1_parent"
android:layout_marginTop="5dp">
<androidx.cardview.widget.CardView
android:id="@+id/p_item_2_icon_parent"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_centerVertical="true"
app:cardBackgroundColor="@color/colorCheckNo"
app:cardCornerRadius="11dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_done" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_small"
android:layout_toEndOf="@+id/p_item_2_icon_parent"
android:ellipsize="end"
android:lines="1"
android:text="@string/p_item_2"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_medium" />
</RelativeLayout>
<!--Minimum one number-->
<RelativeLayout
android:id="@+id/p_item_3_parent"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@+id/p_item_2_parent"
android:layout_marginTop="5dp">
<androidx.cardview.widget.CardView
android:id="@+id/p_item_3_icon_parent"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_centerVertical="true"
app:cardBackgroundColor="@color/colorCheckNo"
app:cardCornerRadius="11dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_done" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_small"
android:layout_toEndOf="@+id/p_item_3_icon_parent"
android:ellipsize="end"
android:lines="1"
android:text="@string/p_item_3"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_medium" />
</RelativeLayout>
<!--Minimum one symbol-->
<RelativeLayout
android:id="@+id/p_item_4_parent"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@+id/p_item_3_parent"
android:layout_marginTop="5dp">
<androidx.cardview.widget.CardView
android:id="@+id/p_item_4_icon_parent"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_centerVertical="true"
app:cardBackgroundColor="@color/colorCheckNo"
app:cardCornerRadius="11dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_done" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_small"
android:layout_toEndOf="@+id/p_item_4_icon_parent"
android:ellipsize="end"
android:lines="1"
android:text="@string/p_item_4"
android:textColor="@color/colorFormText"
android:textSize="@dimen/textsize_medium" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<androidx.cardview.widget.CardView
android:id="@+id/registration_button_parent"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/password_parent"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:elevation="0dp"
app:cardBackgroundColor="@color/colorCheckNo">
<RelativeLayout
android:id="@+id/registration_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ellipsize="end"
android:lines="1"
android:text="@string/registration_title"
android:textColor="@color/colorWhite"
android:textSize="@dimen/textsize_large"
android:textStyle="bold" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment