+
What you'll learn:
@@ -61,7 +61,7 @@ In this step we'll create a project in Android Studio.

We've left it on 10 (Gingerbread) here, since that is the lowest API level Firebase supports.
-4. Start with a Blank Activity
+4. Start with a Empty Activity

@@ -83,18 +83,18 @@ In this step we'll create a project in Android Studio.
Before we can start writing code that interacts with our Firebase database, we'll need to make Android Studio aware that we'll be using Firebase. We need to do this in a few places: in the `gradle.build` script for our app and in its `AndroidManifest.xml`.
-1. open Gradle Scripts > build.gradle (Module: app)
+First, open Gradle Scripts > build.gradle (Module: app)
This file contains the steps that Android Studio uses to build our app. We'll add a reference to Firebase to it, so we can start using it.
-2. add the following lines to the dependencies object at the bottom:
+Then add the following lines to the dependencies object at the bottom:
- compile 'com.firebase:firebase-client-android:2.3.1'
- compile 'com.firebaseui:firebase-ui:0.2.0'
+ compile 'com.firebase:firebase-client-android:2.5.0'
+ compile 'com.firebaseui:firebase-ui:0.3.0'
This tells Gradle to include the Firebase SDK and the FirebaseUI library.
-3. Add the following inside the `android` object:
+Add the following inside the `android` object:
packagingOptions {
exclude 'META-INF/LICENSE'
@@ -106,42 +106,52 @@ Before we can start writing code that interacts with our Firebase database, we'l

-4. At this stage you'll need to synchronize the project with the gradle files again. Either click the Sync Now link in the notification bar or the corresponding button in the toolbar: Sync Project with Gradle Files.
+At this stage you'll need to synchronize the project with the gradle files again. Either click the Sync Now link in the notification bar or the corresponding button in the toolbar: Sync Project with Gradle Files.

Android Studio will parse the gradle files and pick up our changes.
-5. Since Firebase is a hosted service, our app will need to be able to access the internet.
-6. Open app > manifests > AndroidManifest.xml
-7. Add this line inside the `manifest` element:
+Since Firebase is a hosted service, our app will need to be able to access the internet. Open app > manifests > AndroidManifest.xml then add this line inside the `manifest` element:
-
Let's take this in chunks: first we'll create a Java class to represent each message, then we'll create an Adapter that gets each of the messages from Firebase and puts them into a ListView.
-1. As you can see in the screenshot, each chat message has the same layout. Instead of creating a custom layout, we'll use one of the built-in layouts of Android: `android.R.layout.two_line_list_item`. We'll show the user name on the first line (in bold) and the message text on the second line.
-2. Create a class `ChatMessage.java` that wraps the username and text message:
+As you can see in the screenshot, each chat message has the same layout. Instead of creating a custom layout, we'll use one of the built-in layouts of Android: `android.R.layout.two_line_list_item`. We'll show the user name on the first line (in bold) and the message text on the second line.
- public class ChatMessage {
- private String name;
- private String text;
+Create a class `ChatMessage.java` that wraps the username and text message:
- public ChatMessage() {
- // necessary for Firebase's deserializer
- }
- public ChatMessage(String name, String text) {
- this.name = name;
- this.text = text;
- }
+```java
+public class ChatMessage {
+ private String name;
+ private String text;
- public String getName() {
- return name;
- }
+ public ChatMessage() {
+ // necessary for Firebase's deserializer
+ }
+ public ChatMessage(String name, String text) {
+ this.name = name;
+ this.text = text;
+ }
- public String getText() {
- return text;
- }
- }
+ public String getName() {
+ return name;
+ }
- As you can see, this is plain-old Java object. But it’s a POJO with some special traits. First `ChatMessage` follows a JavaBean pattern for its property names. The `getName` method is a getter for a `name` property, while `getText()` is a getter for a `text` property. And second, those property names correspond to the ones we’ve been using when we sent messages to Firebase in our `OnClickListener`.
+ public String getText() {
+ return text;
+ }
+}
+```
- 
+As you can see, this is plain-old Java object. But it’s a POJO with some special traits. First `ChatMessage` follows a JavaBean pattern for its property names. The `getName` method is a getter for a `name` property, while `getText()` is a getter for a `text` property. And second, those property names correspond to the ones we’ve been using when we sent messages to Firebase in our `OnClickListener`.
- Warning: if you end up making this `ChatMessage` an inner class of another class, you must make it static: `public static class ChatMessage`.
+
-3. With the layout for the message specified and their structure defined in a class, we need to make a space for them in the `main_activity.xml`
+Warning: if you end up making this `ChatMessage` an inner class of another class, you must make it static: `public static class ChatMessage`.
- Add a ListView with `android:id="@android:id/list"`` above the LinearLayout:
+With the layout for the message specified and their structure defined in a class, we need to make a space for them in the `main_activity.xml`
-
## Wrap-up
@@ -483,7 +457,7 @@ Wrap-up
Congratulations! You've just built a fully functional multi-user chat application that uses Firebase to store the data and authentication users.
-
+
As a reward for finishing the codelab you’ve earned a promo code! When you’re ready to put your Firebase app in production, you can use the promo code `androidcodelab49` for $49 off your first month of a paid Firebase plan. Just enter the code when you upgrade your Firebase.
diff --git a/codelabs/chat/images/0_0.png b/codelabs/chat/images/0_0.png
index 97bd088d8..e1e5be0a2 100644
Binary files a/codelabs/chat/images/0_0.png and b/codelabs/chat/images/0_0.png differ
diff --git a/codelabs/chat/images/0_1.png b/codelabs/chat/images/0_1.png
index a563a0cdc..3a4ac5202 100644
Binary files a/codelabs/chat/images/0_1.png and b/codelabs/chat/images/0_1.png differ
diff --git a/codelabs/chat/images/2_1.png b/codelabs/chat/images/2_1.png
index 386aacb1d..17b5e448d 100644
Binary files a/codelabs/chat/images/2_1.png and b/codelabs/chat/images/2_1.png differ
diff --git a/codelabs/chat/images/2_2.png b/codelabs/chat/images/2_2.png
index 44bf462a0..fd96cc359 100644
Binary files a/codelabs/chat/images/2_2.png and b/codelabs/chat/images/2_2.png differ
diff --git a/codelabs/chat/images/2_3.png b/codelabs/chat/images/2_3.png
index 9b0f04542..1f4b20286 100644
Binary files a/codelabs/chat/images/2_3.png and b/codelabs/chat/images/2_3.png differ
diff --git a/codelabs/chat/images/2_4.png b/codelabs/chat/images/2_4.png
index a4d3322ec..6e4d614cb 100644
Binary files a/codelabs/chat/images/2_4.png and b/codelabs/chat/images/2_4.png differ
diff --git a/codelabs/chat/images/2_5.png b/codelabs/chat/images/2_5.png
index 51ee6c488..3a19c1add 100644
Binary files a/codelabs/chat/images/2_5.png and b/codelabs/chat/images/2_5.png differ
diff --git a/codelabs/chat/images/2_6.png b/codelabs/chat/images/2_6.png
index 40d3e6b97..2b3cb7f8d 100644
Binary files a/codelabs/chat/images/2_6.png and b/codelabs/chat/images/2_6.png differ
diff --git a/codelabs/chat/images/2_7.png b/codelabs/chat/images/2_7.png
index dc1ea192f..d50e481d3 100644
Binary files a/codelabs/chat/images/2_7.png and b/codelabs/chat/images/2_7.png differ
diff --git a/codelabs/chat/images/3_1.png b/codelabs/chat/images/3_1.png
index 1f0b33ce3..0ae52cde1 100644
Binary files a/codelabs/chat/images/3_1.png and b/codelabs/chat/images/3_1.png differ
diff --git a/codelabs/chat/images/3_2.png b/codelabs/chat/images/3_2.png
index b07481ae4..ff17d491b 100644
Binary files a/codelabs/chat/images/3_2.png and b/codelabs/chat/images/3_2.png differ
diff --git a/codelabs/chat/images/3_3.png b/codelabs/chat/images/3_3.png
index 815df257a..87c53e5dc 100644
Binary files a/codelabs/chat/images/3_3.png and b/codelabs/chat/images/3_3.png differ
diff --git a/codelabs/chat/images/3_4.png b/codelabs/chat/images/3_4.png
index e7b7e47be..dde9a114e 100644
Binary files a/codelabs/chat/images/3_4.png and b/codelabs/chat/images/3_4.png differ
diff --git a/codelabs/chat/images/4_2.png b/codelabs/chat/images/4_2.png
index 4dc1ed900..20b576bab 100644
Binary files a/codelabs/chat/images/4_2.png and b/codelabs/chat/images/4_2.png differ
diff --git a/codelabs/chat/images/4_3.png b/codelabs/chat/images/4_3.png
index 89da66c44..92f6b2170 100644
Binary files a/codelabs/chat/images/4_3.png and b/codelabs/chat/images/4_3.png differ
diff --git a/codelabs/chat/images/4_4.png b/codelabs/chat/images/4_4.png
index a136ad0cc..eb8cab0e4 100644
Binary files a/codelabs/chat/images/4_4.png and b/codelabs/chat/images/4_4.png differ
diff --git a/codelabs/chat/images/5_1.png b/codelabs/chat/images/5_1.png
index e1c9f9849..d2fea8171 100644
Binary files a/codelabs/chat/images/5_1.png and b/codelabs/chat/images/5_1.png differ
diff --git a/codelabs/chat/images/5_3.png b/codelabs/chat/images/5_3.png
index 7a46900dd..5bf9eab16 100644
Binary files a/codelabs/chat/images/5_3.png and b/codelabs/chat/images/5_3.png differ
diff --git a/codelabs/chat/images/5_4.png b/codelabs/chat/images/5_4.png
index 4618405e6..ecc18188b 100644
Binary files a/codelabs/chat/images/5_4.png and b/codelabs/chat/images/5_4.png differ
diff --git a/codelabs/chat/images/5_5.png b/codelabs/chat/images/5_5.png
index 36a5c6fd6..24cb97fce 100644
Binary files a/codelabs/chat/images/5_5.png and b/codelabs/chat/images/5_5.png differ
diff --git a/codelabs/chat/images/5_6.png b/codelabs/chat/images/5_6.png
index 1e5b0a42f..1c726c23a 100644
Binary files a/codelabs/chat/images/5_6.png and b/codelabs/chat/images/5_6.png differ
diff --git a/codelabs/chat/images/5_7.png b/codelabs/chat/images/5_7.png
index 18ff67de3..675d909c6 100644
Binary files a/codelabs/chat/images/5_7.png and b/codelabs/chat/images/5_7.png differ
diff --git a/codelabs/chat/images/6_2.png b/codelabs/chat/images/6_2.png
index cbda09a0b..0d443e79d 100644
Binary files a/codelabs/chat/images/6_2.png and b/codelabs/chat/images/6_2.png differ
diff --git a/codelabs/chat/images/6_3.5.png b/codelabs/chat/images/6_3.5.png
new file mode 100644
index 000000000..3767a5033
Binary files /dev/null and b/codelabs/chat/images/6_3.5.png differ
diff --git a/codelabs/chat/images/6_3.png b/codelabs/chat/images/6_3.png
index ed7678f52..7c45a96bc 100644
Binary files a/codelabs/chat/images/6_3.png and b/codelabs/chat/images/6_3.png differ
diff --git a/codelabs/chat/images/6_4.png b/codelabs/chat/images/6_4.png
index eed6c797c..703eb7ecd 100644
Binary files a/codelabs/chat/images/6_4.png and b/codelabs/chat/images/6_4.png differ
diff --git a/codelabs/chat/images/6_5.png b/codelabs/chat/images/6_5.png
index fe58dc644..9bd2d3d89 100644
Binary files a/codelabs/chat/images/6_5.png and b/codelabs/chat/images/6_5.png differ
diff --git a/codelabs/chat/images/6_6.png b/codelabs/chat/images/6_6.png
deleted file mode 100644
index 96a07503c..000000000
Binary files a/codelabs/chat/images/6_6.png and /dev/null differ
diff --git a/codelabs/chat/images/6_7.png b/codelabs/chat/images/6_7.png
deleted file mode 100644
index 930c50845..000000000
Binary files a/codelabs/chat/images/6_7.png and /dev/null differ
diff --git a/codelabs/chat/images/6_8.png b/codelabs/chat/images/6_8.png
deleted file mode 100644
index a798bfdf6..000000000
Binary files a/codelabs/chat/images/6_8.png and /dev/null differ
diff --git a/codelabs/chat/images/6_9.png b/codelabs/chat/images/6_9.png
deleted file mode 100644
index 0a8a7a271..000000000
Binary files a/codelabs/chat/images/6_9.png and /dev/null differ
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index c7c992473..a088904ec 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,4 +1,2 @@
* Your implementation should populate the view using the data contained in the model. - * You should implement either this method or the other {@link FirebaseListAdapter#populateView(View, Object)} method - * but not both. * * @param v The view to populate * @param model The object containing the data used to populate the view * @param position The position in the list of the view being populated */ - protected void populateView(View v, T model, int position) { - populateView(v, model); - } - - /** - * This is a backwards compatible version of populateView. - *
- * You should implement either this method or the other {@link FirebaseListAdapter#populateView(View, Object, int)} method
- * but not both.
- *
- * @see FirebaseListAdapter#populateView(View, Object, int)
- *
- * @param v The view to populate
- * @param model The object containing the data used to populate the view
- */
- @Deprecated
- protected void populateView(View v, T model) {
+ abstract protected void populateView(View v, T model, int position);
- }
}
diff --git a/library/src/main/java/com/firebase/ui/FirebaseRecyclerAdapter.java b/library/src/main/java/com/firebase/ui/FirebaseRecyclerAdapter.java
index 4706279db..fb5ab83b7 100644
--- a/library/src/main/java/com/firebase/ui/FirebaseRecyclerAdapter.java
+++ b/library/src/main/java/com/firebase/ui/FirebaseRecyclerAdapter.java
@@ -33,6 +33,7 @@
import android.view.View;
import android.view.ViewGroup;
+import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.Query;
@@ -68,7 +69,7 @@
* recycler.setLayoutManager(new LinearLayoutManager(this));
*
* adapter = new FirebaseRecyclerAdapter
* Your implementation should populate the view using the data contained in the model.
- * You should implement either this method or the other FirebaseRecyclerAdapter#populateViewHolder(VH, Object) method
- * but not both.
*
* @param viewHolder The view to populate
* @param model The object containing the data used to populate the view
* @param position The position in the list of the view being populated
*/
- protected void populateViewHolder(VH viewHolder, T model, int position) {
- populateViewHolder(viewHolder, model);
- };
- /**
- * This is a backwards compatible version of populateViewHolder.
- *
- * You should implement either this method or the other FirebaseRecyclerAdapter#populateViewHolder(VH, T, int) method
- * but not both.
- *
- * @see FirebaseListAdapter#populateView(View, Object, int)
- *
- * @param viewHolder The view to populate
- * @param model The object containing the data used to populate the view
- */
- @Deprecated
- protected void populateViewHolder(VH viewHolder, T model) {
- };
-
+ abstract protected void populateViewHolder(VH viewHolder, T model, int position);
}
diff --git a/library/src/main/java/com/firebase/ui/auth/core/AuthProviderType.java b/library/src/main/java/com/firebase/ui/auth/core/AuthProviderType.java
new file mode 100644
index 000000000..c183d1a7a
--- /dev/null
+++ b/library/src/main/java/com/firebase/ui/auth/core/AuthProviderType.java
@@ -0,0 +1,62 @@
+package com.firebase.ui.auth.core;
+
+import android.content.Context;
+
+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.lang.reflect.InvocationTargetException;
+
+public enum AuthProviderType {
+ GOOGLE ("google", "google.GoogleAuthProvider", R.id.google_button),
+ FACEBOOK("facebook", "facebook.FacebookAuthProvider", R.id.facebook_button),
+ TWITTER ("twitter", "twitter.TwitterAuthProvider", R.id.twitter_button),
+ PASSWORD("password", "password.PasswordAuthProvider", R.id.password_button);
+
+ private final static String AUTH_PACKAGE = "com.firebase.ui.auth.";
+ private final String mName;
+ private final String mProviderName;
+ private final int mButtonId;
+
+ AuthProviderType(String name, String providerName, int button_id) {
+ this.mName = name;
+ this.mProviderName = providerName;
+ this.mButtonId = button_id;
+ }
+
+ public String getName() {
+ return mName;
+ }
+ public int getButtonId() {
+ return mButtonId;
+ }
+
+ public FirebaseAuthProvider createProvider(Context context, Firebase ref, TokenAuthHandler handler) {
+ try {
+ Class extends FirebaseAuthProvider> clazz = (Class extends FirebaseAuthProvider>) Class.forName(AUTH_PACKAGE+mProviderName);
+ return clazz.getConstructor(Context.class, AuthProviderType.class, String.class, Firebase.class, TokenAuthHandler.class).newInstance(context, this, this.getName(), ref, handler);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ public static AuthProviderType getTypeForProvider(FirebaseAuthProvider provider) {
+ for (AuthProviderType type : AuthProviderType.values()) {
+ if (provider.getProviderName() == type.getName()) {
+ return type;
+ }
+ }
+ throw new IllegalArgumentException("The provider you specified is not of a known type");
+ }
+}
diff --git a/library/src/main/java/com/firebase/ui/auth/core/FirebaseAuthProvider.java b/library/src/main/java/com/firebase/ui/auth/core/FirebaseAuthProvider.java
index 7db7eaeec..5f9f92e15 100644
--- a/library/src/main/java/com/firebase/ui/auth/core/FirebaseAuthProvider.java
+++ b/library/src/main/java/com/firebase/ui/auth/core/FirebaseAuthProvider.java
@@ -1,5 +1,7 @@
package com.firebase.ui.auth.core;
+import android.content.Context;
+import android.content.Intent;
import android.util.Log;
import com.firebase.client.AuthData;
@@ -10,22 +12,51 @@
import java.util.Map;
public abstract class FirebaseAuthProvider {
+ private static final String TAG = "FirebaseAuthProvider";
+ private final Context mContext;
+ private final AuthProviderType mAuthProviderType;
+ private final String mProviderName;
+ private final Firebase mRef;
+ private final TokenAuthHandler mHandler;
+
public abstract void logout();
- public abstract String getProviderName();
- public abstract Firebase getFirebaseRef();
- public abstract SocialProvider getProviderType();
+ public Context getContext() { return mContext; }
+ public AuthProviderType getProviderType() { return mAuthProviderType; }
+ public String getProviderName() { return mProviderName; }
+ public Firebase getFirebaseRef() { return mRef; }
+ public TokenAuthHandler getHandler() { return mHandler; }
+
+ protected FirebaseAuthProvider(Context context, AuthProviderType providerType, String providerName, Firebase ref, TokenAuthHandler handler) {
+ mContext = context;
+ mAuthProviderType = providerType;
+ mProviderName = providerName;
+ mRef = ref;
+ mHandler = handler;
+ }
public void login() {
- Log.d("FirebaseAuthProvider", "Login() is not supported for provider type " + getProviderName());
+ Log.w("FirebaseAuthProvider", "Login() is not supported for provider type " + getProviderName());
};
public void login(String email, String password) {
- Log.d("FirebaseAuthProvider", "Login(String email, String password) is not supported for provider type " + getProviderName());
+ Log.w("FirebaseAuthProvider", "Login(String email, String password) is not supported for provider type " + getProviderName());
};
public void onFirebaseTokenReceived(FirebaseOAuthToken token, TokenAuthHandler handler) {
authenticateRefWithOAuthFirebasetoken(token, handler);
}
+ /**
+ * Override this method in your provider subclass if you start an activity from the login() method.
+ * Receive the result from a previous call to startActivityForResult(Intent, int). This follows
+ * the related Activity API as described there in onActivityResult(int, int, Intent).
+ * @param requestCode The integer request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from/
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ */
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ }
+
private void authenticateRefWithOAuthFirebasetoken(FirebaseOAuthToken token, final TokenAuthHandler handler) {
Firebase.AuthResultHandler authResultHandler = new Firebase.AuthResultHandler() {
@Override
@@ -35,7 +66,8 @@ public void onAuthenticated(AuthData authData) {
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
- handler.onProviderError(new FirebaseLoginError(FirebaseResponse.PROVIDER_NOT_ENABLED, "Make sure " + getProviderName() + " login is enabled and configured in your Firebase."));
+ Log.e(TAG, "Authentication failed: "+firebaseError.toString());
+ handler.onProviderError(new FirebaseLoginError(FirebaseResponse.PROVIDER_NOT_ENABLED, "Make sure " + getProviderName() + " login is enabled and configured in your Firebase. ("+firebaseError.toString()+")"));
}
};
diff --git a/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginBaseActivity.java b/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginBaseActivity.java
index 96f6b3a8c..e06e58069 100644
--- a/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginBaseActivity.java
+++ b/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginBaseActivity.java
@@ -2,11 +2,15 @@
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
import com.firebase.client.AuthData;
import com.firebase.client.Firebase;
+/**
+ * You can subclass this activity in your app to easily get authentication working. If you already
+ * have a base class and cannot switch, copy the relevant parts of this base activity into your own
+ * activity.
+ */
public abstract class FirebaseLoginBaseActivity extends AppCompatActivity {
private final String TAG = "FirebaseLoginBaseAct";
@@ -52,7 +56,7 @@ protected void onFirebaseLoggedOut() {
}
/**
- * Subclasses of this activity may implement this method to handle any potential provider errors
+ * Subclasses of this activity should implement this method to handle any potential provider errors
* like OAuth or other internal errors.
*
* @return void
@@ -60,13 +64,17 @@ protected void onFirebaseLoggedOut() {
protected abstract void onFirebaseLoginProviderError(FirebaseLoginError firebaseError);
/**
- * Subclasses of this activity may implement this method to handle any potential user errors
+ * Subclasses of this activity should implement this method to handle any potential user errors
* like entering an incorrect password or closing the login dialog.
*
* @return void
*/
protected abstract void onFirebaseLoginUserError(FirebaseLoginError firebaseError);
+ /**
+ * Calling this method will log out the currently authenticated user. It is only legal to call
+ * this method after the `onStart()` method has completed.
+ */
public void logout() {
mDialog.logout();
}
@@ -75,6 +83,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
mDialog.onActivityResult(requestCode, resultCode, data);
}
+ /**
+ * Calling this method displays the Firebase login dialog over the current activity, allowing the
+ * user to authenticate with any of the configured providers. It is only legal to call this
+ * method after the `onStart()` method has completed.
+ */
public void showFirebaseLoginPrompt() {
mDialog.show(getFragmentManager(), "");
}
@@ -83,18 +96,22 @@ public void dismissFirebaseLoginPrompt() {
mDialog.dismiss();
}
- public void resetFirebaseLoginDialog() {
+ public void resetFirebaseLoginPrompt() {
mDialog.reset();
}
- public void setEnabledAuthProvider(SocialProvider provider) {
+ /**
+ * Enables authentication with the specified provider.
+ *
+ * @param provider the provider to enable.
+ */
+ public void setEnabledAuthProvider(AuthProviderType provider) {
mDialog.setEnabledProvider(provider);
}
@Override
protected void onStart() {
super.onStart();
-
mHandler = new TokenAuthHandler() {
@Override
public void onSuccess(AuthData data) {
@@ -134,6 +151,7 @@ public void onAuthStateChanged(AuthData authData) {
getFirebaseRef().addAuthStateListener(mAuthStateListener);
}
+ @Override
protected void onStop() {
super.onStop();
getFirebaseRef().removeAuthStateListener(mAuthStateListener);
diff --git a/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginDialog.java b/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginDialog.java
index e19f7494e..40e770ee6 100644
--- a/library/src/main/java/com/firebase/ui/auth/core/FirebaseLoginDialog.java
+++ b/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,33 +13,27 @@
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;
public class FirebaseLoginDialog extends DialogFragment {
- FacebookAuthProvider mFacebookAuthProvider;
- TwitterAuthProvider mTwitterAuthProvider;
- GoogleAuthProvider mGoogleAuthProvider;
- PasswordAuthProvider mPasswordAuthProvider;
+ Map