Refactor login module (#151)
This commit is contained in:

committed by
Mikołaj Pich

parent
64b0919b7f
commit
a90d5cb9c3
9
app/src/main/res/drawable/ic_login_person_24px.xml
Normal file
9
app/src/main/res/drawable/ic_login_person_24px.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 2c-2.7 0-8 1.3-8 4v2h16v-2c0-2.7-5.3-4-8-4z" />
|
||||
</vector>
|
@ -1,137 +1,11 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/login_activity_container"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="io.github.wulkanowy.ui.login.LoginActivity">
|
||||
android:id="@+id/loginContainer">
|
||||
|
||||
<!-- Login progress -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/login_activity_progress_container"
|
||||
<com.aurelhubert.ahbottomnavigation.AHBottomNavigationViewPager
|
||||
android:id="@+id/loginViewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/login_activity_progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/login_activity_progress_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:indeterminate="true"
|
||||
android:minHeight="30dp"
|
||||
android:minWidth="220dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_activity_progress_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="@string/app_name" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/login_activity_form_scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/login_activity_form_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/login_heading" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/login_activity_email_text_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_email"
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_activity_email_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/login_activity_pass_text_input"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/prompt_password"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_activity_pass_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:imeActionLabel="@string/action_sign_in"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/login_activity_symbol_text_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_symbol"
|
||||
android:visibility="gone">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/login_activity_symbol_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeActionLabel="@string/action_sign_in"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textAutoComplete"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_activity_sign_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_sign_in"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_activity_create_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/action_create_account" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_activity_forgot_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_forgot_password" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
129
app/src/main/res/layout/fragment_login_form.xml
Normal file
129
app/src/main/res/layout/fragment_login_form.xml
Normal file
@ -0,0 +1,129 @@
|
||||
<RelativeLayout 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">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loginFormProgressContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/loginFormProgressText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:indeterminate="true"
|
||||
android:minHeight="30dp"
|
||||
android:minWidth="220dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginFormProgressText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="@string/step_login" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/loginScroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loginFormContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/login_heading"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loginMainForm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:hint="@string/prompt_email">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/loginEmailEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_password">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/loginPassEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeActionLabel="@string/action_sign_in"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
app:fontFamily="sans-serif" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/loginSymbolInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_symbol"
|
||||
android:visibility="gone">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/loginSymbolEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeActionLabel="@string/action_sign_in"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textAutoComplete"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/loginSignButton"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/action_sign_in"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
app:backgroundTint="@color/colorPrimary" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
50
app/src/main/res/layout/fragment_login_opions_item.xml
Normal file
50
app/src/main/res/layout/fragment_login_opions_item.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="wrap_content"
|
||||
android:background="@drawable/ic_border"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/loginItemImage"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerVertical="true"
|
||||
app:srcCompat="@drawable/ic_login_person_24px" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@id/loginItemImage"
|
||||
android:layout_toRightOf="@id/loginItemImage">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginItemName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginItemSchool"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/loginItemName"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
37
app/src/main/res/layout/fragment_login_options.xml
Normal file
37
app/src/main/res/layout/fragment_login_options.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loginOptionsProgressContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/loginOptionsProgressText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:indeterminate="true"
|
||||
android:minHeight="30dp"
|
||||
android:minWidth="220dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginOptionsProgressText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="@string/step_synchronization" />
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/loginOptionsRecycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
@ -3,7 +3,8 @@
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="title_activity_login">Zaloguj się</string>
|
||||
<string name="login_heading">Zaloguj się za pomocą konta VULCAN</string>
|
||||
<string name="login_heading">Zaloguj się za pomocą konta ucznia lub rodzica</string>
|
||||
<string name="login_heading_symbol">Podaj symbol dziennika VULCAN</string>
|
||||
<string name="prompt_email">Email</string>
|
||||
<string name="prompt_password">Hasło</string>
|
||||
<string name="prompt_symbol">Symbol</string>
|
||||
@ -14,6 +15,7 @@
|
||||
<string name="error_invalid_email">Ten adres email nie jest poprawny</string>
|
||||
<string name="error_invalid_password">To hasło jest za krótkie</string>
|
||||
<string name="error_incorrect_password">To hasło jest niepoprawne</string>
|
||||
<string name="error_incorrect_symbol">Nie znaleziono ucznia. Sprwadź symbol</string>
|
||||
<string name="error_field_required">To pole jest wymagane</string>
|
||||
<string name="error_bad_account_permission">Brak dostępu do dziennika. Sprawdź inny symbol</string>
|
||||
<string name="login_accepted_text">Pomyślnie zalogowano</string>
|
||||
@ -22,6 +24,7 @@
|
||||
<string name="login_failed_text">Logowanie nie powiodło się. Spróbuj ponownie lub zrestartuj aplikację</string>
|
||||
<string name="action_create_account">Nie masz jeszcze konta? Załóż je</string>
|
||||
<string name="action_forgot_password">Zapomniałeś hasła?</string>
|
||||
<string name="login_options_header">Wybierz ucznia</string>
|
||||
|
||||
<string name="color_black_text">Czarny</string>
|
||||
<string name="color_red_text">Czerwony</string>
|
||||
|
@ -3,17 +3,19 @@
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="title_activity_login">Sign in</string>
|
||||
<string name="login_heading">Sign in with VULCAN account</string>
|
||||
<string name="login_heading">Sign in with student or parent account</string>
|
||||
<string name="login_heading_symbol">Enter the VULCAN diary symbol</string>
|
||||
<string name="prompt_email">Email</string>
|
||||
<string name="prompt_password">Password</string>
|
||||
<string name="prompt_symbol">Symbol</string>
|
||||
<string name="action_sign_in">Sign in</string>
|
||||
<string name="step_connecting">Connecting with log</string>
|
||||
<string name="step_login">Login</string>
|
||||
<string name="step_synchronization">Synchronization</string>
|
||||
<string name="step_login">Login…</string>
|
||||
<string name="step_synchronization">Synchronization…</string>
|
||||
<string name="error_invalid_email">This email address is invalid</string>
|
||||
<string name="error_invalid_password">This password is too short</string>
|
||||
<string name="error_incorrect_password">This password is incorrect</string>
|
||||
<string name="error_incorrect_symbol">No student found. Check the symbol</string>
|
||||
<string name="error_field_required">This field is required</string>
|
||||
<string name="error_bad_account_permission">No permission to open log. Check another symbol</string>
|
||||
<string name="login_accepted_text">Login is successful</string>
|
||||
@ -22,6 +24,7 @@
|
||||
<string name="login_failed_text">Login is failed. Try again or restart the app</string>
|
||||
<string name="action_create_account">No account yet? Create one</string>
|
||||
<string name="action_forgot_password">Forgot password?</string>
|
||||
<string name="login_options_header">Select student</string>
|
||||
|
||||
<string name="color_black_text">Black</string>
|
||||
<string name="color_red_text">Red</string>
|
||||
|
Reference in New Issue
Block a user