Skip to content

Commit d688455

Browse files
committed
Remove dialog from welcomeback screens
Change-Id: I5b39edaa31002baa1352628b818ff46b55f28fbf
1 parent 2fec554 commit d688455

File tree

8 files changed

+144
-70
lines changed

8 files changed

+144
-70
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
import android.text.style.StyleSpan;
3131
import android.view.View;
3232
import android.view.WindowManager;
33+
import android.widget.Button;
3334
import android.widget.EditText;
35+
import android.widget.ProgressBar;
3436
import android.widget.TextView;
3537

3638
import com.firebase.ui.auth.IdpResponse;
@@ -55,6 +57,8 @@ public class WelcomeBackPasswordPrompt extends AppCompatBase
5557
private IdpResponse mIdpResponse;
5658
private WelcomeBackPasswordHandler mHandler;
5759

60+
private Button mDoneButton;
61+
private ProgressBar mProgressBar;
5862
private TextInputLayout mPasswordLayout;
5963
private EditText mPasswordField;
6064

@@ -75,6 +79,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7579
mIdpResponse = IdpResponse.fromResultIntent(getIntent());
7680
String email = mIdpResponse.getEmail();
7781

82+
mDoneButton = findViewById(R.id.button_done);
83+
mProgressBar = findViewById(R.id.top_progress_bar);
7884
mPasswordLayout = findViewById(R.id.password_layout);
7985
mPasswordField = findViewById(R.id.password);
8086

@@ -95,7 +101,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
95101
bodyTextView.setText(spannableStringBuilder);
96102

97103
// Click listeners
98-
findViewById(R.id.button_done).setOnClickListener(this);
104+
mDoneButton.setOnClickListener(this);
99105
findViewById(R.id.trouble_signing_in).setOnClickListener(this);
100106

101107
// Initialize ViewModel with arguments
@@ -165,4 +171,16 @@ public void onClick(View view) {
165171
onForgotPasswordClicked();
166172
}
167173
}
174+
175+
@Override
176+
public void showProgress(int message) {
177+
mDoneButton.setEnabled(false);
178+
mProgressBar.setVisibility(View.VISIBLE);
179+
}
180+
181+
@Override
182+
public void hideProgress() {
183+
mDoneButton.setEnabled(true);
184+
mProgressBar.setVisibility(View.INVISIBLE);
185+
}
168186
}

auth/src/main/java/com/firebase/ui/auth/ui/idp/SingleSignInActivity.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.os.Bundle;
88
import android.support.annotation.NonNull;
99
import android.support.annotation.Nullable;
10+
import android.support.annotation.RestrictTo;
1011

1112
import com.firebase.ui.auth.AuthUI;
1213
import com.firebase.ui.auth.ErrorCodes;
@@ -18,7 +19,7 @@
1819
import com.firebase.ui.auth.data.remote.FacebookSignInHandler;
1920
import com.firebase.ui.auth.data.remote.GoogleSignInHandler;
2021
import com.firebase.ui.auth.data.remote.TwitterSignInHandler;
21-
import com.firebase.ui.auth.ui.HelperActivityBase;
22+
import com.firebase.ui.auth.ui.InvisibleActivityBase;
2223
import com.firebase.ui.auth.util.ExtraConstants;
2324
import com.firebase.ui.auth.util.data.ProviderUtils;
2425
import com.firebase.ui.auth.viewmodel.ResourceObserver;
@@ -28,7 +29,8 @@
2829
import com.google.firebase.auth.GoogleAuthProvider;
2930
import com.google.firebase.auth.TwitterAuthProvider;
3031

