Skip to content

Commit 21df8b3

Browse files
authored
Move ToS/PP into scrollviews (#1302)
1 parent 670b363 commit 21df8b3

8 files changed

+50
-61
lines changed

auth/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
android:name=".ui.email.EmailActivity"
4040
android:label="@string/fui_sign_in_default"
4141
android:exported="false"
42-
android:windowSoftInputMode="adjustPan" />
42+
android:windowSoftInputMode="adjustResize" />
4343

4444
<activity
4545
android:name=".ui.phone.PhoneActivity"
4646
android:label="@string/fui_sign_in_with_phone_number"
4747
android:exported="false"
48-
android:windowSoftInputMode="adjustPan|stateAlwaysVisible" />
48+
android:windowSoftInputMode="adjustResize|stateAlwaysVisible" />
4949

5050
<activity
5151
android:name=".ui.idp.WelcomeBackIdpPrompt"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
100100

101101
view.findViewById(R.id.button_next).setOnClickListener(this);
102102

103-
TextView termsText = view.<TextView>findViewById(R.id.email_tos_and_pp_text);
104-
TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text);
103+
TextView termsText = view.findViewById(R.id.email_tos_and_pp_text);
104+
TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text);
105105
FlowParameters flowParameters = getFlowParams();
106+
106107
if (flowParameters.isSingleProviderFlow()) {
107108
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(getContext(),
108109
getFlowParams(),
109110
termsText);
110111
} else {
112+
termsText.setVisibility(View.GONE);
111113
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(),
112114
getFlowParams(),
113115
footerText);

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
146146
mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
147147
}
148148

149-
if (savedInstanceState != null) { return; }
149+
TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text);
150+
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText);
151+
152+
// WARNING: Nothing below this line will be executed on rotation
153+
if (savedInstanceState != null) {
154+
return;
155+
}
150156

151157
// If email is passed in, fill in the field and move down to the name field.
152158
String email = mUser.getEmail();
@@ -168,9 +174,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
168174
} else {
169175
safeRequestFocus(mEmailEditText);
170176
}
171-
172-
TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text);
173-
PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText);
174177
}
175178

