diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index d10f95651..2d2745308 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -68,7 +68,6 @@
-
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 68a391ea9..cb2589255 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,48 +4,48 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.firebase.uidemo">
-
-
+
+
-
-
+
+
+ android:resource="@xml/shortcuts" />
+ android:label="@string/name_chat" />
+ android:label="@string/name_chat" />
+ android:label="@string/name_auth_ui" />
+ android:label="@string/name_auth_ui" />
+ android:label="@string/name_image" />
diff --git a/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java b/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
index 0c396a0e2..f05e78a85 100644
--- a/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
+++ b/app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
@@ -137,6 +137,12 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.google_scope_youtube_data)
CheckBox mGoogleScopeYoutubeData;
+ public static Intent createIntent(Context context) {
+ Intent in = new Intent();
+ in.setClass(context, AuthUiActivity.class);
+ return in;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -408,10 +414,4 @@ private List getGooglePermissions() {
}
return result;
}
-
- public static Intent createIntent(Context context) {
- Intent in = new Intent();
- in.setClass(context, AuthUiActivity.class);
- return in;
- }
}
diff --git a/app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java b/app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java
index fedb61a13..f0d129bcf 100644
--- a/app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java
+++ b/app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java
@@ -79,6 +79,16 @@ public class SignedInActivity extends AppCompatActivity {
private SignedInConfig mSignedInConfig;
+ public static Intent createIntent(
+ Context context,
+ IdpResponse idpResponse,
+ SignedInConfig signedInConfig) {
+ Intent startIntent = idpResponse == null ? new Intent() : idpResponse.toIntent();
+
+ return startIntent.setClass(context, SignedInActivity.class)
+ .putExtra(EXTRA_SIGNED_IN_CONFIG, signedInConfig);
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -220,8 +230,7 @@ private void populateIdpToken() {
@MainThread
private void showSnackbar(@StringRes int errorMessageRes) {
- Snackbar.make(mRootView, errorMessageRes, Snackbar.LENGTH_LONG)
- .show();
+ Snackbar.make(mRootView, errorMessageRes, Snackbar.LENGTH_LONG).show();
}
static final class SignedInConfig implements Parcelable {
@@ -283,14 +292,4 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(isHintSelectorEnabled ? 1 : 0);
}
}
-
- public static Intent createIntent(
- Context context,
- IdpResponse idpResponse,
- SignedInConfig signedInConfig) {
- Intent startIntent = idpResponse == null ? new Intent() : idpResponse.toIntent();
-
- return startIntent.setClass(context, SignedInActivity.class)
- .putExtra(EXTRA_SIGNED_IN_CONFIG, signedInConfig);
- }
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4bb747c6a..8cfaef35a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -10,7 +10,7 @@
Demonstrates displaying an image from Cloud Storage using Glide.
-
+ FirebaseUI Auth DemoStartGreen Theme
diff --git a/auth/src/main/AndroidManifest.xml b/auth/src/main/AndroidManifest.xml
index d26d526c6..f3a1db420 100644
--- a/auth/src/main/AndroidManifest.xml
+++ b/auth/src/main/AndroidManifest.xml
@@ -3,63 +3,63 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.firebase.ui.auth">
-
-
+
+
+ android:value="@integer/google_play_services_version" />
+ android:value="@string/twitter_consumer_secret" />
+ android:value="@string/facebook_application_id" />
+ android:value="${enableFbLogging}" />
+ android:theme="@style/FirebaseUI.Transparent" />
+ android:exported="false" />
+ android:exported="false" />
+ android:exported="false"
+ android:windowSoftInputMode="stateAlwaysVisible" />
+ android:exported="false" />
+ android:exported="false" />
+ android:exported="false" />
-
+
-
-
+
+
-
+
diff --git a/auth/src/main/java/com/firebase/ui/auth/AuthUI.java b/auth/src/main/java/com/firebase/ui/auth/AuthUI.java
index 0001113d8..d786e7dde 100644
--- a/auth/src/main/java/com/firebase/ui/auth/AuthUI.java
+++ b/auth/src/main/java/com/firebase/ui/auth/AuthUI.java
@@ -76,8 +76,8 @@ public class AuthUI {
public @interface SupportedProvider {}
/**
- * Provider identifier for email and password credentials, for use with
- * {@link SignInIntentBuilder#setAvailableProviders(List)}.
+ * Provider identifier for email and password credentials, for use with {@link
+ * SignInIntentBuilder#setAvailableProviders(List)}.
*/
public static final String EMAIL_PROVIDER = EmailAuthProvider.PROVIDER_ID;
@@ -129,8 +129,8 @@ private AuthUI(FirebaseApp app) {
}
/**
- * Retrieves the {@link AuthUI} instance associated with the default app, as returned by
- * {@code FirebaseApp.getInstance()}.
+ * Retrieves the {@link AuthUI} instance associated with the default app, as returned by {@code
+ * FirebaseApp.getInstance()}.
*
* @throws IllegalStateException if the default app is not initialized.
*/
@@ -250,8 +250,8 @@ public Task then(@NonNull Task task) throws Exception {
}
/**
- * Starts the process of creating a sign in intent, with the mandatory application
- * context parameter.
+ * Starts the process of creating a sign in intent, with the mandatory application context
+ * parameter.
*/
public SignInIntentBuilder createSignInIntentBuilder() {
return new SignInIntentBuilder();
@@ -260,8 +260,8 @@ public SignInIntentBuilder createSignInIntentBuilder() {
/**
* Configuration for an identity provider.
*
- * In the simplest case, you can supply the provider ID and build the config like this:
- * {@code new IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()}
+ * In the simplest case, you can supply the provider ID and build the config like this: {@code
+ * new IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()}
*/
public static class IdpConfig implements Parcelable {
private final String mProviderId;
@@ -391,8 +391,8 @@ private abstract class AuthIntentBuilder {
private AuthIntentBuilder() {}
/**
- * Specifies the theme to use for the application flow. If no theme is specified,
- * a default theme will be used.
+ * Specifies the theme to use for the application flow. If no theme is specified, a default
+ * theme will be used.
*/
public T setTheme(@StyleRes int theme) {
Preconditions.checkValidStyle(
@@ -404,8 +404,8 @@ public T setTheme(@StyleRes int theme) {
}
/**
- * Specifies the logo to use for the {@link AuthMethodPickerActivity}. If no logo
- * is specified, none will be used.
+ * Specifies the logo to use for the {@link AuthMethodPickerActivity}. If no logo is
+ * specified, none will be used.
*/
public T setLogo(@DrawableRes int logo) {
mLogo = logo;
@@ -429,8 +429,8 @@ public T setPrivacyPolicyUrl(@Nullable String privacyPolicyUrl) {
}
/**
- * Specified the set of supported authentication providers. At least one provider must
- * be specified. There may only be one instance of each provider.
+ * Specified the set of supported authentication providers. At least one provider must be
+ * specified. There may only be one instance of each provider.
*
*
If no providers are explicitly specified by calling this method, then the email
* provider is the default supported provider.
@@ -455,9 +455,10 @@ public T setAvailableProviders(@NonNull List idpConfigs) {
try {
Class c = com.facebook.FacebookSdk.class;
} catch (NoClassDefFoundError e) {
- throw new RuntimeException("Facebook provider cannot be configured " +
- "without dependency. Did you forget to add " +
- "'com.facebook.android:facebook-android-sdk:VERSION' dependency?");
+ throw new RuntimeException(
+ "Facebook provider cannot be configured " +
+ "without dependency. Did you forget to add " +
+ "'com.facebook.android:facebook-android-sdk:VERSION' dependency?");
}
}
@@ -465,9 +466,10 @@ public T setAvailableProviders(@NonNull List idpConfigs) {
try {
Class c = com.twitter.sdk.android.core.TwitterCore.class;
} catch (NoClassDefFoundError e) {
- throw new RuntimeException("Twitter provider cannot be configured " +
- "without dependency. Did you forget to add " +
- "'com.twitter.sdk.android:twitter-core:VERSION' dependency?");
+ throw new RuntimeException(
+ "Twitter provider cannot be configured " +
+ "without dependency. Did you forget to add " +
+ "'com.twitter.sdk.android:twitter-core:VERSION' dependency?");
}
}
}
@@ -476,8 +478,8 @@ public T setAvailableProviders(@NonNull List idpConfigs) {
}
/**
- * Specified the set of supported authentication providers. At least one provider must
- * be specified. There may only be one instance of each provider.
+ * Specified the set of supported authentication providers. At least one provider must be
+ * specified. There may only be one instance of each provider.
*
*
If no providers are explicitly specified by calling this method, then the email
* provider is the default supported provider.
@@ -504,9 +506,9 @@ public T setProviders(@NonNull List idpConfigs) {
}
/**
- * Enables or disables the use of Smart Lock for Passwords in the sign in flow.
- * To (en)disable hint selector and credential selector independently
- * use {@link #setIsSmartLockEnabled(boolean, boolean)}
+ * Enables or disables the use of Smart Lock for Passwords in the sign in flow. To
+ * (en)disable hint selector and credential selector independently use {@link
+ * #setIsSmartLockEnabled(boolean, boolean)}
*
*
SmartLock is enabled by default.
*
@@ -522,10 +524,9 @@ public T setIsSmartLockEnabled(boolean enabled) {
* selector.
*
*
Both selectors are enabled by default.
-
+ *
* @param enableCredentials enables credential selector before signup
- * @param enableHints enable hint selector in respective signup screens
- * @return
+ * @param enableHints enable hint selector in respective signup screens
*/
public T setIsSmartLockEnabled(boolean enableCredentials, boolean enableHints) {
mEnableCredentials = enableCredentials;
diff --git a/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java b/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java
index 2c9797a0a..36a882334 100644
--- a/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java
+++ b/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java
@@ -173,7 +173,8 @@ public static class Builder {
private String mToken;
private String mSecret;
- public Builder(@AuthUI.SupportedProvider @NonNull String providerId, @Nullable String email) {
+ public Builder(@AuthUI.SupportedProvider @NonNull String providerId,
+ @Nullable String email) {
mProviderId = providerId;
mEmail = email;
}
@@ -208,7 +209,8 @@ public IdpResponse build() {
"Secret cannot be null when using the Twitter provider.");
}
- return new IdpResponse(mProviderId, mEmail, mPhoneNumber, mToken, mSecret, ResultCodes.OK);
+ return new IdpResponse(
+ mProviderId, mEmail, mPhoneNumber, mToken, mSecret, ResultCodes.OK);
}
}
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ResultCodes.java b/auth/src/main/java/com/firebase/ui/auth/ResultCodes.java
index c8889b778..72f189fc6 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ResultCodes.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ResultCodes.java
@@ -3,8 +3,8 @@
import android.app.Activity;
/**
- * Result codes returned when using {@link AuthUI.SignInIntentBuilder#build()} with
- * {@code startActivityForResult}.
+ * Result codes returned when using {@link AuthUI.SignInIntentBuilder#build()} with {@code
+ * startActivityForResult}.
*/
public final class ResultCodes {
/**
diff --git a/auth/src/main/java/com/firebase/ui/auth/package-info.java b/auth/src/main/java/com/firebase/ui/auth/package-info.java
index 3a0cc3890..5c1ac6f75 100644
--- a/auth/src/main/java/com/firebase/ui/auth/package-info.java
+++ b/auth/src/main/java/com/firebase/ui/auth/package-info.java
@@ -13,7 +13,7 @@
*/
/**
- * The Firebase AuthUI library. See the {@link com.firebase.ui.auth.AuthUI} entry class
- * for information on using the library to manage signed-in user state.
+ * The Firebase AuthUI library. See the {@link com.firebase.ui.auth.AuthUI} entry class for
+ * information on using the library to manage signed-in user state.
*/
package com.firebase.ui.auth;
diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
index c7c1dba91..45ec1cee8 100644
--- a/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
+++ b/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java
@@ -133,8 +133,7 @@ public void onSuccess(final LoginResult loginResult) {
public void onCompleted(JSONObject object, GraphResponse response) {
FacebookRequestError requestError = response.getError();
if (requestError != null) {
- Log.e(TAG,
- "Received Facebook error: " + requestError.getErrorMessage());
+ Log.e(TAG, "Received Facebook error: " + requestError.getErrorMessage());
onFailure(new Bundle());
return;
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/IdpProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/IdpProvider.java
index b04a37fa1..f9cac1f94 100644
--- a/auth/src/main/java/com/firebase/ui/auth/provider/IdpProvider.java
+++ b/auth/src/main/java/com/firebase/ui/auth/provider/IdpProvider.java
@@ -19,11 +19,11 @@
import com.firebase.ui.auth.IdpResponse;
public interface IdpProvider extends Provider {
- void setAuthenticationCallback(IdpCallback callback);
-
interface IdpCallback {
void onSuccess(IdpResponse idpResponse);
void onFailure(Bundle extra);
}
+
+ void setAuthenticationCallback(IdpCallback callback);
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/TwitterProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/TwitterProvider.java
index dd64d077c..a3beb2b60 100644
--- a/auth/src/main/java/com/firebase/ui/auth/provider/TwitterProvider.java
+++ b/auth/src/main/java/com/firebase/ui/auth/provider/TwitterProvider.java
@@ -63,6 +63,10 @@ public static void signout(Context context) {
signOut();
}
+ private static void signOut() throws IllegalStateException {
+ TwitterCore.getInstance().getSessionManager().clearActiveSession();
+ }
+
@Override
public String getName(Context context) {
return context.getString(R.string.idp_name_twitter);
@@ -98,7 +102,7 @@ public void startLogin(Activity activity) {
@Override
public void success(Result result) {
mTwitterAuthClient.requestEmail(result.data,
- new EmailCallback(result.data, mCallbackObject));
+ new EmailCallback(result.data, mCallbackObject));
}
@Override
@@ -142,8 +146,4 @@ private IdpResponse createIdpResponse(String email) {
.build();
}
}
-
- private static void signOut() throws IllegalStateException {
- TwitterCore.getInstance().getSessionManager().clearActiveSession();
- }
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/package-info.java b/auth/src/main/java/com/firebase/ui/auth/provider/package-info.java
index 8b5cae576..d2f4dd20a 100644
--- a/auth/src/main/java/com/firebase/ui/auth/provider/package-info.java
+++ b/auth/src/main/java/com/firebase/ui/auth/provider/package-info.java
@@ -13,7 +13,7 @@
*/
/**
- * IDP-specific interactions for signing in users. The contents of this package should
- * be considered an implementation detail and not part of the main API.
+ * IDP-specific interactions for signing in users. The contents of this package should be considered
+ * an implementation detail and not part of the main API.
*/
package com.firebase.ui.auth.provider;
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/FlowParameters.java b/auth/src/main/java/com/firebase/ui/auth/ui/FlowParameters.java
index c4e15bb88..dea8597c0 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/FlowParameters.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/FlowParameters.java
@@ -30,8 +30,8 @@
import java.util.List;
/**
- * Encapsulates the core parameters and data captured during the authentication flow, in
- * a serializable manner, in order to pass data between activities.
+ * Encapsulates the core parameters and data captured during the authentication flow, in a
+ * serializable manner, in order to pass data between activities.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class FlowParameters implements Parcelable {
@@ -95,8 +95,8 @@ public static FlowParameters fromBundle(Bundle bundle) {
}
/**
- * Create a bundle containing this FlowParameters object as
- * {@link ExtraConstants#EXTRA_FLOW_PARAMS}.
+ * Create a bundle containing this FlowParameters object as {@link
+ * ExtraConstants#EXTRA_FLOW_PARAMS}.
*/
public Bundle toBundle() {
Bundle bundle = new Bundle();
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/HelperActivityBase.java b/auth/src/main/java/com/firebase/ui/auth/ui/HelperActivityBase.java
index f167213d2..25e7706cc 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/HelperActivityBase.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/HelperActivityBase.java
@@ -31,7 +31,7 @@ public static Intent createBaseIntent(
checkNotNull(context, "context cannot be null"),
checkNotNull(target, "target activity cannot be null"))
.putExtra(ExtraConstants.EXTRA_FLOW_PARAMS,
- checkNotNull(flowParams, "flowParams cannot be null"));
+ checkNotNull(flowParams, "flowParams cannot be null"));
}
@Override
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/TermsTextView.java b/auth/src/main/java/com/firebase/ui/auth/ui/TermsTextView.java
deleted file mode 100644
index 77058716a..000000000
--- a/auth/src/main/java/com/firebase/ui/auth/ui/TermsTextView.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2017 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.firebase.ui.auth.ui;
-
-import android.content.Context;
-import android.support.annotation.StringRes;
-import android.support.v7.widget.AppCompatTextView;
-import android.util.AttributeSet;
-
-import com.firebase.ui.auth.ui.email.PreambleHandler;
-
-/**
- * Text view to display terms of service before completing signup.
- * The view helps display TOS linking to the provided custom URI.
- * It handles the styling of the link and opens the uri in a CustomTabs on click.
- */
-public class TermsTextView extends AppCompatTextView {
- public TermsTextView(Context context) {
- super(context);
- }
-
- public TermsTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public TermsTextView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- /**
- * @param params FlowParameters containing terms URLs.
- * @param buttonText for the button that represents the "action" described in the terms.
- */
- public void showTerms(FlowParameters params, @StringRes int buttonText) {
- PreambleHandler handler = new PreambleHandler(getContext(), params, buttonText);
- handler.setPreamble(this);
- }
-}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/User.java b/auth/src/main/java/com/firebase/ui/auth/ui/User.java
index 7fab9ace1..aa2634b50 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/User.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/User.java
@@ -16,10 +16,11 @@ public class User implements Parcelable {
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
@Override
public User createFromParcel(Parcel in) {
- return new User(in.readString(),
- in.readString(),
- in.readString(),
- in.readParcelable(Uri.class.getClassLoader()));
+ return new User(
+ in.readString(),
+ in.readString(),
+ in.readString(),
+ in.readParcelable(Uri.class.getClassLoader()));
}
@Override
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java
index 8328ca3e7..34e1c7b1e 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java
@@ -30,11 +30,11 @@
import com.firebase.ui.auth.IdpResponse;
import com.firebase.ui.auth.R;
import com.firebase.ui.auth.ResultCodes;
-import com.firebase.ui.auth.provider.ProviderUtils;
import com.firebase.ui.auth.provider.FacebookProvider;
import com.firebase.ui.auth.provider.GoogleProvider;
import com.firebase.ui.auth.provider.IdpProvider;
import com.firebase.ui.auth.provider.IdpProvider.IdpCallback;
+import com.firebase.ui.auth.provider.ProviderUtils;
import com.firebase.ui.auth.provider.TwitterProvider;
import com.firebase.ui.auth.ui.AppCompatBase;
import com.firebase.ui.auth.ui.ExtraConstants;
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java
index 0bef04fd8..7ab82eedd 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java
@@ -53,8 +53,8 @@
import com.google.firebase.auth.FirebaseAuth;
/**
- * Activity to link a pre-existing email/password account to a new IDP sign-in by confirming
- * the password before initiating a link.
+ * Activity to link a pre-existing email/password account to a new IDP sign-in by confirming the
+ * password before initiating a link.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class WelcomeBackPasswordPrompt extends AppCompatBase
@@ -101,9 +101,9 @@ protected void onCreate(Bundle savedInstanceState) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(bodyText);
int emailStart = bodyText.indexOf(mEmail);
spannableStringBuilder.setSpan(new StyleSpan(Typeface.BOLD),
- emailStart,
- emailStart + mEmail.length(),
- Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+ emailStart,
+ emailStart + mEmail.length(),
+ Spannable.SPAN_INCLUSIVE_INCLUSIVE);
TextView bodyTextView = ((TextView) findViewById(R.id.welcome_back_password_body));
bodyTextView.setText(spannableStringBuilder);
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java
index e938eeb88..f28e38f40 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java
@@ -39,8 +39,7 @@
import com.google.firebase.auth.FirebaseAuth;
/**
- * Fragment that shows a form with an email field and checks for existing accounts with that
- * email.
+ * Fragment that shows a form with an email field and checks for existing accounts with that email.
*
* Host Activities should implement {@link CheckEmailListener}.
*/
@@ -201,9 +200,9 @@ private void checkAccountExists(@NonNull final String email) {
public void onSuccess(String provider) {
if (provider == null) {
mListener.onNewUser(new User.Builder(email)
- .setName(finalName)
- .setPhotoUri(finalPhotoUri)
- .build());
+ .setName(finalName)
+ .setPhotoUri(finalPhotoUri)
+ .build());
} else if (EmailAuthProvider.PROVIDER_ID.equalsIgnoreCase(provider)) {
mListener.onExistingEmailUser(new User.Builder(email).build());
} else {
@@ -234,19 +233,18 @@ private PendingIntent getEmailHintIntent() {
GoogleApiClient client = new GoogleApiClient.Builder(getContext())
.addApi(Auth.CREDENTIALS_API)
.enableAutoManage(getActivity(), GoogleApiHelper.getSafeAutoManageId(),
- new GoogleApiClient.OnConnectionFailedListener() {
- @Override
- public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
- Log.e(TAG,
- "Client connection failed: " + connectionResult.getErrorMessage());
- }
- })
+ new GoogleApiClient.OnConnectionFailedListener() {
+ @Override
+ public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
+ Log.e(TAG, "Client connection failed: " + connectionResult.getErrorMessage());
+ }
+ })
.build();
HintRequest hintRequest = new HintRequest.Builder()
.setHintPickerConfig(new CredentialPickerConfig.Builder()
- .setShowCancelButton(true)
- .build())
+ .setShowCancelButton(true)
+ .build())
.setEmailAddressIdentifierSupported(true)
.build();
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/PreambleHandler.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/PreambleHandler.java
index 24c0ca26e..f66b53cf9 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/PreambleHandler.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/PreambleHandler.java
@@ -80,10 +80,8 @@ private void replaceUrlTarget(String target, @StringRes int replacementRes, Stri
}
/**
- * 0 means we have both a TOS and a PP
- *
1 means we only have a TOS
- *
2 means we only have a PP
- *
-1 means we have neither
+ * 0 means we have both a TOS and a PP
1 means we only have a TOS
2 means we only have a
+ * PP
-1 means we have neither
*/
private int getPreambleType() {
int preambleType;
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java
index dd97546fe..25f5ee508 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java
@@ -32,7 +32,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_confirm_recover_password)
.setMessage(getString(R.string.confirm_recovery_body,
- getArguments().getString(ExtraConstants.EXTRA_EMAIL)))
+ getArguments().getString(ExtraConstants.EXTRA_EMAIL)))
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface anInterface) {
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
index e2eacbf6c..4f367d1e4 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java
@@ -33,9 +33,9 @@
import com.google.firebase.auth.EmailAuthProvider;
/**
- * Activity to control the entire email sign up flow. Plays host to {@link CheckEmailFragment}
- * and {@link RegisterEmailFragment} and triggers {@link WelcomeBackPasswordPrompt}
- * and {@link WelcomeBackIdpPrompt}.
+ * Activity to control the entire email sign up flow. Plays host to {@link CheckEmailFragment} and
+ * {@link RegisterEmailFragment} and triggers {@link WelcomeBackPasswordPrompt} and {@link
+ * WelcomeBackIdpPrompt}.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class RegisterEmailActivity extends AppCompatBase implements
@@ -96,8 +96,8 @@ public void onExistingEmailUser(User user) {
WelcomeBackPasswordPrompt.createIntent(
this,
getFlowParams(),
- new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID,
- user.getEmail()).build()),
+ new IdpResponse.Builder(
+ EmailAuthProvider.PROVIDER_ID, user.getEmail()).build()),
RC_SIGN_IN);
setSlideAnimation();
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailFragment.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailFragment.java
index ecc3a5604..ae210769e 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailFragment.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailFragment.java
@@ -10,6 +10,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
import com.firebase.ui.auth.IdpResponse;
@@ -21,7 +22,6 @@
import com.firebase.ui.auth.ui.HelperActivityBase;
import com.firebase.ui.auth.ui.ImeHelper;
import com.firebase.ui.auth.ui.TaskFailureLogger;
-import com.firebase.ui.auth.ui.TermsTextView;
import com.firebase.ui.auth.ui.User;
import com.firebase.ui.auth.ui.accountlink.WelcomeBackIdpPrompt;
import com.firebase.ui.auth.ui.accountlink.WelcomeBackPasswordPrompt;
@@ -57,7 +57,7 @@ public class RegisterEmailFragment extends FragmentBase implements
private EditText mEmailEditText;
private EditText mNameEditText;
private EditText mPasswordEditText;
- private TermsTextView mAgreementText;
+ private TextView mAgreementText;
private TextInputLayout mEmailInput;
private TextInputLayout mPasswordInput;
@@ -100,7 +100,7 @@ public View onCreateView(LayoutInflater inflater,
mEmailEditText = (EditText) v.findViewById(R.id.email);
mNameEditText = (EditText) v.findViewById(R.id.name);
mPasswordEditText = (EditText) v.findViewById(R.id.password);
- mAgreementText = (TermsTextView) v.findViewById(R.id.create_account_text);
+ mAgreementText = (TextView) v.findViewById(R.id.create_account_text);
mEmailInput = (TextInputLayout) v.findViewById(R.id.email_layout);
mPasswordInput = (TextInputLayout) v.findViewById(R.id.password_layout);
@@ -167,16 +167,17 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
mActivity = (HelperActivityBase) getActivity();
mSaveSmartLock = AuthInstances.getSaveSmartLockInstance(getActivity(), getFlowParams());
- mAgreementText.showTerms(getFlowParams(), R.string.button_text_save);
+ new PreambleHandler(getContext(), getFlowParams(), R.string.button_text_save)
+ .setPreamble(mAgreementText);
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putParcelable(ExtraConstants.EXTRA_USER,
- new User.Builder(mEmailEditText.getText().toString())
- .setName(mNameEditText.getText().toString())
- .setPhotoUri(mUser.getPhotoUri())
- .build());
+ new User.Builder(mEmailEditText.getText().toString())
+ .setName(mNameEditText.getText().toString())
+ .setPhotoUri(mUser.getPhotoUri())
+ .build());
super.onSaveInstanceState(outState);
}
@@ -247,7 +248,7 @@ public void onComplete(@NonNull Task task) {
mActivity.saveCredentialsOrFinish(
mSaveSmartLock, user, password,
new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID,
- email).build());
+ email).build());
}
});
}
@@ -273,16 +274,15 @@ public void onFailure(@NonNull Exception e) {
@Override
public void onSuccess(String provider) {
Toast.makeText(getContext(),
- R.string.error_user_collision,
- Toast.LENGTH_LONG)
+ R.string.error_user_collision,
+ Toast.LENGTH_LONG)
.show();
if (provider == null) {
- String msg =
+ throw new IllegalStateException(
"User has no providers even though " +
- "we got a " +
- "FirebaseAuthUserCollisionException";
- throw new IllegalStateException(msg);
+ "we got a " +
+ "FirebaseAuthUserCollisionException");
} else if (EmailAuthProvider.PROVIDER_ID.equalsIgnoreCase(
provider)) {
getActivity().startActivityForResult(
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/package-info.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/package-info.java
index dcb0d5dc4..a60dd128a 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/package-info.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/package-info.java
@@ -13,8 +13,8 @@
*/
/**
- * Contains utility classes for validating {@link android.widget.EditText} field contents.
- * The contents of this package should be considered an implementation detail and not part of
- * the main API.
+ * Contains utility classes for validating {@link android.widget.EditText} field contents. The
+ * contents of this package should be considered an implementation detail and not part of the main
+ * API.
*/
package com.firebase.ui.auth.ui.email.fieldvalidators;
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java
index 36abadcfe..b1331f2ba 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java
@@ -28,7 +28,6 @@
import com.firebase.ui.auth.AuthUI.IdpConfig;
import com.firebase.ui.auth.IdpResponse;
import com.firebase.ui.auth.R;
-import com.firebase.ui.auth.provider.ProviderUtils;
import com.firebase.ui.auth.provider.EmailProvider;
import com.firebase.ui.auth.provider.FacebookProvider;
import com.firebase.ui.auth.provider.GoogleProvider;
@@ -36,6 +35,7 @@
import com.firebase.ui.auth.provider.IdpProvider.IdpCallback;
import com.firebase.ui.auth.provider.PhoneProvider;
import com.firebase.ui.auth.provider.Provider;
+import com.firebase.ui.auth.provider.ProviderUtils;
import com.firebase.ui.auth.provider.TwitterProvider;
import com.firebase.ui.auth.ui.AppCompatBase;
import com.firebase.ui.auth.ui.FlowParameters;
@@ -50,11 +50,11 @@
import java.util.List;
/**
- * Presents the list of authentication options for this app to the user. If an
- * identity provider option is selected, a {@link CredentialSignInHandler}
- * is launched to manage the IDP-specific sign-in flow. If email authentication is chosen,
- * the {@link RegisterEmailActivity} is started. if phone authentication is chosen, the
- * {@link com.firebase.ui.auth.ui.phone.PhoneVerificationActivity} is started.
+ * Presents the list of authentication options for this app to the user. If an identity provider
+ * option is selected, a {@link CredentialSignInHandler} is launched to manage the IDP-specific
+ * sign-in flow. If email authentication is chosen, the {@link RegisterEmailActivity} is started. if
+ * phone authentication is chosen, the {@link com.firebase.ui.auth.ui.phone.PhoneVerificationActivity}
+ * is started.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class AuthMethodPickerActivity extends AppCompatBase implements IdpCallback {
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/BucketedTextChangeListener.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/BucketedTextChangeListener.java
index 0de8728c4..ee63b73a6 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/BucketedTextChangeListener.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/BucketedTextChangeListener.java
@@ -38,6 +38,20 @@
* 764176
*/
final class BucketedTextChangeListener implements TextWatcher {
+ interface ContentChangeCallback {
+ /**
+ * Idempotent function invoked by the listener when the edit text changes and is of expected
+ * length
+ */
+ void whileComplete();
+
+ /**
+ * Idempotent function invoked by the listener when the edit text changes and is not of
+ * expected length
+ */
+ void whileIncomplete();
+ }
+
private final EditText editText;
private final ContentChangeCallback callback;
private final String[] postFixes;
@@ -108,18 +122,4 @@ private String[] generatePostfixArray(CharSequence repeatableChar, int length) {
return ret;
}
-
- interface ContentChangeCallback {
- /**
- * Idempotent function invoked by the listener when the edit text changes and is of
- * expected length
- */
- void whileComplete();
-
- /**
- * Idempotent function invoked by the listener when the edit text changes and is not of
- * expected length
- */
- void whileIncomplete();
- }
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryInfo.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryInfo.java
index f514e1057..569cbcf66 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryInfo.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryInfo.java
@@ -34,6 +34,20 @@ public CountryInfo(Locale locale, int countryCode) {
this.countryCode = countryCode;
}
+ public static String localeToEmoji(Locale locale) {
+ String countryCode = locale.getCountry();
+ // 0x41 is Letter A
+ // 0x1F1E6 is Regional Indicator Symbol Letter A
+ // Example :
+ // firstLetter U => 20 + 0x1F1E6
+ // secondLetter S => 18 + 0x1F1E6
+ // See: https://en.wikipedia.org/wiki/Regional_Indicator_Symbol
+ int firstLetter = Character.codePointAt(countryCode, 0) - 0x41 + 0x1F1E6;
+ int secondLetter = Character.codePointAt(countryCode, 1) - 0x41 + 0x1F1E6;
+ return new String(Character.toChars(firstLetter)) + new String(Character.toChars
+ (secondLetter));
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -57,20 +71,6 @@ public String toString() {
return localeToEmoji(locale) + " " + this.locale.getDisplayCountry() + " +" + countryCode;
}
- public static String localeToEmoji(Locale locale) {
- String countryCode = locale.getCountry();
- // 0x41 is Letter A
- // 0x1F1E6 is Regional Indicator Symbol Letter A
- // Example :
- // firstLetter U => 20 + 0x1F1E6
- // secondLetter S => 18 + 0x1F1E6
- // See: https://en.wikipedia.org/wiki/Regional_Indicator_Symbol
- int firstLetter = Character.codePointAt(countryCode, 0) - 0x41 + 0x1F1E6;
- int secondLetter = Character.codePointAt(countryCode, 1) - 0x41 + 0x1F1E6;
- return new String(Character.toChars(firstLetter)) + new String(Character.toChars
- (secondLetter));
- }
-
@Override
public int compareTo(CountryInfo info) {
return collator.compare(this.locale.getDisplayCountry(), info.locale.getDisplayCountry());
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListLoadTask.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListLoadTask.java
index 3c3c3f603..30b1bb25a 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListLoadTask.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListLoadTask.java
@@ -28,6 +28,10 @@
// We need to move away from ListView and AsyncTask in the future and use (say)
// RecyclerView and Task/ThreadPoolExecutor .
final class CountryListLoadTask extends AsyncTask> {
+ public interface Listener {
+ void onLoadComplete(List result);
+ }
+
private static final int MAX_COUNTRIES = 291;
private final Listener listener;
@@ -295,8 +299,4 @@ protected void onPostExecute(List result) {
listener.onLoadComplete(result);
}
}
-
- public interface Listener {
- void onLoadComplete(List result);
- }
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java
index dda0e7c16..b1f3c2c4d 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
-import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.AppCompatEditText;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -54,9 +53,11 @@ public CountryListSpinner(Context context, AttributeSet attrs, int defStyle) {
init();
}
- @VisibleForTesting
- void setDialogPopup(DialogPopup dialog) {
- this.dialogPopup = dialog;
+ public static void hideKeyboard(Context context, View view) {
+ final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+ }
}
private void init() {
@@ -173,12 +174,4 @@ public void onClick(DialogInterface dialog, int which) {
dismiss();
}
}
-
- public static void hideKeyboard(Context context, View view) {
- final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context
- .INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
- }
- }
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumber.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumber.java
index 90eb9eb88..2bbf22526 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumber.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumber.java
@@ -39,6 +39,21 @@ public static PhoneNumber emptyPhone() {
return EMPTY_PHONE_NUMBER;
}
+ public static boolean isValid(PhoneNumber phoneNumber) {
+ return phoneNumber != null
+ && !EMPTY_PHONE_NUMBER.equals(phoneNumber)
+ && !TextUtils.isEmpty(phoneNumber.getPhoneNumber())
+ && !TextUtils.isEmpty(phoneNumber.getCountryCode())
+ && !TextUtils.isEmpty(phoneNumber.getCountryIso());
+ }
+
+ public static boolean isCountryValid(PhoneNumber phoneNumber) {
+ return phoneNumber != null
+ && !EMPTY_PHONE_NUMBER.equals(phoneNumber)
+ && !TextUtils.isEmpty(phoneNumber.getCountryCode())
+ && !TextUtils.isEmpty(phoneNumber.getCountryIso());
+ }
+
/**
* Returns country code
*/
@@ -59,16 +74,4 @@ public String getPhoneNumber() {
public String getCountryIso() {
return countryIso;
}
-
- public static boolean isValid(PhoneNumber phoneNumber) {
- return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils
- .isEmpty(phoneNumber.getPhoneNumber()) && !TextUtils.isEmpty(phoneNumber
- .getCountryCode()) && !TextUtils.isEmpty(phoneNumber.getCountryIso());
- }
-
- public static boolean isCountryValid(PhoneNumber phoneNumber) {
- return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils
- .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber
- .getCountryIso());
- }
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumberUtils.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumberUtils.java
index bd43ff9c8..b7b16b346 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumberUtils.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumberUtils.java
@@ -47,30 +47,26 @@ final class PhoneNumberUtils {
private static final Map CountryCodeByIsoMap;
static {
- CountryCodeToRegionCodeMap = Collections.unmodifiableMap(createCountryCodeToRegionCodeMap
- ());
+ CountryCodeToRegionCodeMap = Collections.unmodifiableMap(createCountryCodeToRegionCodeMap());
CountryCodeByIsoMap = Collections.unmodifiableMap(createCountryCodeByIsoMap());
}
/**
- * This method may be used to force initialize the static members in the class.
- * It is recommended to do this in the background since the HashMaps created above
- * may be time consuming operations on some devices.
+ * This method may be used to force initialize the static members in the class. It is
+ * recommended to do this in the background since the HashMaps created above may be time
+ * consuming operations on some devices.
*/
static void load() {
}
/**
- * This method works as follow:
- *
When the android version is LOLLIPOP or greater, the reliable
- * {{@link android.telephony.PhoneNumberUtils#formatNumberToE164}} is used to format.
- *
For lower versions, we construct a value with the input phone number stripped of
- * non numeric characters and prefix it with a "+" and country code
- *
-
+ * This method works as follow:
When the android version is LOLLIPOP or greater, the
+ * reliable {{@link android.telephony.PhoneNumberUtils#formatNumberToE164}} is used to
+ * format.
For lower versions, we construct a value with the input phone number
+ * stripped of non numeric characters and prefix it with a "+" and country code
+ *
* @param phoneNumber that may or may not itself have country code
* @param countryInfo must have locale with ISO 3166 2-letter code for country
- * @return
*/
@Nullable
static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) {
@@ -87,10 +83,10 @@ static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInf
/**
- * This method uses the country returned by {@link #getCurrentCountryInfo(Context)} to
- * format the phone number. Internall invokes {@link #formatPhoneNumber(String, CountryInfo)}
+ * This method uses the country returned by {@link #getCurrentCountryInfo(Context)} to format
+ * the phone number. Internall invokes {@link #formatPhoneNumber(String, CountryInfo)}
+ *
* @param phoneNumber that may or may not itself have country code
- * @return
*/
@Nullable
@@ -118,10 +114,10 @@ static CountryInfo getCurrentCountryInfo(@NonNull Context context) {
}
/**
- * This method should not be called on UI thread. Potentially creates a country code by iso
- * map which can take long in some devices
- * @param providedPhoneNumber works best when formatted as e164
+ * This method should not be called on UI thread. Potentially creates a country code by iso map
+ * which can take long in some devices
*
+ * @param providedPhoneNumber works best when formatted as e164
* @return an instance of the PhoneNumber using the SIM information
*/
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneVerificationActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneVerificationActivity.java
index f4eb14451..e3cd5aafa 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneVerificationActivity.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneVerificationActivity.java
@@ -35,7 +35,6 @@
import com.firebase.ui.auth.ui.FlowParameters;
import com.firebase.ui.auth.ui.HelperActivityBase;
import com.firebase.ui.auth.util.AuthInstances;
-import com.firebase.ui.auth.util.signincontainer.SaveSmartLock;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.FirebaseException;
@@ -49,28 +48,28 @@
import java.util.concurrent.TimeUnit;
/**
- * Activity to control the entire phone verification flow. Plays host to
- * {@link VerifyPhoneNumberFragment} and {@link SubmitConfirmationCodeFragment}
+ * Activity to control the entire phone verification flow. Plays host to {@link
+ * VerifyPhoneNumberFragment} and {@link SubmitConfirmationCodeFragment}
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class PhoneVerificationActivity extends AppCompatBase {
- private static final String PHONE_VERIFICATION_LOG_TAG = "PhoneVerification";
- static final long SHORT_DELAY_MILLIS = 750;
- static final long AUTO_RETRIEVAL_TIMEOUT_MILLIS = 120000;
- static final String ERROR_INVALID_PHONE = "ERROR_INVALID_PHONE_NUMBER";
- static final String ERROR_INVALID_VERIFICATION = "ERROR_INVALID_VERIFICATION_CODE";
- static final String ERROR_TOO_MANY_REQUESTS = "ERROR_TOO_MANY_REQUESTS";
- static final String ERROR_QUOTA_EXCEEDED = "ERROR_QUOTA_EXCEEDED";
- static final String ERROR_SESSION_EXPIRED = "ERROR_SESSION_EXPIRED";
- static final String KEY_VERIFICATION_PHONE = "KEY_VERIFICATION_PHONE";
- static final String KEY_STATE = "KEY_STATE";
-
- enum VerificationState {
+ private enum VerificationState {
VERIFICATION_NOT_STARTED, VERIFICATION_STARTED, VERIFIED;
}
+ private static final String PHONE_VERIFICATION_LOG_TAG = "PhoneVerification";
+
+ private static final long SHORT_DELAY_MILLIS = 750;
+ @VisibleForTesting static final long AUTO_RETRIEVAL_TIMEOUT_MILLIS = 120000;
+ @VisibleForTesting static final String ERROR_INVALID_PHONE = "ERROR_INVALID_PHONE_NUMBER";
+ @VisibleForTesting static final String ERROR_INVALID_VERIFICATION = "ERROR_INVALID_VERIFICATION_CODE";
+ private static final String ERROR_TOO_MANY_REQUESTS = "ERROR_TOO_MANY_REQUESTS";
+ private static final String ERROR_QUOTA_EXCEEDED = "ERROR_QUOTA_EXCEEDED";
+ private static final String ERROR_SESSION_EXPIRED = "ERROR_SESSION_EXPIRED";
+ private static final String KEY_VERIFICATION_PHONE = "KEY_VERIFICATION_PHONE";
+ private static final String KEY_STATE = "KEY_STATE";
+
private AlertDialog mAlertDialog;
- private SaveSmartLock mSaveSmartLock;
private CompletableProgressDialog mProgressDialog;
private Handler mHandler;
private String mPhoneNumber;
@@ -89,7 +88,6 @@ protected void onCreate(final Bundle savedInstance) {
super.onCreate(savedInstance);
setContentView(R.layout.activity_register_phone);
- mSaveSmartLock = AuthInstances.getSaveSmartLockInstance(this, getFlowParams());
mHandler = new Handler();
mVerificationState = VerificationState.VERIFICATION_NOT_STARTED;
if (savedInstance != null && !savedInstance.isEmpty()) {
@@ -103,14 +101,16 @@ protected void onCreate(final Bundle savedInstance) {
String phone = getIntent().getExtras().getString(ExtraConstants.EXTRA_PHONE);
VerifyPhoneNumberFragment fragment = VerifyPhoneNumberFragment.newInstance
(getFlowParams(), phone);
- getSupportFragmentManager().beginTransaction().replace(R.id.fragment_verify_phone,
- fragment, VerifyPhoneNumberFragment.TAG).disallowAddToBackStack().commit();
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_verify_phone, fragment, VerifyPhoneNumberFragment.TAG)
+ .disallowAddToBackStack()
+ .commit();
}
@Override
protected void onStart() {
super.onStart();
- //Actvitiy can be restarted in any of the following states
+ // Activity can be restarted in any of the following states
// 1) VERIFICATION_STARTED
// 2) SMS_RETRIEVED
// 3) INSTANT_VERIFIED
@@ -165,7 +165,7 @@ public void submitConfirmationCode(String confirmationCode) {
signingWithCreds(PhoneAuthProvider.getCredential(mVerificationId, confirmationCode));
}
- void onVerificationSuccess(@NonNull final PhoneAuthCredential phoneAuthCredential) {
+ private void onVerificationSuccess(@NonNull final PhoneAuthCredential phoneAuthCredential) {
if (TextUtils.isEmpty(phoneAuthCredential.getSmsCode())) {
signingWithCreds(phoneAuthCredential);
} else {
@@ -184,7 +184,7 @@ void onVerificationSuccess(@NonNull final PhoneAuthCredential phoneAuthCredentia
}
}
- void onCodeSent() {
+ private void onCodeSent() {
completeLoadingDialog(getString(R.string.code_sent));
mHandler.postDelayed(new Runnable() {
@Override
@@ -195,7 +195,7 @@ public void run() {
}, SHORT_DELAY_MILLIS);
}
- void onVerificationFailed(@NonNull FirebaseException ex) {
+ private void onVerificationFailed(@NonNull FirebaseException ex) {
VerifyPhoneNumberFragment verifyPhoneNumberFragment = (VerifyPhoneNumberFragment)
getSupportFragmentManager().findFragmentByTag(VerifyPhoneNumberFragment.TAG);
@@ -229,41 +229,43 @@ void onVerificationFailed(@NonNull FirebaseException ex) {
}
}
-
private void sendCode(String phoneNumber, boolean forceResend) {
mPhoneNumber = phoneNumber;
mVerificationState = VerificationState.VERIFICATION_STARTED;
- AuthInstances.getPhoneAuthProviderInstance().verifyPhoneNumber(phoneNumber,
- AUTO_RETRIEVAL_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, this, new PhoneAuthProvider
- .OnVerificationStateChangedCallbacks() {
- @Override
- public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) {
- if (!mIsDestroyed) {
- PhoneVerificationActivity.this.onVerificationSuccess(phoneAuthCredential);
- }
- }
+ AuthInstances.getPhoneAuthProviderInstance().verifyPhoneNumber(
+ phoneNumber,
+ AUTO_RETRIEVAL_TIMEOUT_MILLIS,
+ TimeUnit.MILLISECONDS,
+ this,
+ new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
+ @Override
+ public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) {
+ if (!mIsDestroyed) {
+ PhoneVerificationActivity.this.onVerificationSuccess(phoneAuthCredential);
+ }
+ }
- @Override
- public void onVerificationFailed(FirebaseException ex) {
- if (!mIsDestroyed) {
- PhoneVerificationActivity.this.onVerificationFailed(ex);
- }
- }
+ @Override
+ public void onVerificationFailed(FirebaseException ex) {
+ if (!mIsDestroyed) {
+ PhoneVerificationActivity.this.onVerificationFailed(ex);
+ }
+ }
- @Override
- public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider
- .ForceResendingToken forceResendingToken) {
- mVerificationId = verificationId;
- mForceResendingToken = forceResendingToken;
- if (!mIsDestroyed) {
- PhoneVerificationActivity.this.onCodeSent();
- }
- }
- }, forceResend ? mForceResendingToken : null);
+ @Override
+ public void onCodeSent(@NonNull String verificationId,
+ @NonNull PhoneAuthProvider.ForceResendingToken forceResendingToken) {
+ mVerificationId = verificationId;
+ mForceResendingToken = forceResendingToken;
+ if (!mIsDestroyed) {
+ PhoneVerificationActivity.this.onCodeSent();
+ }
+ }
+ },
+ forceResend ? mForceResendingToken : null);
}
-
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
protected AlertDialog getAlertDialog() {
// It is hard to test AlertDialogs currently with robo electric. See:
@@ -277,9 +279,9 @@ private void showSubmitCodeFragment() {
if (getSubmitConfirmationCodeFragment() == null) {
SubmitConfirmationCodeFragment f = SubmitConfirmationCodeFragment.newInstance(
getFlowParams(), mPhoneNumber);
- FragmentTransaction t = getSupportFragmentManager().beginTransaction().replace(R.id
- .fragment_verify_phone, f, SubmitConfirmationCodeFragment.TAG).addToBackStack
- (null);
+ FragmentTransaction t = getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_verify_phone, f, SubmitConfirmationCodeFragment.TAG)
+ .addToBackStack(null);
if (!isFinishing() && !mIsDestroyed) {
t.commitAllowingStateLoss();
@@ -307,61 +309,62 @@ private void signingWithCreds(@NonNull PhoneAuthCredential phoneAuthCredential)
AuthInstances.getFirebaseAuth(getFlowParams())
.signInWithCredential(phoneAuthCredential)
.addOnSuccessListener(this, new OnSuccessListener() {
- @Override
- public void onSuccess(final AuthResult authResult) {
- mVerificationState = VerificationState.VERIFIED;
- completeLoadingDialog(getString(R.string.verified));
-
- // Activity can be recreated before this message is handled
- mHandler.postDelayed(new Runnable() {
@Override
- public void run() {
- if (!mIsDestroyed) {
- dismissLoadingDialog();
- finish(authResult.getUser());
- }
- }
- }, SHORT_DELAY_MILLIS);
- }
- }).addOnFailureListener(this, new OnFailureListener() {
- @Override
- public void onFailure(@NonNull Exception e) {
- dismissLoadingDialog();
- //incorrect confirmation code
- if (e instanceof FirebaseAuthInvalidCredentialsException) {
- FirebaseAuthInvalidCredentialsException firebaseAuthInvalidCredentialsException
- = (FirebaseAuthInvalidCredentialsException) e;
- switch (firebaseAuthInvalidCredentialsException.getErrorCode()) {
- case ERROR_INVALID_VERIFICATION:
- showAlertDialog(getString(R.string.incorrect_code_dialog_body), new
- DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- SubmitConfirmationCodeFragment f
- = getSubmitConfirmationCodeFragment();
- f.setConfirmationCode("");
- }
- });
- break;
- case ERROR_SESSION_EXPIRED:
- showAlertDialog(getString(R.string.error_session_expired), new
- DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- SubmitConfirmationCodeFragment f
- = getSubmitConfirmationCodeFragment();
- f.setConfirmationCode("");
+ public void onSuccess(final AuthResult authResult) {
+ mVerificationState = VerificationState.VERIFIED;
+ completeLoadingDialog(getString(R.string.verified));
+
+ // Activity can be recreated before this message is handled
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ if (!mIsDestroyed) {
+ dismissLoadingDialog();
+ finish(authResult.getUser());
}
- });
- break;
- default:
+ }
+ }, SHORT_DELAY_MILLIS);
+ }
+ })
+ .addOnFailureListener(this, new OnFailureListener() {
+ @Override
+ public void onFailure(@NonNull Exception e) {
+ dismissLoadingDialog();
+ //incorrect confirmation code
+ if (e instanceof FirebaseAuthInvalidCredentialsException) {
+ FirebaseAuthInvalidCredentialsException firebaseAuthInvalidCredentialsException
+ = (FirebaseAuthInvalidCredentialsException) e;
+ switch (firebaseAuthInvalidCredentialsException.getErrorCode()) {
+ case ERROR_INVALID_VERIFICATION:
+ showAlertDialog(
+ getString(R.string.incorrect_code_dialog_body),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ getSubmitConfirmationCodeFragment()
+ .setConfirmationCode("");
+ }
+ });
+ break;
+ case ERROR_SESSION_EXPIRED:
+ showAlertDialog(
+ getString(R.string.error_session_expired),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ getSubmitConfirmationCodeFragment()
+ .setConfirmationCode("");
+ }
+ });
+ break;
+ default:
+ showAlertDialog(e.getLocalizedMessage(), null);
+ }
+ } else {
showAlertDialog(e.getLocalizedMessage(), null);
+ }
}
- } else {
- showAlertDialog(e.getLocalizedMessage(), null);
- }
- }
- });
+ });
}
private void completeLoadingDialog(String content) {
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/SpacedEditText.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/SpacedEditText.java
index 998391141..411ce7f44 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/SpacedEditText.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/SpacedEditText.java
@@ -31,8 +31,8 @@
/**
* This element inserts spaces between characters in the edit text and expands the width of the
- * spaces using spannables.
- * This is required since Android's letter spacing is not available until API 21.
+ * spaces using spannables. This is required since Android's letter spacing is not available until
+ * API 21.
*/
public final class SpacedEditText extends AppCompatEditText {
private float proportion;
@@ -64,8 +64,6 @@ public void setText(CharSequence text, BufferType type) {
/**
* Set the selection after recalculating the index intended by the caller.
- *
- * @param index
*/
@Override
public void setSelection(int index) {
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
index 1bf5efde1..d3e3c31f2 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java
@@ -33,7 +33,7 @@
import com.firebase.ui.auth.ui.ExtraConstants;
import com.firebase.ui.auth.ui.FlowParameters;
import com.firebase.ui.auth.ui.FragmentBase;
-import com.firebase.ui.auth.ui.TermsTextView;
+import com.firebase.ui.auth.ui.email.PreambleHandler;
/**
* Display confirmation code to verify phone numbers input in {{@link VerifyPhoneNumberFragment}}
@@ -53,7 +53,7 @@ public class SubmitConfirmationCodeFragment extends FragmentBase {
private Button mSubmitConfirmationButton;
private CustomCountDownTimer mCountdownTimer;
private PhoneVerificationActivity mVerifier;
- private TermsTextView mAgreementText;
+ private TextView mAgreementText;
private long mMillisUntilFinished;
public static SubmitConfirmationCodeFragment newInstance(FlowParameters flowParameters,
@@ -80,7 +80,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
mResendCodeTextView = (TextView) v.findViewById(R.id.resend_code);
mConfirmationCodeEditText = (SpacedEditText) v.findViewById(R.id.confirmation_code);
mSubmitConfirmationButton = (Button) v.findViewById(R.id.submit_confirmation_code);
- mAgreementText = (TermsTextView) v.findViewById(R.id.create_account_tos);
+ mAgreementText = (TextView) v.findViewById(R.id.create_account_tos);
final String phoneNumber = getArguments().getString(ExtraConstants.EXTRA_PHONE);
@@ -224,11 +224,12 @@ private void cancelTimer() {
}
private void setUpTermsOfService() {
- mAgreementText.showTerms(getFlowParams(), R.string.continue_phone_login);
+ new PreambleHandler(getContext(), getFlowParams(), R.string.continue_phone_login)
+ .setPreamble(mAgreementText);
}
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
- CustomCountDownTimer getmCountdownTimer() {
+ CustomCountDownTimer getCountdownTimer() {
return mCountdownTimer;
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/VerifyPhoneNumberFragment.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/VerifyPhoneNumberFragment.java
index 485f31ffb..2dd7dc4e9 100644
--- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/VerifyPhoneNumberFragment.java
+++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/VerifyPhoneNumberFragment.java
@@ -52,6 +52,7 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class VerifyPhoneNumberFragment extends FragmentBase implements View.OnClickListener {
public static final String TAG = "VerifyPhoneFragment";
+ private static final int RC_PHONE_HINT = 22;
private Context mAppContext;
@@ -62,8 +63,6 @@ public class VerifyPhoneNumberFragment extends FragmentBase implements View.OnCl
private PhoneVerificationActivity mVerifier;
private TextView mSmsTermsText;
- private static final int RC_PHONE_HINT = 22;
-
public static VerifyPhoneNumberFragment newInstance(FlowParameters flowParameters,
String phone) {
VerifyPhoneNumberFragment fragment = new VerifyPhoneNumberFragment();
@@ -149,9 +148,8 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
// To accommodate either case, we normalize to e164 with best effort
final String unformattedPhone = cred.getId();
final String formattedPhone =
- PhoneNumberUtils
- .formatPhoneNumberUsingCurrentCountry(unformattedPhone,
- mAppContext);
+ PhoneNumberUtils.formatPhoneNumberUsingCurrentCountry(unformattedPhone,
+ mAppContext);
if (formattedPhone == null) {
Log.e(TAG, "Unable to normalize phone number from hint selector:"
+ unformattedPhone);
@@ -211,20 +209,27 @@ private void showPhoneAutoCompleteHint() {
}
private PendingIntent getPhoneHintIntent() {
- GoogleApiClient client = new GoogleApiClient.Builder(getContext()).addApi(Auth
- .CREDENTIALS_API).enableAutoManage(getActivity(), GoogleApiHelper
- .getSafeAutoManageId(), new GoogleApiClient.OnConnectionFailedListener() {
- @Override
- public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
- Log.e(TAG, "Client connection failed: " + connectionResult.getErrorMessage());
- }
- }).build();
-
-
- HintRequest hintRequest = new HintRequest.Builder().setHintPickerConfig(new
- CredentialPickerConfig.Builder().setShowCancelButton(true).build())
- .setPhoneNumberIdentifierSupported(true).setEmailAddressIdentifierSupported
- (false).build();
+ GoogleApiClient client = new GoogleApiClient.Builder(getContext())
+ .addApi(Auth.CREDENTIALS_API)
+ .enableAutoManage(
+ getActivity(),
+ GoogleApiHelper.getSafeAutoManageId(),
+ new GoogleApiClient.OnConnectionFailedListener() {
+ @Override
+ public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
+ Log.e(TAG,
+ "Client connection failed: " + connectionResult.getErrorMessage());
+ }
+ })
+ .build();
+
+
+ HintRequest hintRequest = new HintRequest.Builder()
+ .setHintPickerConfig(
+ new CredentialPickerConfig.Builder().setShowCancelButton(true).build())
+ .setPhoneNumberIdentifierSupported(true)
+ .setEmailAddressIdentifierSupported(false)
+ .build();
return Auth.CredentialsApi.getHintPickerIntent(client, hintRequest);
}
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/AbstractActivityLifecycleCallbacks.java b/auth/src/main/java/com/firebase/ui/auth/util/AbstractActivityLifecycleCallbacks.java
deleted file mode 100644
index a4e1a45a8..000000000
--- a/auth/src/main/java/com/firebase/ui/auth/util/AbstractActivityLifecycleCallbacks.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.firebase.ui.auth.util;
-
-import android.app.Activity;
-import android.app.Application;
-import android.os.Bundle;
-
-/**
- * Implementation of {@link android.app.Application.ActivityLifecycleCallbacks} which
- * does nothing in response to each callback; a useful base class for implementors that only
- * care about a subset of the callbacks.
- */
-public abstract class AbstractActivityLifecycleCallbacks
- implements Application.ActivityLifecycleCallbacks {
-
- @Override
- public void onActivityCreated(Activity activity, Bundle bundle) {}
-
- @Override
- public void onActivityStarted(Activity activity) {}
-
- @Override
- public void onActivityResumed(Activity activity) {}
-
- @Override
- public void onActivityPaused(Activity activity) {}
-
- @Override
- public void onActivityStopped(Activity activity) {}
-
- @Override
- public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {}
-
- @Override
- public void onActivityDestroyed(Activity activity) {}
-}
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/AuthInstances.java b/auth/src/main/java/com/firebase/ui/auth/util/AuthInstances.java
index dbf9e7b7a..68745e8b9 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/AuthInstances.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/AuthInstances.java
@@ -13,8 +13,8 @@
import com.google.firebase.auth.PhoneAuthProvider;
/**
- * Factory for instances of authentication classes. Should eventually be replaced by
- * dependency injection.
+ * Factory for instances of authentication classes. Should eventually be replaced by dependency
+ * injection.
*/
public class AuthInstances {
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/PlayServicesHelper.java b/auth/src/main/java/com/firebase/ui/auth/util/PlayServicesHelper.java
index bdfb54ac2..c19dfa19b 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/PlayServicesHelper.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/PlayServicesHelper.java
@@ -7,8 +7,8 @@
import com.google.android.gms.common.GoogleApiAvailability;
/**
- * Helper class wrapping {@link GoogleApiAvailability}. Used internally but can also be used
- * by client application
+ * Helper class wrapping {@link GoogleApiAvailability}. Used internally but can also be used by
+ * client application
*/
public class PlayServicesHelper {
private static GoogleApiAvailability mApiAvailability;
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java b/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
index 62eac357b..9f66f7b2b 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/Preconditions.java
@@ -27,8 +27,8 @@ private Preconditions() {
}
/**
- * Ensures that the provided value is not null, and throws a {@link NullPointerException}
- * if it is null, with a message constructed from the provided error template and arguments.
+ * Ensures that the provided value is not null, and throws a {@link NullPointerException} if it
+ * is null, with a message constructed from the provided error template and arguments.
*/
public static T checkNotNull(
T val,
@@ -41,9 +41,9 @@ public static T checkNotNull(
}
/**
- * Ensures that the provided identifier matches a known style resource, and throws
- * an {@link IllegalArgumentException} if the resource cannot be found, or is not
- * a style resource, with a message constructed from the provided error template and arguments.
+ * Ensures that the provided identifier matches a known style resource, and throws an {@link
+ * IllegalArgumentException} if the resource cannot be found, or is not a style resource, with a
+ * message constructed from the provided error template and arguments.
*/
@StyleRes
public static int checkValidStyle(
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/package-info.java b/auth/src/main/java/com/firebase/ui/auth/util/package-info.java
index 3a1fb19cc..fb47a43b3 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/package-info.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/package-info.java
@@ -13,8 +13,8 @@
*/
/**
- * Utilities to simplify interactions with {@code GoogleApiClient} and the APIs it provides,
- * such as Google Sign-in and Smart Lock for Passwords. The contents of this package should
- * be considered an implementation detail and not part of the main API.
+ * Utilities to simplify interactions with {@code GoogleApiClient} and the APIs it provides, such as
+ * Google Sign-in and Smart Lock for Passwords. The contents of this package should be considered an
+ * implementation detail and not part of the main API.
*/
package com.firebase.ui.auth.util;
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SaveSmartLock.java b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SaveSmartLock.java
index d1d42d7d4..fff8a34c5 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SaveSmartLock.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SaveSmartLock.java
@@ -127,8 +127,8 @@ public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
PendingIntent resolution =
PlayServicesHelper.getGoogleApiAvailability()
.getErrorResolutionPendingIntent(getContext(),
- connectionResult.getErrorCode(),
- RC_UPDATE_SERVICE);
+ connectionResult.getErrorCode(),
+ RC_UPDATE_SERVICE);
try {
startIntentSenderForResult(resolution.getIntentSender(), RC_UPDATE_SERVICE);
} catch (IntentSender.SendIntentException e) {
@@ -191,8 +191,8 @@ private void finish() {
* If SmartLock is enabled and Google Play Services is available, save the credentials.
* Otherwise, finish the calling Activity with {@link ResultCodes#OK RESULT_OK}.
*
- * Note: saveCredentialsOrFinish cannot be called immediately after getInstance because
- * onCreate has not yet been called.
+ * Note: saveCredentialsOrFinish cannot be called immediately after getInstance because onCreate
+ * has not yet been called.
*
* @param firebaseUser Firebase user to save in Credential.
* @param password (optional) password for email credential.
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java
index d888f87df..48fc292a0 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java
@@ -53,12 +53,10 @@
import java.util.Map;
/**
- * Attempts to acquire a credential from Smart Lock for Passwords to sign in
- * an existing account. If this succeeds, an attempt is made to sign the user in
- * with this credential. If it does not, the
- * {@link AuthMethodPickerActivity authentication method picker activity}
- * is started, unless only email is supported, in which case the
- * {@link RegisterEmailActivity} is started.
+ * Attempts to acquire a credential from Smart Lock for Passwords to sign in an existing account. If
+ * this succeeds, an attempt is made to sign the user in with this credential. If it does not, the
+ * {@link AuthMethodPickerActivity authentication method picker activity} is started, unless only
+ * email is supported, in which case the {@link RegisterEmailActivity} is started.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class SignInDelegate extends SmartLockBase {
@@ -111,10 +109,10 @@ public void onCreate(Bundle savedInstance) {
AuthInstances.getCredentialsApi()
.request(mGoogleApiClient,
- new CredentialRequest.Builder()
- .setPasswordLoginSupported(true)
- .setAccountTypes(getSupportedAccountTypes().toArray(new String[0]))
- .build())
+ new CredentialRequest.Builder()
+ .setPasswordLoginSupported(true)
+ .setAccountTypes(getSupportedAccountTypes().toArray(new String[0]))
+ .build())
.setResultCallback(this);
} else {
startAuthMethodChoice();
diff --git a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SmartLockBase.java b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SmartLockBase.java
index b71bde2b4..5e685d8b0 100644
--- a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SmartLockBase.java
+++ b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SmartLockBase.java
@@ -41,8 +41,8 @@ public abstract class SmartLockBase extends FragmentBase imple
private Pair mActivityResultPair;
/**
- * Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to
- * a Credentials API account type (such as {@link IdentityProviders#GOOGLE}).
+ * Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a
+ * Credentials API account type (such as {@link IdentityProviders#GOOGLE}).
*/
public static String providerIdToAccountType(@AuthUI.SupportedProvider @NonNull String providerId) {
switch (providerId) {
@@ -78,8 +78,8 @@ public static String accountTypeToProviderId(@NonNull String accountType) {
}
/**
- * Make a list of {@link Credential} from a FirebaseUser. Useful for deleting Credentials,
- * not for saving since we don't have access to the password.
+ * Make a list of {@link Credential} from a FirebaseUser. Useful for deleting Credentials, not
+ * for saving since we don't have access to the password.
*/
public static List credentialsFromFirebaseUser(@NonNull FirebaseUser user) {
if (TextUtils.isEmpty(user.getEmail())) {
@@ -158,8 +158,8 @@ public void finish(int resultCode, Intent resultIntent) {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Toast.makeText(getContext(),
- com.firebase.ui.auth.R.string.general_error,
- Toast.LENGTH_SHORT).show();
+ com.firebase.ui.auth.R.string.general_error,
+ Toast.LENGTH_SHORT).show();
}
@Override
diff --git a/auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml b/auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml
index 6d0ce05a2..f4f394622 100644
--- a/auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml
+++ b/auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml
@@ -5,6 +5,6 @@
android:viewportHeight="24.0"
android:viewportWidth="24.0">
+ android:fillColor="#FFFFFF"
+ android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z" />
diff --git a/auth/src/main/res/layout-land/auth_method_picker_layout.xml b/auth/src/main/res/layout-land/auth_method_picker_layout.xml
index 906facfe3..93d3b32f4 100644
--- a/auth/src/main/res/layout-land/auth_method_picker_layout.xml
+++ b/auth/src/main/res/layout-land/auth_method_picker_layout.xml
@@ -10,10 +10,10 @@
android:orientation="horizontal">
+ android:layout_weight="1.0"
+ layout="@layout/include_auth_method_picker_logo" />
@@ -29,7 +30,6 @@
+ android:typeface="monospace"
+ app:spacingProportion="1.1" />