31-
public class SingleSignInActivity extends HelperActivityBase {
32+
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
33+
public class SingleSignInActivity extends InvisibleActivityBase {
3234
private SocialProviderResponseHandler mHandler;
3335
private ProviderSignInBase<?> mProvider;
3436

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import android.support.annotation.StringRes;
2626
import android.view.View;
2727
import android.view.View.OnClickListener;
28+
import android.widget.Button;
29+
import android.widget.ProgressBar;
2830
import android.widget.TextView;
2931

3032
import com.firebase.ui.auth.AuthUI;
@@ -51,6 +53,9 @@
5153
public class WelcomeBackIdpPrompt extends AppCompatBase {
5254
private ProviderSignInBase<?> mProvider;
5355

56+
private Button mDoneButton;
57+
private ProgressBar mProgressBar;
58+
5459
public static Intent createIntent(
5560
Context context, FlowParameters flowParams, User existingUser) {
5661
return createIntent(context, flowParams, existingUser, null);
@@ -71,6 +76,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7176
super.onCreate(savedInstanceState);
7277
setContentView(R.layout.fui_welcome_back_idp_prompt_layout);
7378

79+
mDoneButton = findViewById(R.id.welcome_back_idp_button);
80+
mProgressBar = findViewById(R.id.top_progress_bar);
81+
7482
User existingUser = User.getUser(getIntent());
7583
IdpResponse requestedUserResponse = IdpResponse.fromResultIntent(getIntent());
7684
ViewModelProvider supplier = ViewModelProviders.of(this);
@@ -140,7 +148,7 @@ protected void onFailure(@NonNull Exception e) {
140148
existingUser.getEmail(),
141149
getString(providerName)));
142150

143-
findViewById(R.id.welcome_back_idp_button).setOnClickListener(new OnClickListener() {
151+
mDoneButton.setOnClickListener(new OnClickListener() {
144152
@Override
145153
public void onClick(View view) {
146154
mProvider.startSignIn(WelcomeBackIdpPrompt.this);
@@ -166,4 +174,16 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
166174
super.onActivityResult(requestCode, resultCode, data);
167175
mProvider.onActivityResult(requestCode, resultCode, data);
168176
}
177+
178+
@Override
179+
public void showProgress(int message) {
180+
mDoneButton.setEnabled(false);
181+
mProgressBar.setVisibility(View.VISIBLE);
182+
}
183+
184+
@Override
185+
public void hideProgress() {
186+
mDoneButton.setEnabled(true);
187+
mProgressBar.setVisibility(View.INVISIBLE);
188+
}
169189
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void showAllowingStateLoss(FragmentManager manager, String tag) {
6060
public Dialog onCreateDialog(Bundle savedInstanceState) {
6161
View rootView = View.inflate(getContext(), R.layout.fui_phone_progress_dialog, null);
6262

63-
mProgress = rootView.findViewById(R.id.progress_bar);
63+
mProgress = rootView.findViewById(R.id.top_progress_bar);
6464
mMessageView = rootView.findViewById(R.id.progress_msg);
6565
mSuccessImage = rootView.findViewById(R.id.progress_success_imaage);
6666

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
android:padding="8dp">
88

99
<ProgressBar
10-
android:id="@+id/progress_bar"
10+
android:id="@+id/top_progress_bar"
1111
style="@style/Base.Widget.AppCompat.ProgressBar"
1212
android:layout_width="wrap_content"
1313
android:layout_height="wrap_content"

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

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,43 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8+
89
<LinearLayout
9-
style="@style/FirebaseUI.WrapperStyle"
10+
android:layout_width="match_parent"
1011
android:layout_height="wrap_content"
1112
android:orientation="vertical">
1213

13-
<TextView
14-
style="@style/FirebaseUI.Text.Heading"
15-
android:layout_width="match_parent"
16-
android:layout_height="wrap_content"
17-
android:text="@string/fui_welcome_back_idp_header" />
14+
<ProgressBar
15+
android:id="@+id/top_progress_bar"
16+
style="@style/FirebaseUI.TopProgressBar"
17+
android:visibility="invisible"
18+
tools:visibility="visible" />
1819

19-
<TextView
20-
android:id="@+id/welcome_back_idp_prompt"
21-
style="@style/FirebaseUI.Text.BodyText"
22-
android:layout_width="match_parent"
20+
<LinearLayout
21+
style="@style/FirebaseUI.WrapperStyle"
2322
android:layout_height="wrap_content"
24-
android:textIsSelectable="false"
25-
tools:text="Good news! You've already used [email protected]. Sign in with Google to continue to SuperApp" />
23+
android:orientation="vertical">
24+
25+
<TextView
26+
style="@style/FirebaseUI.Text.Heading"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
android:text="@string/fui_welcome_back_idp_header" />
30+
31+
<TextView
32+
android:id="@+id/welcome_back_idp_prompt"
33+
style="@style/FirebaseUI.Text.BodyText"
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:textIsSelectable="false"
37+
tools:text="Good news! You've already used [email protected]. Sign in with Google to continue to SuperApp" />
38+
39+
<Button
40+
android:id="@+id/welcome_back_idp_button"
41+
style="@style/FirebaseUI.Button"
42+
android:text="@string/fui_sign_in_default" />
2643

27-
<Button
28-
android:id="@+id/welcome_back_idp_button"
29-
style="@style/FirebaseUI.Button"
30-
android:text="@string/fui_sign_in_default" />
44+
</LinearLayout>
3145

3246
</LinearLayout>
3347

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

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,74 @@
66
android:layout_width="match_parent"
77
android:layout_height="match_parent">
88

9-
<android.support.constraint.ConstraintLayout
10-
style="@style/FirebaseUI.WrapperStyle"
11-
android:layout_height="wrap_content">
9+
<LinearLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:orientation="vertical">
1213

13-
<TextView
14-
android:id="@+id/heading"
15-
style="@style/FirebaseUI.Text.Heading"
16-
android:layout_width="match_parent"
17-
android:layout_height="wrap_content"
18-
android:text="@string/fui_welcome_back_email_header"
19-
app:layout_constraintTop_toTopOf="parent" />
14+
<ProgressBar
15+
android:id="@+id/top_progress_bar"
16+
style="@style/FirebaseUI.TopProgressBar"
17+
android:visibility="invisible"
18+
tools:visibility="visible" />
2019

21-
<TextView
22-
android:id="@+id/welcome_back_password_body"
23-
style="@style/FirebaseUI.Text.BodyText"
24-
android:layout_width="match_parent"
25-
android:layout_height="wrap_content"
26-
android:textIsSelectable="false"
27-
app:layout_constraintTop_toBottomOf="@+id/heading"
28-
tools:text="@string/fui_welcome_back_password_prompt_body" />
20+
<android.support.constraint.ConstraintLayout
21+
style="@style/FirebaseUI.WrapperStyle"
22+
android:layout_height="wrap_content">
2923

30-
<android.support.design.widget.TextInputLayout
31-
android:id="@+id/password_layout"
32-
style="@style/FirebaseUI.TextInputLayout.PasswordField"
33-
android:layout_width="match_parent"
34-
android:layout_height="wrap_content"
35-
android:layout_marginTop="@dimen/fui_field_padding_vert"
36-
app:layout_constraintTop_toBottomOf="@+id/welcome_back_password_body"
37-
app:passwordToggleEnabled="true">
24+
<TextView
25+
android:id="@+id/heading"
26+
style="@style/FirebaseUI.Text.Heading"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
android:text="@string/fui_welcome_back_email_header"
30+
app:layout_constraintTop_toTopOf="parent" />
3831

39-
<android.support.design.widget.TextInputEditText
40-
android:id="@+id/password"
41-
style="@style/FirebaseUI.TextInputEditText.PasswordField" />
32+
<TextView
33+
android:id="@+id/welcome_back_password_body"
34+
style="@style/FirebaseUI.Text.BodyText"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
android:textIsSelectable="false"
38+
app:layout_constraintTop_toBottomOf="@+id/heading"
39+
tools:text="@string/fui_welcome_back_password_prompt_body" />
4240

43-
</android.support.design.widget.TextInputLayout>
41+
<android.support.design.widget.TextInputLayout
42+
android:id="@+id/password_layout"
43+
style="@style/FirebaseUI.TextInputLayout.PasswordField"
44+
android:layout_width="match_parent"
45+
android:layout_height="wrap_content"
46+
android:layout_marginTop="@dimen/fui_field_padding_vert"
47+
app:layout_constraintTop_toBottomOf="@+id/welcome_back_password_body"
48+
app:passwordToggleEnabled="true">
4449

45-
<TextView
46-
android:id="@+id/trouble_signing_in"
47-
style="@style/FirebaseUI.Text.Link"
48-
android:layout_width="0dp"
49-
android:layout_height="wrap_content"
50-
android:layout_marginTop="@dimen/fui_field_padding_vert"
51-
android:text="@string/fui_trouble_signing_in"
52-
app:layout_constraintStart_toStartOf="parent"
53-
app:layout_constraintEnd_toStartOf="@+id/button_done"
54-
app:layout_constraintTop_toBottomOf="@+id/password_layout" />
50+
<android.support.design.widget.TextInputEditText
51+
android:id="@+id/password"
52+
style="@style/FirebaseUI.TextInputEditText.PasswordField" />
5553

56-
<Button
57-
android:id="@+id/button_done"
58-
style="@style/FirebaseUI.Button"
59-
android:text="@string/fui_sign_in_default"
60-
app:layout_constraintStart_toEndOf="@+id/trouble_signing_in"
61-
app:layout_constraintEnd_toEndOf="parent"
62-
app:layout_constraintTop_toTopOf="@+id/trouble_signing_in" />
54+
</android.support.design.widget.TextInputLayout>
6355

64-
</android.support.constraint.ConstraintLayout>
56+
<TextView
57+
android:id="@+id/trouble_signing_in"
58+
style="@style/FirebaseUI.Text.Link"
59+
android:layout_width="0dp"
60+
android:layout_height="wrap_content"
61+
android:layout_marginTop="@dimen/fui_field_padding_vert"
62+
android:text="@string/fui_trouble_signing_in"
63+
app:layout_constraintStart_toStartOf="parent"
64+
app:layout_constraintEnd_toStartOf="@+id/button_done"
65+
app:layout_constraintTop_toBottomOf="@+id/password_layout" />
66+
67+
<Button
68+
android:id="@+id/button_done"
69+
style="@style/FirebaseUI.Button"
70+
android:text="@string/fui_sign_in_default"
71+
app:layout_constraintStart_toEndOf="@+id/trouble_signing_in"
72+
app:layout_constraintEnd_toEndOf="parent"
73+
app:layout_constraintTop_toTopOf="@+id/trouble_signing_in" />
74+
75+
</android.support.constraint.ConstraintLayout>
76+
77+
</LinearLayout>
6578

6679
</ScrollView>

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

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

233+
<style name="FirebaseUI.TopProgressBar" parent="Base.Widget.AppCompat.ProgressBar.Horizontal">
234+
<item name="android:layout_width">match_parent</item>
235+
<item name="android:layout_height">wrap_content</item>
236+
<item name="android:layout_marginTop">-7dp</item>
237+
<item name="android:indeterminate">true</item>
238+
</style>
239+
233240
</resources>

0 commit comments

Comments
 (0)