Can create an account.

This commit is contained in:
Pierre HUBERT
2018-08-07 10:56:25 +02:00
parent 67c4878e95
commit 5e754f24bc
13 changed files with 712 additions and 11 deletions

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:background="@drawable/activity_login_bg">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:text="@string/account_created_title"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:text="@string/account_created_message"
android:textAlignment="center"
android:textColor="@android:color/background_light"
app:layout_constraintBottom_toTopOf="@+id/sign_in_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<Button
android:id="@+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="@string/account_created_sign_in"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<ProgressBar
android:id="@+id/loading_progress"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true" />
<!-- Account creation form -->
<ScrollView
android:id="@+id/create_account_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/activity_login_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="@string/form_create_account_notice"
android:textAlignment="center" />
<TextView
android:id="@+id/error_target"
style="@style/CreateAccountError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="An error occurred while creating the account !" />
<android.support.design.widget.TextInputLayout
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/first_name"
style="@style/CreateAccountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_create_account_first_name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/last_name"
style="@style/CreateAccountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_create_account_last_name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/email"
style="@style/CreateAccountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_create_account_email"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
style="@style/CreateAccountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_create_account_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
style="@style/TextGeneralStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/confirm_password"
style="@style/CreateAccountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_create_account_confirm_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<CheckBox
android:id="@+id/terms_checkbox"
style="@style/CreateAccountInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
style="@style/CreateAccountInput"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:maxLines="10"
android:singleLine="false"
android:text="@string/form_create_account_terms" />
<TextView
android:id="@+id/terms_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="20dp"
android:paddingStart="10dp"
android:text="@string/form_create_account_terms_open"
android:textColor="@android:color/white"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="@+id/submit_button"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_create_account"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</RelativeLayout>

View File

@ -102,6 +102,14 @@
android:layout_marginTop="8dp"
android:text="@string/activity_login_submit_form"/>
<Button
android:id="@+id/btn_create_account"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/action_create_account" />
</LinearLayout>
</ScrollView>

View File

@ -211,4 +211,25 @@
<string name="notif_rejected_group_membership_request">rejected your request to join the group</string>
<string name="preference_crash_reporting_title">Send crash reports</string>
<string name="preference_crash_reporting_summary">Help us improve Comunic by sending anonymous reports when the application crash.</string>
<string name="action_create_account">Create an account</string>
<string name="activity_create_account_label">New account</string>
<string name="form_create_account_notice">Please fill the following fields to create your account:</string>
<string name="form_create_account_first_name">First name</string>
<string name="form_create_account_last_name">Last name</string>
<string name="form_create_account_email">Your email address</string>
<string name="form_create_account_password">Password</string>
<string name="form_create_account_confirm_password">Repeat password</string>
<string name="form_create_account_terms">I have read and accepted the terms of use of Comunic.</string>
<string name="form_create_account_terms_open">Open</string>
<string name="err_invalid_first_name">Specified first name is invalid!</string>
<string name="err_invalid_last_name">Please specify a valid last name.</string>
<string name="err_no_email">Please specify an email address!</string>
<string name="err_invalid_email">Please specify a valid email address!</string>
<string name="err_invalid_password">Please specify a valid password!</string>
<string name="err_password_confirmation_not_identical">The password and its confirmation are not the same!</string>
<string name="err_need_accept_terms">Please accept the terms of use of Comunic !</string>
<string name="err_while_creating_account">An error occurred while trying to create your account! Maybe an account with the same email address already exists!</string>
<string name="account_created_title">Congratulations</string>
<string name="account_created_message">Your account has been created. You can now sign into your new account to use all the features of Comunic.</string>
<string name="account_created_sign_in">Sign in</string>
</resources>

View File

@ -21,6 +21,31 @@
<item name="android:textColorHighlight">@android:color/white</item>
</style>
<!-- Create account activity -->
<!-- Error -->
<style name="CreateAccountError">
<item name="android:textColor">@android:color/holo_red_light</item>
<item name="android:textAlignment">center</item>
</style>
<!-- Texts general style -->
<style name="TextGeneralStyle">
<item name="android:textColor">@android:color/white</item>
<item name="android:textColorHint">@android:color/white</item>
<item name="android:textColorLink">@android:color/white</item>
<item name="android:textColorHighlight">@android:color/white</item>
</style>
<!-- Inputs general style -->
<style name="CreateAccountInput" parent="TextGeneralStyle">
<item name="android:maxLines">1</item>
<item name="android:singleLine">true</item>
<item name="android:layout_marginBottom">5dp</item>
</style>
<!-- User page fragment -->
<!-- User page header -->
<style name="UserPageHeader">