Skip to content
Browse files

Addresses #53 and other minor cleanup

1 parent 745ad82 commit f3f472cbf65c96fcec104b5ed0d547b9e9e97868 @abehaskins abehaskins committed
View
5 app/src/main/java/com/firebase/uidemo/RecyclerViewDemoActivity.java
@@ -135,6 +135,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
+
@Override
public void onFirebaseLoggedIn(AuthData authData) {
Log.i(TAG, "Logged in to " + authData.getProvider().toString());
@@ -163,13 +164,13 @@ public void onFirebaseLoggedOut() {
@Override
public void onFirebaseLoginProviderError(FirebaseLoginError firebaseError) {
Log.e(TAG, "Login provider error: " + firebaseError.toString());
- resetFirebaseLoginDialog();
+ resetFirebaseLoginPrompt();
}
@Override
public void onFirebaseLoginUserError(FirebaseLoginError firebaseError) {
Log.e(TAG, "Login user error: "+firebaseError.toString());
- resetFirebaseLoginDialog();
+ resetFirebaseLoginPrompt();
}
@Override
View
3 library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginBaseActivity.java
@@ -96,7 +96,7 @@ public void dismissFirebaseLoginPrompt() {
mDialog.dismiss();
}
- public void resetFirebaseLoginDialog() {
+ public void resetFirebaseLoginPrompt() {
mDialog.reset();
}
@@ -112,7 +112,6 @@ public void setEnabledAuthProvider(AuthProviderType provider) {
@Override
protected void onStart() {
super.onStart();
-
mHandler = new TokenAuthHandler() {
@Override
public void onSuccess(AuthData data) {
View
37 library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginDialog.java
@@ -6,7 +6,6 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
@@ -14,10 +13,7 @@
import com.firebase.client.AuthData;
import com.firebase.client.Firebase;
import com.firebase.ui.R;
-import com.firebase.ui.auth.facebook.FacebookAuthProvider;
import com.firebase.ui.auth.google.GoogleAuthProvider;
-import com.firebase.ui.auth.password.PasswordAuthProvider;
-import com.firebase.ui.auth.twitter.TwitterAuthProvider;
import java.util.HashMap;
import java.util.Map;
@@ -31,11 +27,6 @@
Context mContext;
View mView;
- /*
- We need to be extra aggressive about building / destroying mGoogleauthProviders so we don't
- end up with two clients connected at the same time.
- */
-
@Override
public void onStop() {
super.onStop();
@@ -76,7 +67,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
showLoginOption(mEnabledProvidersByType.get(providerType), providerType.getButtonId());
}
else {
- mView.findViewById(providerType.getButtonId()).setVisibility(View.GONE);;
+ mView.findViewById(providerType.getButtonId()).setVisibility(View.GONE);
}
}
@@ -86,9 +77,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
}
mView.findViewById(R.id.loading_section).setVisibility(View.GONE);
-
builder.setView(mView);
+ this.setRetainInstance(true);
return builder.create();
}
@@ -146,18 +137,18 @@ private void showLoginOption(final FirebaseAuthProvider helper, int id) {
mView.findViewById(id).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- if (AuthProviderType.getTypeForProvider(helper) == AuthProviderType.PASSWORD) {
- EditText emailText = (EditText) mView.findViewById(R.id.email);
- EditText passwordText = (EditText) mView.findViewById(R.id.password);
- helper.login(emailText.getText().toString(), passwordText.getText().toString());
-
- passwordText.setText("");
- } else {
- helper.login();
- }
- mActiveProvider = helper.getProviderType();
- mView.findViewById(R.id.login_section).setVisibility(View.GONE);
- mView.findViewById(R.id.loading_section).setVisibility(View.VISIBLE);
+ if (AuthProviderType.getTypeForProvider(helper) == AuthProviderType.PASSWORD) {
+ EditText emailText = (EditText) mView.findViewById(R.id.email);
+ EditText passwordText = (EditText) mView.findViewById(R.id.password);
+ helper.login(emailText.getText().toString(), passwordText.getText().toString());
+
+ passwordText.setText("");
+ } else {
+ helper.login();
+ }
+ mActiveProvider = helper.getProviderType();
+ mView.findViewById(R.id.login_section).setVisibility(View.GONE);
+ mView.findViewById(R.id.loading_section).setVisibility(View.VISIBLE);
}
});
}

0 comments on commit f3f472c

Please sign in to comment.
Something went wrong with that request. Please try again.