Clean login layout button style

- It was hard to edit
- The size of the buttons where a little weird
- The logo at the top with weird padding hide fields in small screen sizes
This commit is contained in:
Daniel Gomez Rico 2016-10-20 12:46:18 -05:00
parent 76818c4f3d
commit 68ac51a5ff
3 changed files with 93 additions and 220 deletions

View file

@ -1,218 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login.linear.layout"
android:gravity="center"
android:paddingTop="40dp"
android:paddingBottom="40dp"
android:orientation="vertical"
android:shrinkColumns="0"
android:layout_gravity="center_horizontal">
<TableRow
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_gravity="center">
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_gryphon"
android:layout_span="2" />
</TableRow>
<TableRow
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/ic_habitica"
android:layout_span="2" />
</TableRow>
<TableRow
android:id="@+id/username_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/LoginRow">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:id="@+id/imageView4"
android:src="@drawable/ic_username"
android:layout_gravity="center"
android:layout_marginRight="4dp" />
<EditText
android:id="@+id/username"
android:layout_width="@dimen/login_field_width"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="@string/username"
/>
</TableRow>
<TableRow
android:id="@+id/email_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/LoginRow">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:id="@+id/imageView5"
android:src="@drawable/ic_email"
android:layout_gravity="center"
android:layout_marginRight="4dp" />
<EditText
android:id="@+id/email"
android:layout_width="@dimen/login_field_width"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="@string/emailAddress" />
</TableRow>
<TableRow
android:id="@+id/password_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/LoginRow">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:id="@+id/imageView6"
android:src="@drawable/ic_password"
android:layout_gravity="center"
android:layout_marginRight="4dp" />
<EditText
android:id="@+id/password"
android:layout_width="@dimen/login_field_width"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="@string/password"
/>
</TableRow>
android:padding="@dimen/spacing_large"
android:id="@+id/login.linear.layout"
android:orientation="vertical">
<TableRow
android:id="@+id/confirm_password_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/LoginRow">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:drawableLeft="@drawable/ic_username"
android:drawableStart="@drawable/ic_username"
android:drawablePadding="@dimen/spacing_large"
android:imeOptions="actionNext"
android:hint="@string/username"/>
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:id="@+id/imageView7"
android:src="@drawable/ic_password"
android:layout_gravity="center"
android:layout_marginRight="4dp" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:singleLine="true"
android:imeOptions="actionNext"
android:drawableLeft="@drawable/ic_email"
android:drawableStart="@drawable/ic_email"
android:drawablePadding="@dimen/spacing_large"
android:hint="@string/emailAddress"/>
<EditText
android:id="@+id/confirm_password"
android:layout_width="@dimen/login_field_width"
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/confirmpassword" />
</TableRow>
android:singleLine="true"
android:imeOptions="actionNext"
android:drawableLeft="@drawable/ic_email"
android:drawableStart="@drawable/ic_email"
android:drawablePadding="@dimen/spacing_large"
android:hint="@string/password"/>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="16dp">
<EditText
android:id="@+id/confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:drawableLeft="@drawable/ic_email"
android:drawableStart="@drawable/ic_email"
android:drawablePadding="@dimen/spacing_large"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/confirmpassword"/>
<Button
android:id="@+id/login_btn"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="@string/register_btn"
android:layout_gravity="center_horizontal"
android:textColor="@color/white"
android:background="@drawable/rounded_purple_square"
android:layout_span="2"
android:layout_marginBottom="8dp"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ProgressBar
android:id="@+id/PB_AsyncTask"
android:indeterminate="true"
android:visibility="gone"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
<ProgressBar
android:id="@+id/PB_AsyncTask"
android:indeterminate="true"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_gravity="center"/>
android:layout_span="2"/>
</TableRow>
<TableRow
<Button
android:id="@+id/login_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<com.google.android.gms.common.SignInButton
android:id="@+id/google_login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:text="@string/register_btn"
android:layout_gravity="center_horizontal"
android:textColor="@color/white"
android:layout_marginTop="@dimen/spacing_xlarge"
android:background="@drawable/rounded_purple_square"/>
android:layout_span="2"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.google.android.gms.common.SignInButton
android:id="@+id/google_login_button"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/spacing_large"
app:buttonSize="wide"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<TextView
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/forgot_pw_tv"
android:layout_width="250dp"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_large"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:text="@string/forgot_pw_tv"
android:layout_gravity="center_horizontal"
android:textColor="@color/best_10"
android:layout_span="2"
/>
</TableRow>
</TableLayout>
android:textColor="@color/best_10"/>
</LinearLayout>
</ScrollView>

View file

@ -55,7 +55,6 @@
<dimen name="checkbox_size">30dp</dimen>
<dimen name="checkbox_compact_size">25dp</dimen>
<dimen name="login_field_width">350dp</dimen>
<dimen name="task_top_bottom_padding">20dp</dimen>
<dimen name="task_top_bottom_compact_padding">16dp</dimen>
<dimen name="reward_spacing">8dp</dimen>
@ -84,4 +83,8 @@
<dimen name="habit_circle_background_size">40dp</dimen>
<dimen name="bar_size_slim">13dp</dimen>
<dimen name="widget_rounding">5dp</dimen>
<dimen name="spacing_small">4dp</dimen>
<dimen name="spacing_large">16dp</dimen>
<dimen name="spacing_medium">8dp</dimen>
<dimen name="spacing_xlarge">32dp</dimen>
</resources>

View file

@ -4,18 +4,10 @@ import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.AccountPicker;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.Scopes;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Scope;
import com.amplitude.api.Amplitude;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
@ -44,7 +36,6 @@ import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.PreferenceManager;
@ -58,7 +49,6 @@ import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TableRow;
import android.widget.TextView;
import java.io.IOException;
@ -71,11 +61,8 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.exceptions.Exceptions;
import rx.functions.Action1;
import rx.functions.Func0;
import rx.schedulers.Schedulers;
/**
* @author Mickael Goubin
@ -108,10 +95,6 @@ public class LoginActivity extends BaseActivity
EditText mEmail;
@BindView(R.id.confirm_password)
EditText mConfirmPassword;
@BindView(R.id.email_row)
TableRow mEmailRow;
@BindView(R.id.confirm_password_row)
TableRow mConfirmPasswordRow;
@BindView(R.id.login_button)
LoginButton mFacebookLoginBtn;
@BindView(R.id.forgot_pw_tv)
@ -180,18 +163,18 @@ public class LoginActivity extends BaseActivity
private void resetLayout() {
if (this.isRegistering) {
if (this.mEmailRow.getVisibility() == View.GONE) {
show(this.mEmailRow);
if (this.mEmail.getVisibility() == View.GONE) {
show(this.mEmail);
}
if (this.mConfirmPasswordRow.getVisibility() == View.GONE) {
show(this.mConfirmPasswordRow);
if (this.mEmail.getVisibility() == View.GONE) {
show(this.mEmail);
}
} else {
if (this.mEmailRow.getVisibility() == View.VISIBLE) {
hide(this.mEmailRow);
if (this.mEmail.getVisibility() == View.VISIBLE) {
hide(this.mEmail);
}
if (this.mConfirmPasswordRow.getVisibility() == View.VISIBLE) {
hide(this.mConfirmPasswordRow);
if (this.mEmail.getVisibility() == View.VISIBLE) {
hide(this.mEmail);
}
}
}