6
6
import android .content .Context ;
7
7
import android .content .Intent ;
8
8
import android .os .Bundle ;
9
- import android .util .Log ;
10
9
import android .view .LayoutInflater ;
11
10
import android .view .View ;
12
11
import android .widget .EditText ;
13
12
14
13
import com .firebase .client .AuthData ;
15
14
import com .firebase .client .Firebase ;
16
15
import com .firebase .ui .R ;
17
- import com .firebase .ui .auth .facebook .FacebookAuthProvider ;
18
16
import com .firebase .ui .auth .google .GoogleAuthProvider ;
19
- import com .firebase .ui .auth .password .PasswordAuthProvider ;
20
- import com .firebase .ui .auth .twitter .TwitterAuthProvider ;
21
17
22
18
import java .util .HashMap ;
23
19
import java .util .Map ;
@@ -31,11 +27,6 @@ public class FirebaseLoginDialog extends DialogFragment {
31
27
Context mContext ;
32
28
View mView ;
33
29
34
- /*
35
- We need to be extra aggressive about building / destroying mGoogleauthProviders so we don't
36
- end up with two clients connected at the same time.
37
- */
38
-
39
30
@ Override
40
31
public void onStop () {
41
32
super .onStop ();
@@ -76,7 +67,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
76
67
showLoginOption (mEnabledProvidersByType .get (providerType ), providerType .getButtonId ());
77
68
}
78
69
else {
79
- mView .findViewById (providerType .getButtonId ()).setVisibility (View .GONE );;
70
+ mView .findViewById (providerType .getButtonId ()).setVisibility (View .GONE );
80
71
}
81
72
}
82
73
@@ -86,9 +77,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
86
77
}
87
78
88
79
mView .findViewById (R .id .loading_section ).setVisibility (View .GONE );
89
-
90
80
builder .setView (mView );
91
81
82
+ this .setRetainInstance (true );
92
83
return builder .create ();
93
84
}
94
85
@@ -146,18 +137,18 @@ private void showLoginOption(final FirebaseAuthProvider helper, int id) {
146
137
mView .findViewById (id ).setOnClickListener (new View .OnClickListener () {
147
138
@ Override
148
139
public void onClick (View view ) {
149
- if (AuthProviderType .getTypeForProvider (helper ) == AuthProviderType .PASSWORD ) {
150
- EditText emailText = (EditText ) mView .findViewById (R .id .email );
151
- EditText passwordText = (EditText ) mView .findViewById (R .id .password );
152
- helper .login (emailText .getText ().toString (), passwordText .getText ().toString ());
153
-
154
- passwordText .setText ("" );
155
- } else {
156
- helper .login ();
157
- }
158
- mActiveProvider = helper .getProviderType ();
159
- mView .findViewById (R .id .login_section ).setVisibility (View .GONE );
160
- mView .findViewById (R .id .loading_section ).setVisibility (View .VISIBLE );
140
+ if (AuthProviderType .getTypeForProvider (helper ) == AuthProviderType .PASSWORD ) {
141
+ EditText emailText = (EditText ) mView .findViewById (R .id .email );
142
+ EditText passwordText = (EditText ) mView .findViewById (R .id .password );
143
+ helper .login (emailText .getText ().toString (), passwordText .getText ().toString ());
144
+
145
+ passwordText .setText ("" );
146
+ } else {
147
+ helper .login ();
148
+ }
149
+ mActiveProvider = helper .getProviderType ();
150
+ mView .findViewById (R .id .login_section ).setVisibility (View .GONE );
151
+ mView .findViewById (R .id .loading_section ).setVisibility (View .VISIBLE );
161
152
}
162
153
});
163
154
}
0 commit comments