176179
private void safeRequestFocus(final View v) {

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
3-
<android.support.constraint.ConstraintLayout
2+
<FrameLayout
43
xmlns:android="http://schemas.android.com/apk/res/android"
54
xmlns:app="http://schemas.android.com/apk/res-auto"
65
xmlns:tools="http://schemas.android.com/tools"
@@ -47,20 +46,12 @@
4746
android:textIsSelectable="false"
4847
tools:text="Terms and Privacy Policy" />
4948

49+
<TextView
50+
android:id="@+id/email_footer_tos_and_pp_text"
51+
style="@style/FirebaseUI.PrivacyFooter" />
52+
5053
</LinearLayout>
5154

5255
</ScrollView>
5356

54-
<TextView
55-
android:id="@+id/email_footer_tos_and_pp_text"
56-
android:layout_width="match_parent"
57-
android:layout_height="wrap_content"
58-
android:layout_marginTop="@dimen/fui_field_padding_vert"
59-
android:paddingLeft="16dp"
60-
android:paddingRight="16dp"
61-
android:paddingBottom="16dp"
62-
android:gravity="end"
63-
android:textIsSelectable="true"
64-
app:layout_constraintBottom_toBottomOf="parent" />
65-
66-
</android.support.constraint.ConstraintLayout>
57+
</FrameLayout>

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
32
<android.support.constraint.ConstraintLayout
43
xmlns:android="http://schemas.android.com/apk/res/android"
54
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -95,24 +94,19 @@
9594
tools:text="Resend code" />
9695

9796
<android.support.constraint.Barrier
97+
android:id="@+id/resend_barrier"
9898
android:layout_width="0dp"
9999
android:layout_height="0dp"
100100
app:barrierDirection="bottom"
101101
app:constraint_referenced_ids="ticker,resend_code" />
102102

103+
<TextView
104+
android:id="@+id/email_footer_tos_and_pp_text"
105+
app:layout_constraintTop_toBottomOf="@+id/resend_barrier"
106+
style="@style/FirebaseUI.PrivacyFooter" />
107+
103108
</android.support.constraint.ConstraintLayout>
104109

105110
</ScrollView>
106111

107-
<TextView
108-
android:id="@+id/email_footer_tos_and_pp_text"
109-
android:layout_width="match_parent"
110-
android:layout_height="wrap_content"
111-
android:layout_marginTop="@dimen/fui_field_padding_vert"
112-
android:paddingLeft="16dp"
113-
android:paddingRight="16dp"
114-
android:paddingBottom="16dp"
115-
android:gravity="end"
116-
android:textIsSelectable="true"
117-
app:layout_constraintBottom_toBottomOf="parent" />
118112
</android.support.constraint.ConstraintLayout>

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,14 @@
5353
android:textIsSelectable="false"
5454
app:layout_constraintTop_toBottomOf="@+id/send_code" />
5555

56+
<TextView
57+
android:id="@+id/email_footer_tos_and_pp_text"
58+
style="@style/FirebaseUI.PrivacyFooter"
59+
app:layout_constraintTop_toBottomOf="@+id/send_sms_tos" />
60+
5661
</android.support.constraint.ConstraintLayout>
5762

5863
</ScrollView>
5964

60-
<TextView
61-
android:id="@+id/email_footer_tos_and_pp_text"
62-
android:layout_width="match_parent"
63-
android:layout_height="wrap_content"
64-
android:layout_marginTop="@dimen/fui_field_padding_vert"
65-
android:paddingLeft="16dp"
66-
android:paddingRight="16dp"
67-
android:paddingBottom="16dp"
68-
android:gravity="end"
69-
android:textIsSelectable="true"
70-
app:layout_constraintBottom_toBottomOf="parent" />
7165
</android.support.constraint.ConstraintLayout>
7266

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.constraint.ConstraintLayout
2+
<FrameLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
xmlns:tools="http://schemas.android.com/tools"
@@ -8,7 +8,10 @@
88

99
<ScrollView
1010
android:layout_width="match_parent"
11-
android:layout_height="match_parent">
11+
android:layout_height="match_parent"
12+
android:layout_marginTop="8dp"
13+
android:paddingBottom="16dp"
14+
android:clipToPadding="false">
1215

1316
<LinearLayout
1417
style="@style/FirebaseUI.WrapperStyle"
@@ -68,21 +71,14 @@
6871
style="@style/FirebaseUI.Button"
6972
android:text="@string/fui_button_text_save"
7073
tools:ignore="RtlHardcoded" />
74+
75+
<TextView
76+
android:id="@+id/email_footer_tos_and_pp_text"
77+
style="@style/FirebaseUI.PrivacyFooter" />
78+
7179
</LinearLayout>
7280

7381
</ScrollView>
7482

75-
<TextView
76-
android:id="@+id/email_footer_tos_and_pp_text"
77-
android:layout_width="match_parent"
78-
android:layout_height="wrap_content"
79-
android:layout_marginTop="@dimen/fui_field_padding_vert"
80-
android:paddingLeft="16dp"
81-
android:paddingRight="16dp"
82-
android:paddingBottom="16dp"
83-
android:gravity="end"
84-
android:textIsSelectable="true"
85-
app:layout_constraintBottom_toBottomOf="parent" />
86-
87-
</android.support.constraint.ConstraintLayout>
83+
</FrameLayout>
8884

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,13 @@
230230
<item name="android:textColor">#FFFFFFFF</item>
231231
</style>
232232

233+
<style name="FirebaseUI.PrivacyFooter">
234+
<item name="android:layout_width">match_parent</item>
235+
<item name="android:layout_height">wrap_content</item>
236+
<item name="android:layout_marginTop">16dp</item>
237+
<item name="android:paddingBottom">16dp</item>
238+
<item name="android:gravity">end</item>
239+
<item name="android:textIsSelectable">true</item>
240+
</style>
241+
233242
</resources>

0 commit comments

Comments
 (0)