Skip to content

Commit 6d6b4c0

Browse files
authored
Merge pull request firebase#4 from JosefHruska/master
Fix password prompt layout.
2 parents f53fdae + 67d9b03 commit 6d6b4c0

File tree

8 files changed

+119
-66
lines changed

8 files changed

+119
-66
lines changed

auth/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<activity
3333
android:name=".ui.email.RecoverPasswordActivity"
3434
android:label="@string/title_recover_password_activity"
35+
android:windowSoftInputMode="adjustResize|stateAlwaysVisible"
3536
android:exported="false"/>
3637

3738
<activity
@@ -42,7 +43,7 @@
4243

4344
<activity
4445
android:name=".ui.accountlink.WelcomeBackIdpPrompt"
45-
android:label="@string/title_welcome_back_idp_prompt"
46+
android:label="@string/sign_in_with_email"
4647
android:windowSoftInputMode="adjustResize"
4748
android:exported="false"/>
4849

auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static Intent createIntent(
7474
protected void onCreate(Bundle savedInstanceState) {
7575
super.onCreate(savedInstanceState);
7676
setContentView(R.layout.welcome_back_idp_prompt_layout);
77+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
7778

7879
IdpResponse newUserIdpResponse = IdpResponse.fromResultIntent(getIntent());
7980
mPrevCredential = AuthCredentialHelper.getAuthCredential(newUserIdpResponse);

auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
import android.text.SpannableStringBuilder;
2727
import android.text.TextUtils;
2828
import android.text.style.StyleSpan;
29+
import android.view.KeyEvent;
2930
import android.view.View;
3031
import android.view.WindowManager;
32+
import android.view.inputmethod.EditorInfo;
3133
import android.widget.EditText;
3234
import android.widget.TextView;
3335

@@ -77,6 +79,7 @@ public static Intent createIntent(
7779
protected void onCreate(Bundle savedInstanceState) {
7880
super.onCreate(savedInstanceState);
7981
setContentView(R.layout.welcome_back_password_prompt_layout);
82+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
8083

8184
// Show keyboard
8285
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
@@ -87,6 +90,17 @@ protected void onCreate(Bundle savedInstanceState) {
8790

8891
mPasswordLayout = (TextInputLayout) findViewById(R.id.password_layout);
8992
mPasswordField = (EditText) findViewById(R.id.password);
93+
mPasswordField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
94+
@Override
95+
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
96+
if (actionId == EditorInfo.IME_ACTION_DONE) {
97+
onClick(findViewById(R.id.button_done));
98+
return true;
99+
} else {
100+
return false;
101+
}
102+
}
103+
});
90104

91105
// Create welcome back text with email bolded
92106
String bodyText = getString(R.string.welcome_back_password_prompt_body, mEmail);

auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
import android.support.annotation.NonNull;
2121
import android.support.annotation.RestrictTo;
2222
import android.support.design.widget.TextInputLayout;
23+
import android.view.KeyEvent;
2324
import android.view.View;
25+
import android.view.inputmethod.EditorInfo;
2426
import android.widget.EditText;
27+
import android.widget.TextView;
2528

2629
import com.firebase.ui.auth.R;
2730
import com.firebase.ui.auth.ui.AppCompatBase;
@@ -53,10 +56,22 @@ public static Intent createIntent(Context context, FlowParameters flowParams, St
5356
protected void onCreate(Bundle savedInstanceState) {
5457
super.onCreate(savedInstanceState);
5558
setContentView(R.layout.forgot_password_layout);
59+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
5660

5761
mEmailFieldValidator =
5862
new EmailFieldValidator((TextInputLayout) findViewById(R.id.email_layout));
5963
mEmailEditText = (EditText) findViewById(R.id.email);
64+
mEmailEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
65+
@Override
66+
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
67+
if (actionId == EditorInfo.IME_ACTION_DONE) {
68+
onClick(findViewById(R.id.button_done));
69+
return true;
70+
} else {
71+
return false;
72+
}
73+
}
74+
});
6075

6176
String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL);
6277
if (email != null) {

auth/src/main/res/layout/forgot_password_layout.xml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
style="@style/FirebaseUI.Text.BodyText"
1212
android:text="@string/password_recovery_body"
1313
android:paddingLeft="32dp"
14-
android:paddingRight="32dp"/>
14+
android:paddingRight="32dp"
15+
android:textColor="@color/gray_3"
16+
android:gravity="center"
17+
android:textSize="16sp"
18+
android:lineSpacingExtra="5sp"/>
1519

1620
<android.support.design.widget.TextInputLayout
1721
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -28,21 +32,16 @@
2832

2933
<android.support.design.widget.TextInputEditText
3034
style="@style/FirebaseUI.EditText.EmailField"
31-
android:id="@+id/email"/>
35+
android:id="@+id/email"
36+
android:imeOptions="actionDone"/>
3237

3338
</android.support.design.widget.TextInputLayout>
3439

35-
<LinearLayout
36-
android:layout_height="wrap_content"
37-
android:layout_width="match_parent"
38-
android:gravity="end"
39-
android:paddingTop="194dp">
40-
41-
<Button
42-
style="@style/FirebaseUI.FullWidthButtonSettleUp"
43-
android:id="@+id/button_done"
44-
android:text="@string/button_text_send"/>
45-
46-
</LinearLayout>
40+
<Button
41+
style="@style/FirebaseUI.FullWidthButtonSettleUp"
42+
android:id="@+id/button_done"
43+
android:text="@string/button_text_send"
44+
android:background="@color/authui_colorAccent"
45+
android:layout_alignParentBottom="true"/>
4746

4847
</RelativeLayout>

auth/src/main/res/layout/welcome_back_idp_prompt_layout.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
style="@style/FirebaseUI.WrapperStyle"
55
android:paddingLeft="0dp"
@@ -23,9 +23,8 @@
2323
<Button
2424
android:id="@+id/welcome_back_idp_button"
2525
style="@style/FirebaseUI.FullWidthButtonSettleUp"
26-
android:layout_alignParentBottom="true"
2726
android:layout_gravity="bottom"
2827
android:background="@color/authui_colorAccent"
2928
android:text="@string/sign_in_default" />
3029

31-
</RelativeLayout>
30+
</FrameLayout>
Lines changed: 70 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,87 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout
2+
<FrameLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:orientation="vertical"
54
android:layout_width="match_parent"
6-
android:layout_height="match_parent"
7-
style="@style/FirebaseUI.WrapperStyle">
5+
android:layout_height="match_parent">
86

9-
<TextView
10-
android:layout_width="match_parent"
11-
android:layout_height="wrap_content"
12-
style="@style/FirebaseUI.Text.Heading"
13-
android:text="@string/welcome_back_email_header"/>
14-
15-
<TextView
16-
style="@style/FirebaseUI.Text.BodyText"
17-
android:id="@+id/welcome_back_password_body"/>
18-
19-
<RelativeLayout
7+
<!-- Screen content has to be wrapped to scrollview to make screen resizing working. -->
8+
<ScrollView
209
android:layout_width="match_parent"
2110
android:layout_height="wrap_content">
2211

23-
<android.support.design.widget.TextInputLayout
24-
android:id="@+id/password_layout"
25-
xmlns:app="http://schemas.android.com/apk/res-auto"
26-
style="@style/FirebaseUI.Text.TextInputLayout"
27-
android:paddingTop="16dp"
28-
app:hintTextAppearance="@style/FirebaseUI.Text.HintText"
29-
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
12+
<LinearLayout
13+
android:orientation="vertical"
3014
android:layout_width="match_parent"
3115
android:layout_height="wrap_content"
32-
app:passwordToggleEnabled="true">
16+
style="@style/FirebaseUI.WrapperStyle">
3317

34-
<android.support.design.widget.TextInputEditText
35-
style="@style/FirebaseUI.EditText.PasswordField"
36-
android:id="@+id/password"
37-
android:hint="@string/password_hint"/>
18+
<TextView
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
style="@style/FirebaseUI.Text.Heading"
22+
android:text="@string/welcome_back_email_header"/>
3823

39-
</android.support.design.widget.TextInputLayout>
24+
<TextView
25+
style="@style/FirebaseUI.Text.BodyText"
26+
android:id="@+id/welcome_back_password_body"/>
4027

41-
</RelativeLayout>
28+
<RelativeLayout
29+
android:layout_width="match_parent"
30+
android:layout_height="wrap_content">
4231

43-
<LinearLayout
44-
android:layout_height="wrap_content"
45-
android:layout_width="match_parent"
46-
android:paddingTop="16dp">
32+
<android.support.design.widget.TextInputLayout
33+
android:id="@+id/password_layout"
34+
xmlns:app="http://schemas.android.com/apk/res-auto"
35+
style="@style/FirebaseUI.Text.TextInputLayout"
36+
android:paddingTop="16dp"
37+
app:hintTextAppearance="@style/FirebaseUI.Text.HintText"
38+
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
39+
android:layout_width="match_parent"
40+
android:layout_height="wrap_content"
41+
app:passwordToggleEnabled="true">
4742

48-
<TextView
49-
android:id="@+id/trouble_signing_in"
50-
android:text="@string/trouble_signing_in"
51-
android:layout_width="0dp"
52-
android:layout_height="wrap_content"
53-
android:layout_weight="1"
54-
style="@style/FirebaseUI.Text.Link"/>
43+
<android.support.design.widget.TextInputEditText
44+
style="@style/FirebaseUI.EditText.PasswordField"
45+
android:id="@+id/password"
46+
android:hint="@string/password_hint"
47+
android:imeOptions="actionDone"/>
48+
49+
</android.support.design.widget.TextInputLayout>
50+
51+
</RelativeLayout>
52+
53+
<LinearLayout
54+
android:layout_height="wrap_content"
55+
android:layout_width="match_parent"
56+
android:paddingTop="8dp">
57+
58+
<TextView
59+
android:id="@+id/trouble_signing_in"
60+
android:text="@string/trouble_signing_in"
61+
android:layout_width="0dp"
62+
android:layout_height="wrap_content"
63+
android:layout_weight="1"
64+
style="@style/FirebaseUI.Text.Link"
65+
android:paddingTop="16dp"
66+
android:paddingBottom="16dp"
67+
android:textColor="@color/authui_colorAccent"
68+
android:textSize="14sp"
69+
android:gravity="center"
70+
android:textAllCaps="true"
71+
android:fontFamily="sans-serif-medium"
72+
android:layout_gravity="center"
73+
android:background="@drawable/ripple_background"/>
74+
75+
</LinearLayout>
76+
77+
</LinearLayout>
5578

56-
<Button
57-
style="@style/FirebaseUI.FullWidthButtonSettleUp"
58-
android:text="@string/sign_in_default"
59-
android:id="@+id/button_done"/>
79+
</ScrollView>
6080

61-
</LinearLayout>
81+
<Button
82+
style="@style/FirebaseUI.FullWidthButtonSettleUp"
83+
android:text="@string/sign_in_default"
84+
android:id="@+id/button_done"
85+
android:background="@color/authui_colorAccent"/>
6286

63-
</LinearLayout>
87+
</FrameLayout>

auth/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<string name="progress_dialog_checking_accounts">Checking for existing accounts…</string>
2929

3030
<!-- Email sign up -->
31-
<string name="title_register_email">Sign up with email</string>
31+
<string name="title_register_email">Sign up</string>
3232
<string name="name_hint">First &amp; last name</string>
3333
<string name="button_text_save">Save</string>
3434
<string name="progress_dialog_signing_up">Signing up…</string>
@@ -74,5 +74,5 @@
7474
<string name="auth_picker_description">Sign in to allow for backup\nand synchronization\nof your groups.</string>
7575
<string name="sign_up">Sign up</string>
7676
<string name="idp_name_email">Email</string>
77-
77+
7878
</resources>

0 commit comments

Comments
 (0)