Fixed signup layout. (#2)

* Fixed signup layout.
This commit is contained in:
Nikola Lukić 2016-11-30 14:49:18 +01:00 committed by Nikola Antic
parent d6d10fed94
commit 8280339ff4
4 changed files with 152 additions and 100 deletions

View File

@ -24,7 +24,11 @@ package com.wolkabout.hexiwear.activity;
import android.support.v7.app.AppCompatActivity;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.wolkabout.hexiwear.R;
@ -60,6 +64,18 @@ public class SignUpActivity extends AppCompatActivity {
@ViewById
CheckBox termsAndConditions;
@ViewById
TextView privacyPolicy;
@ViewById
TextView licenceTerms;
@ViewById
LinearLayout signingUp;
@ViewById
Button signUpButton;
@Bean
Dialog dialog;
@ -68,11 +84,11 @@ public class SignUpActivity extends AppCompatActivity {
@AfterViews
void init() {
termsAndConditions.setMovementMethod(LinkMovementMethod.getInstance());
privacyPolicy.setMovementMethod(LinkMovementMethod.getInstance());
licenceTerms.setMovementMethod(LinkMovementMethod.getInstance());
}
@Click(R.id.signUpButton)
@Background
void signUp() {
if (!validate()) {
return;
@ -83,6 +99,13 @@ public class SignUpActivity extends AppCompatActivity {
return;
}
signUpButton.setEnabled(false);
signingUp.setVisibility(View.VISIBLE);
startSignUp();
}
@Background
void startSignUp() {
final SignUpDto signUpDto = parseUserInput();
try {
authenticationService.signUp(signUpDto);
@ -90,6 +113,13 @@ public class SignUpActivity extends AppCompatActivity {
} catch (Exception e) {
onSignUpError();
}
dismissSigningUpLabel();
}
@UiThread
void dismissSigningUpLabel() {
signUpButton.setEnabled(true);
signingUp.setVisibility(View.GONE);
}
@UiThread

View File

@ -11,111 +11,130 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.SignUpActivity">
<LinearLayout
android:id="@+id/signUpElements"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:orientation="vertical">
<ImageView
android:id="@+id/imageReadingSensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:src="@drawable/logo"/>
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/emailField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_email_hint"
app:textColor="@color/white"
app:type="email"/>
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/passwordField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_password_hint"
app:textColor="@color/white"
app:type="password"/>
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/firstNameField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_first_name"
app:textColor="@color/white"
app:type="name"/>
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/lastNameField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_last_name"
app:textColor="@color/white"
app:type="name"/>
<CheckBox
android:id="@+id/termsAndConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/registration_terms_and_conditions"/>
<Button
android:id="@+id/signUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="@dimen/min_margin"
android:background="@android:color/transparent"
android:gravity="end"
android:text="@string/login_registration"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:id="@+id/signingInElements"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imageReadingTrend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/logo"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/signUpElements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:orientation="vertical">
<TextView
android:id="@+id/signingInLabel"
<ImageView
android:id="@+id/imageReadingSensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:src="@drawable/logo" />
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/emailField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_email_hint"
app:textColor="@color/white"
app:type="email" />
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/passwordField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_password_hint"
app:textColor="@color/white"
app:type="password" />
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/firstNameField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_first_name"
app:textColor="@color/white"
app:type="name" />
<com.wolkabout.hexiwear.view.Input_
android:id="@+id/lastNameField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="@string/registration_last_name"
app:textColor="@color/white"
app:type="name" />
<TextView
android:id="@+id/privacyPolicy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:textSize="16sp"
android:layout_marginTop="24dp"
android:text="@string/registration_privacy_policy"
android:textColor="@color/white" />
<TextView
android:id="@+id/licenceTerms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginTop="16dp"
android:textSize="16sp"
android:text="@string/registration_terms_and_conditions"
android:textColor="@color/white" />
<CheckBox
android:id="@+id/termsAndConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/registration_accept_privacy_and_terms"
android:textColor="@color/white" />
<Button
android:id="@+id/signUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="@dimen/min_margin"
android:background="@android:color/transparent"
android:gravity="end"
android:text="@string/login_registration"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/signingUp"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:elevation="25dp"
android:text="@string/login_signing_in"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:elevation="25dp"
android:text="@string/registration_signing_up"
android:textAppearance="?android:attr/textAppearanceMediumInverse" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -33,7 +33,10 @@
<string name="registration_error_all_fields_required">Please fill in all the registration fields.</string>
<string name="registration_failed">The registration was not successful. Please try again.</string>
<string name="registration_accept_terms">In order to proceed, you need to accept the Terms and conditions.</string>
<string name="registration_terms_and_conditions">I agree with <a href="https://wolksense.com/documents/privacypolicy.html">privacy policy</a> and <a href="https://wolksense.com/documents/termsofservice.html">Terms &amp; Conditions</a></string>
<string name="registration_accept_privacy_and_terms">I agree with privacy policy and Terms &amp; Conditions</string>
<string name="registration_privacy_policy">See <a href="https://wolksense.com/documents/privacypolicy.html">privacy policy</a>.</string>
<string name="registration_terms_and_conditions">See <a href="https://wolksense.com/documents/termsofservice.html">Terms &amp; Conditions</a>.</string>
<string name="registration_signing_up">Signing Up</string>
<!--MAIN ACTIVITY-->
<string name="discovery_available_devices">Available devices</string>

View File

@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}