diff --git a/README.md b/README.md index 23c4e6bae..366993963 100644 --- a/README.md +++ b/README.md @@ -39,16 +39,16 @@ libraries. ```groovy dependencies { // FirebaseUI Database only - compile 'com.firebaseui:firebase-ui-database:2.1.0' + compile 'com.firebaseui:firebase-ui-database:2.1.1' // FirebaseUI Auth only - compile 'com.firebaseui:firebase-ui-auth:2.1.0' + compile 'com.firebaseui:firebase-ui-auth:2.1.1' // FirebaseUI Storage only - compile 'com.firebaseui:firebase-ui-storage:2.1.0' + compile 'com.firebaseui:firebase-ui-storage:2.1.1' // Single target that includes all FirebaseUI libraries above - compile 'com.firebaseui:firebase-ui:2.1.0' + compile 'com.firebaseui:firebase-ui:2.1.1' } ``` @@ -91,7 +91,7 @@ For convenience, here are some recent examples: | FirebaseUI Version | Firebase/Play Services Version | |--------------------|--------------------------------| -| 2.1.0 | 11.0.2 | +| 2.1.1 | 11.0.2 | | 2.0.1 | 11.0.1 | | 1.2.0 | 10.2.0 | | 1.1.1 | 10.0.0 or 10.0.1 | diff --git a/auth/README.md b/auth/README.md index f9843296f..bf0778b7e 100644 --- a/auth/README.md +++ b/auth/README.md @@ -46,7 +46,7 @@ Gradle, add the dependency: ```groovy dependencies { // ... - compile 'com.firebaseui:firebase-ui-auth:2.1.0' + compile 'com.firebaseui:firebase-ui-auth:2.1.1' // Required only if Facebook login support is required compile('com.facebook.android:facebook-android-sdk:4.22.1') diff --git a/auth/build.gradle b/auth/build.gradle index 8613ea5a2..d14c5ad70 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -10,6 +10,8 @@ android { targetSdkVersion targetSdk versionCode 1 versionName "1.0" + + resourcePrefix "fui_" } buildTypes { @@ -43,6 +45,7 @@ android { dependencies { compile "com.android.support:design:$supportLibraryVersion" compile "com.android.support:customtabs:$supportLibraryVersion" + compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1' compile "com.google.firebase:firebase-auth:$firebaseVersion" compile "com.google.android.gms:play-services-auth:$firebaseVersion" diff --git a/auth/lint.xml b/auth/lint.xml new file mode 100644 index 000000000..c4af12697 --- /dev/null +++ b/auth/lint.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/auth/src/main/AndroidManifest.xml b/auth/src/main/AndroidManifest.xml index f3a1db420..a40d6cb44 100644 --- a/auth/src/main/AndroidManifest.xml +++ b/auth/src/main/AndroidManifest.xml @@ -32,34 +32,34 @@ + android:label="@string/fui_title_recover_password_activity" + android:exported="false"/> + android:label="@string/fui_sign_in_default" + android:exported="false"/> + android:label="@string/fui_sign_in_with_phone_number" + android:windowSoftInputMode="stateAlwaysVisible" + android:exported="false"/> + android:label="@string/fui_title_welcome_back_idp_prompt" + android:exported="false"/> + android:label="@string/fui_title_welcome_back_password_prompt" + android:exported="false"/> + android:label="@string/fui_default_toolbar_title" + android:exported="false"/> signOut(@NonNull FragmentActivity activity) { // Twitter sign out try { - TwitterProvider.signout(activity); + TwitterProvider.signOut(activity); } catch (NoClassDefFoundError e) { // do nothing } 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 36a882334..e9df58df1 100644 --- a/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java +++ b/auth/src/main/java/com/firebase/ui/auth/IdpResponse.java @@ -24,7 +24,6 @@ import com.firebase.ui.auth.ui.ExtraConstants; import com.google.firebase.auth.FacebookAuthProvider; -import com.google.firebase.auth.GithubAuthProvider; import com.google.firebase.auth.GoogleAuthProvider; import com.google.firebase.auth.TwitterAuthProvider; @@ -32,27 +31,21 @@ * A container that encapsulates the result of authenticating with an Identity Provider. */ public class IdpResponse implements Parcelable { - private final String mProviderId; - private final String mEmail; - private final String mPhoneNumber; + private final User mUser; private final String mToken; private final String mSecret; private final int mErrorCode; private IdpResponse(int errorCode) { - this(null, null, null, null, null, errorCode); + this(null, null, null, errorCode); } private IdpResponse( - String providerId, - String email, - String phoneNumber, + User user, String token, String secret, int errorCode) { - mProviderId = providerId; - mEmail = email; - mPhoneNumber = phoneNumber; + mUser = user; mToken = token; mSecret = secret; mErrorCode = errorCode; @@ -89,7 +82,7 @@ public Intent toIntent() { @NonNull @AuthUI.SupportedProvider public String getProviderType() { - return mProviderId; + return mUser.getProviderId(); } /** @@ -97,7 +90,7 @@ public String getProviderType() { */ @Nullable public String getEmail() { - return mEmail; + return mUser.getEmail(); } /** @@ -105,7 +98,7 @@ public String getEmail() { */ @Nullable public String getPhoneNumber() { - return mPhoneNumber; + return mUser.getPhoneNumber(); } /** @@ -138,9 +131,7 @@ public int describeContents() { @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(mProviderId); - dest.writeString(mEmail); - dest.writeString(mPhoneNumber); + dest.writeParcelable(mUser, flags); dest.writeString(mToken); dest.writeString(mSecret); dest.writeInt(mErrorCode); @@ -150,9 +141,7 @@ public void writeToParcel(Parcel dest, int flags) { @Override public IdpResponse createFromParcel(Parcel in) { return new IdpResponse( - in.readString(), - in.readString(), - in.readString(), + in.readParcelable(User.class.getClassLoader()), in.readString(), in.readString(), in.readInt() @@ -167,21 +156,12 @@ public IdpResponse[] newArray(int size) { @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public static class Builder { - private String mProviderId; - private String mEmail; - private String mPhoneNumber; + private User mUser; private String mToken; private String mSecret; - public Builder(@AuthUI.SupportedProvider @NonNull String providerId, - @Nullable String email) { - mProviderId = providerId; - mEmail = email; - } - - public Builder setPhoneNumber(String phoneNumber) { - mPhoneNumber = phoneNumber; - return this; + public Builder(@NonNull User user) { + mUser = user; } public Builder setToken(String token) { @@ -195,22 +175,21 @@ public Builder setSecret(String secret) { } public IdpResponse build() { - if ((mProviderId.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID) - || mProviderId.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID) - || mProviderId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID) - || mProviderId.equalsIgnoreCase(GithubAuthProvider.PROVIDER_ID)) + String providerId = mUser.getProviderId(); + if ((providerId.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID) + || providerId.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID) + || providerId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) && TextUtils.isEmpty(mToken)) { throw new IllegalStateException( "Token cannot be null when using a non-email provider."); } - if (mProviderId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID) + if (providerId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID) && TextUtils.isEmpty(mSecret)) { throw new IllegalStateException( "Secret cannot be null when using the Twitter provider."); } - return new IdpResponse( - mProviderId, mEmail, mPhoneNumber, mToken, mSecret, ResultCodes.OK); + return new IdpResponse(mUser, mToken, mSecret, ResultCodes.OK); } } } diff --git a/auth/src/main/java/com/firebase/ui/auth/User.java b/auth/src/main/java/com/firebase/ui/auth/User.java new file mode 100644 index 000000000..0fb9da13d --- /dev/null +++ b/auth/src/main/java/com/firebase/ui/auth/User.java @@ -0,0 +1,159 @@ +package com.firebase.ui.auth; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.os.Parcel; +import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.annotation.RestrictTo; + +import com.firebase.ui.auth.ui.ExtraConstants; + +@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) +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.readString(), + in.readParcelable(Uri.class.getClassLoader())); + } + + @Override + public User[] newArray(int size) { + return new User[size]; + } + }; + + private final String mProviderId; + private final String mEmail; + private final String mPhoneNumber; + private final String mName; + private final Uri mPhotoUri; + + private User(String providerId, String email, String phoneNumber, String name, Uri photoUri) { + mProviderId = providerId; + mEmail = email; + mPhoneNumber = phoneNumber; + mName = name; + mPhotoUri = photoUri; + } + + public static User getUser(Intent intent) { + return intent.getParcelableExtra(ExtraConstants.EXTRA_USER); + } + + public static User getUser(Bundle arguments) { + return arguments.getParcelable(ExtraConstants.EXTRA_USER); + } + + @NonNull + @AuthUI.SupportedProvider + public String getProviderId() { + return mProviderId; + } + + @Nullable + public String getEmail() { + return mEmail; + } + + @Nullable + public String getPhoneNumber() { + return mPhoneNumber; + } + + @Nullable + public String getName() { + return mName; + } + + @Nullable + public Uri getPhotoUri() { + return mPhotoUri; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + User user = (User) o; + + return mProviderId.equals(user.mProviderId) + && (mEmail == null ? user.mEmail == null : mEmail.equals(user.mEmail)) + && (mName == null ? user.mName == null : mName.equals(user.mName)) + && (mPhotoUri == null ? user.mPhotoUri == null : mPhotoUri.equals(user.mPhotoUri)); + } + + @Override + public int hashCode() { + int result = mProviderId.hashCode(); + result = 31 * result + (mEmail == null ? 0 : mEmail.hashCode()); + result = 31 * result + (mName == null ? 0 : mName.hashCode()); + result = 31 * result + (mPhotoUri == null ? 0 : mPhotoUri.hashCode()); + return result; + } + + @Override + public String toString() { + return "User{" + + "mProviderId='" + mProviderId + '\'' + + ", mEmail='" + mEmail + '\'' + + ", mName='" + mName + '\'' + + ", mPhotoUri=" + mPhotoUri + + '}'; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeString(mProviderId); + dest.writeString(mEmail); + dest.writeString(mPhoneNumber); + dest.writeString(mName); + dest.writeParcelable(mPhotoUri, flags); + } + + public static class Builder { + private String mProviderId; + private String mEmail; + private String mPhoneNumber; + private String mName; + private Uri mPhotoUri; + + public Builder(@AuthUI.SupportedProvider @NonNull String providerId, + @Nullable String email) { + mProviderId = providerId; + mEmail = email; + } + + public Builder setPhoneNumber(String phoneNumber) { + mPhoneNumber = phoneNumber; + return this; + } + + public Builder setName(String name) { + mName = name; + return this; + } + + public Builder setPhotoUri(Uri photoUri) { + mPhotoUri = photoUri; + return this; + } + + public User build() { + return new User(mProviderId, mEmail, mPhoneNumber, mName, mPhotoUri); + } + } +} diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/EmailProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/EmailProvider.java index d9de4f6c3..4f73a9808 100644 --- a/auth/src/main/java/com/firebase/ui/auth/provider/EmailProvider.java +++ b/auth/src/main/java/com/firebase/ui/auth/provider/EmailProvider.java @@ -23,13 +23,13 @@ public EmailProvider(Activity activity, FlowParameters flowParameters) { @Override public String getName(Context context) { - return context.getString(R.string.provider_name_email); + return context.getString(R.string.fui_provider_name_email); } @Override @LayoutRes public int getButtonLayout() { - return R.layout.provider_button_email; + return R.layout.fui_provider_button_email; } @Override 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 878f97d25..59bf2a2f9 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 @@ -17,6 +17,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; @@ -35,6 +36,7 @@ import com.firebase.ui.auth.AuthUI; import com.firebase.ui.auth.IdpResponse; import com.firebase.ui.auth.R; +import com.firebase.ui.auth.User; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.FacebookAuthProvider; @@ -74,13 +76,13 @@ public static AuthCredential createAuthCredential(IdpResponse response) { @Override public String getName(Context context) { - return context.getString(R.string.idp_name_facebook); + return context.getString(R.string.fui_idp_name_facebook); } @Override @LayoutRes public int getButtonLayout() { - return R.layout.idp_button_facebook; + return R.layout.fui_idp_button_facebook; } @Override @@ -133,19 +135,31 @@ public void onCompleted(JSONObject object, GraphResponse response) { Log.w(TAG, "Received null response from Facebook GraphRequest"); onFailure(); } else { + String email = null; + String name = null; + Uri photoUri = null; + try { - String email = object.getString("email"); - onSuccess(email, loginResult); + email = object.getString("email"); } catch (JSONException e) { Log.e(TAG, "Failure retrieving Facebook email", e); - onSuccess(null, loginResult); } + try { + name = object.getString("name"); + } catch (JSONException ignored) {} + try { + photoUri = Uri.parse(object.getJSONObject("picture") + .getJSONObject("data") + .getString("url")); + } catch (JSONException ignored) {} + + onSuccess(loginResult, email, name, photoUri); } } }); Bundle parameters = new Bundle(); - parameters.putString("fields", "id,name,email"); + parameters.putString("fields", "id,name,email,picture"); request.setParameters(parameters); request.executeAsync(); } @@ -161,15 +175,18 @@ public void onError(FacebookException error) { onFailure(); } - private void onSuccess(@Nullable String email, LoginResult loginResult) { + private void onSuccess(LoginResult loginResult, + @Nullable String email, + String name, + Uri photoUri) { gcCallbackManager(); - mCallbackObject.onSuccess(createIdpResponse(email, loginResult)); - } - - private IdpResponse createIdpResponse(@Nullable String email, LoginResult loginResult) { - return new IdpResponse.Builder(FacebookAuthProvider.PROVIDER_ID, email) + mCallbackObject.onSuccess(new IdpResponse.Builder( + new User.Builder(FacebookAuthProvider.PROVIDER_ID, email) + .setName(name) + .setPhotoUri(photoUri) + .build()) .setToken(loginResult.getAccessToken().getToken()) - .build(); + .build()); } private void onFailure() { diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java index 7cd0cb0d1..960c6e368 100644 --- a/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java +++ b/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java @@ -28,6 +28,7 @@ import com.firebase.ui.auth.AuthUI.IdpConfig; import com.firebase.ui.auth.IdpResponse; import com.firebase.ui.auth.R; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.util.GoogleApiHelper; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; @@ -91,13 +92,13 @@ private GoogleSignInOptions getSignInOptions(@Nullable String email) { @Override public String getName(Context context) { - return context.getString(R.string.idp_name_google); + return context.getString(R.string.fui_idp_name_google); } @Override @LayoutRes public int getButtonLayout() { - return R.layout.idp_button_google; + return R.layout.fui_idp_button_google; } @Override @@ -113,7 +114,11 @@ public void disconnect() { } private IdpResponse createIdpResponse(GoogleSignInAccount account) { - return new IdpResponse.Builder(GoogleAuthProvider.PROVIDER_ID, account.getEmail()) + return new IdpResponse.Builder( + new User.Builder(GoogleAuthProvider.PROVIDER_ID, account.getEmail()) + .setName(account.getDisplayName()) + .setPhotoUri(account.getPhotoUrl()) + .build()) .setToken(account.getIdToken()) .build(); } @@ -128,7 +133,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { Toast.makeText( mActivity, mActivity.getString( - R.string.signed_in_with_specific_account, + R.string.fui_signed_in_with_specific_account, result.getSignInAccount().getEmail()), Toast.LENGTH_SHORT).show(); } diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/PhoneProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/PhoneProvider.java index 81b51465d..0af5e6e6d 100644 --- a/auth/src/main/java/com/firebase/ui/auth/provider/PhoneProvider.java +++ b/auth/src/main/java/com/firebase/ui/auth/provider/PhoneProvider.java @@ -24,13 +24,13 @@ public PhoneProvider(Activity activity, FlowParameters parameters) { @Override public String getName(Context context) { - return context.getString(R.string.provider_name_phone); + return context.getString(R.string.fui_provider_name_phone); } @Override @LayoutRes public int getButtonLayout() { - return R.layout.provider_button_phone; + return R.layout.fui_provider_button_phone; } @Override 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 cdca74033..65dd7bf8a 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 @@ -3,6 +3,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.net.Uri; import android.support.annotation.LayoutRes; import android.util.Log; @@ -19,8 +20,7 @@ import com.twitter.sdk.android.core.TwitterException; import com.twitter.sdk.android.core.TwitterSession; import com.twitter.sdk.android.core.identity.TwitterAuthClient; - -import java.lang.ref.WeakReference; +import com.twitter.sdk.android.core.models.User; public class TwitterProvider extends Callback implements IdpProvider { @@ -51,7 +51,7 @@ private static void initialize(Context context) { Twitter.initialize(config); } - public static void signout(Context context) { + public static void signOut(Context context) { try { Twitter.getInstance(); } catch (IllegalStateException e) { @@ -67,13 +67,13 @@ private static void signOut() throws IllegalStateException { @Override public String getName(Context context) { - return context.getString(R.string.idp_name_twitter); + return context.getString(R.string.fui_idp_name_twitter); } @Override @LayoutRes public int getButtonLayout() { - return R.layout.idp_button_twitter; + return R.layout.fui_idp_button_twitter; } @Override @@ -92,9 +92,27 @@ public void startLogin(Activity activity) { } @Override - public void success(Result result) { - mTwitterAuthClient.requestEmail(result.data, - new EmailCallback(result.data, mCallbackObject)); + public void success(final Result sessionResult) { + TwitterCore.getInstance() + .getApiClient() + .getAccountService() + .verifyCredentials(false, false, true) + .enqueue(new Callback() { + @Override + public void success(Result result) { + User user = result.data; + mCallbackObject.onSuccess(createIdpResponse( + sessionResult.data, + user.email, + user.name, + Uri.parse(user.profileImageUrlHttps))); + } + + @Override + public void failure(TwitterException exception) { + mCallbackObject.onFailure(); + } + }); } @Override @@ -103,39 +121,17 @@ public void failure(TwitterException exception) { mCallbackObject.onFailure(); } - private static class EmailCallback extends Callback { - private TwitterSession mTwitterSession; - private WeakReference mCallbackObject; - - public EmailCallback(TwitterSession session, IdpCallback callbackObject) { - mTwitterSession = session; - mCallbackObject = new WeakReference<>(callbackObject); - } - - @Override - public void success(Result emailResult) { - onSuccess(createIdpResponse(emailResult.data)); - } - - @Override - public void failure(TwitterException exception) { - Log.e(TAG, "Failure retrieving Twitter email. " + exception.getMessage()); - // If retrieving the email fails, we should still be able to sign in, but Smart Lock - // and account linking won't work. - onSuccess(createIdpResponse(null)); - } - - private void onSuccess(IdpResponse response) { - if (mCallbackObject != null) { - mCallbackObject.get().onSuccess(response); - } - } - - private IdpResponse createIdpResponse(String email) { - return new IdpResponse.Builder(TwitterAuthProvider.PROVIDER_ID, email) - .setToken(mTwitterSession.getAuthToken().token) - .setSecret(mTwitterSession.getAuthToken().secret) - .build(); - } + private IdpResponse createIdpResponse(TwitterSession session, + String email, + String name, + Uri photoUri) { + return new IdpResponse.Builder( + new com.firebase.ui.auth.User.Builder(TwitterAuthProvider.PROVIDER_ID, email) + .setName(name) + .setPhotoUri(photoUri) + .build()) + .setToken(session.getAuthToken().token) + .setSecret(session.getAuthToken().secret) + .build(); } } 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 deleted file mode 100644 index aa2634b50..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/ui/User.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.firebase.ui.auth.ui; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.os.Parcel; -import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RestrictTo; - -import com.firebase.ui.auth.AuthUI; - -@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) -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())); - } - - @Override - public User[] newArray(int size) { - return new User[size]; - } - }; - - private String mEmail; - private String mName; - private String mProvider; - private Uri mPhotoUri; - - private User(String email, String name, String provider, Uri photoUri) { - mEmail = email; - mName = name; - mProvider = provider; - mPhotoUri = photoUri; - } - - public static User getUser(Intent intent) { - return intent.getParcelableExtra(ExtraConstants.EXTRA_USER); - } - - public static User getUser(Bundle arguments) { - return arguments.getParcelable(ExtraConstants.EXTRA_USER); - } - - @NonNull - public String getEmail() { - return mEmail; - } - - @Nullable - public String getName() { - return mName; - } - - @Nullable - @AuthUI.SupportedProvider - public String getProvider() { - return mProvider; - } - - @Nullable - public Uri getPhotoUri() { - return mPhotoUri; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeString(mEmail); - dest.writeString(mName); - dest.writeString(mProvider); - dest.writeParcelable(mPhotoUri, flags); - } - - public static class Builder { - private String mEmail; - private String mName; - private String mProvider; - private Uri mPhotoUri; - - public Builder(@NonNull String email) { - mEmail = email; - } - - public Builder setName(String name) { - mName = name; - return this; - } - - public Builder setProvider(@AuthUI.SupportedProvider String provider) { - mProvider = provider; - return this; - } - - public Builder setPhotoUri(Uri photoUri) { - mPhotoUri = photoUri; - return this; - } - - public User build() { - return new User(mEmail, mName, mProvider, mPhotoUri); - } - } -} 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 a7b539594..eb44b9f8b 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 @@ -41,7 +41,7 @@ import com.firebase.ui.auth.ui.FlowParameters; import com.firebase.ui.auth.ui.HelperActivityBase; import com.firebase.ui.auth.ui.TaskFailureLogger; -import com.firebase.ui.auth.ui.User; +import com.firebase.ui.auth.User; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; @@ -73,14 +73,14 @@ public static Intent createIntent( @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.welcome_back_idp_prompt_layout); + setContentView(R.layout.fui_welcome_back_idp_prompt_layout); IdpResponse newUserIdpResponse = IdpResponse.fromResultIntent(getIntent()); mPrevCredential = ProviderUtils.getAuthCredential(newUserIdpResponse); User oldUser = User.getUser(getIntent()); - String providerId = oldUser.getProvider(); + String providerId = oldUser.getProviderId(); for (IdpConfig idpConfig : getFlowParams().providerInfo) { if (providerId.equals(idpConfig.getProviderId())) { switch (providerId) { @@ -118,14 +118,14 @@ protected void onCreate(Bundle savedInstanceState) { findViewById(R.id.welcome_back_idp_button).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_signing_in); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_signing_in); mIdpProvider.startLogin(WelcomeBackIdpPrompt.this); } }); } private String getIdpPromptString(String email) { - return getString(R.string.welcome_back_idp_prompt, email, mIdpProvider.getName(this)); + return getString(R.string.fui_welcome_back_idp_prompt, email, mIdpProvider.getName(this)); } @Override @@ -191,7 +191,7 @@ public void onFailure() { } private void finishWithError() { - Toast.makeText(this, R.string.general_error, Toast.LENGTH_LONG).show(); + Toast.makeText(this, R.string.fui_general_error, Toast.LENGTH_LONG).show(); finish(ResultCodes.CANCELED, IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR)); } 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 211facfc0..5f4e85022 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 @@ -42,6 +42,7 @@ 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.User; import com.firebase.ui.auth.ui.email.RecoverPasswordActivity; import com.firebase.ui.auth.util.signincontainer.SaveSmartLock; import com.google.android.gms.tasks.OnFailureListener; @@ -78,7 +79,7 @@ public static Intent createIntent( @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.welcome_back_password_prompt_layout); + setContentView(R.layout.fui_welcome_back_password_prompt_layout); // Show keyboard getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); @@ -93,7 +94,7 @@ protected void onCreate(Bundle savedInstanceState) { ImeHelper.setImeOnDoneListener(mPasswordField, this); // Create welcome back text with email bolded. - String bodyText = getString(R.string.welcome_back_password_prompt_body, mEmail); + String bodyText = getString(R.string.fui_welcome_back_password_prompt_body, mEmail); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(bodyText); int emailStart = bodyText.indexOf(mEmail); @@ -136,12 +137,12 @@ private void validateAndSignIn() { private void validateAndSignIn(final String email, final String password) { // Check for null or empty password if (TextUtils.isEmpty(password)) { - mPasswordLayout.setError(getString(R.string.required_field)); + mPasswordLayout.setError(getString(R.string.fui_required_field)); return; } else { mPasswordLayout.setError(null); } - getDialogHolder().showLoadingDialog(R.string.progress_dialog_signing_in); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_signing_in); final FirebaseAuth firebaseAuth = getAuthHelper().getFirebaseAuth(); @@ -162,7 +163,9 @@ public void onSuccess(AuthResult authResult) { mSaveSmartLock, authResult.getUser(), password, - new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID, email) + new IdpResponse.Builder( + new User.Builder(EmailAuthProvider.PROVIDER_ID, email) + .build()) .build()); } else { authResult.getUser() 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 6f341d50f..552145c40 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 @@ -17,12 +17,12 @@ import android.widget.EditText; import com.firebase.ui.auth.R; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.provider.ProviderUtils; 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.ImeHelper; -import com.firebase.ui.auth.ui.User; import com.firebase.ui.auth.ui.email.fieldvalidators.EmailFieldValidator; import com.firebase.ui.auth.util.GoogleApiHelper; import com.google.android.gms.auth.api.Auth; @@ -99,7 +99,7 @@ public static CheckEmailFragment newInstance(@NonNull FlowParameters flowParamet public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.check_email_layout, container, false); + View v = inflater.inflate(R.layout.fui_check_email_layout, container, false); // Email field and validator mEmailLayout = (TextInputLayout) v.findViewById(R.id.email_layout); @@ -179,7 +179,7 @@ private void validateAndProceed() { } private void checkAccountExists(@NonNull final String email) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_checking_accounts); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_checking_accounts); // Get name from SmartLock, if possible String name = null; @@ -198,15 +198,16 @@ private void checkAccountExists(@NonNull final String email) { @Override public void onSuccess(String provider) { if (provider == null) { - mListener.onNewUser(new User.Builder(email) + mListener.onNewUser(new User.Builder(EmailAuthProvider.PROVIDER_ID, email) .setName(finalName) .setPhotoUri(finalPhotoUri) .build()); } else if (EmailAuthProvider.PROVIDER_ID.equalsIgnoreCase(provider)) { - mListener.onExistingEmailUser(new User.Builder(email).build()); + mListener.onExistingEmailUser( + new User.Builder(EmailAuthProvider.PROVIDER_ID, email).build()); } else { mListener.onExistingIdpUser( - new User.Builder(email).setProvider(provider).build()); + new User.Builder(EmailAuthProvider.PROVIDER_ID, email).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 06ebb1d51..4c6d853db 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 @@ -35,7 +35,7 @@ public PreambleHandler(Context context, FlowParameters parameters, @StringRes in mContext = context; mFlowParameters = parameters; mButtonText = buttonText; - mLinkSpan = new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.linkColor)); + mLinkSpan = new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.fui_linkColor)); setupCreateAccountPreamble(); } @@ -54,8 +54,8 @@ private void setupCreateAccountPreamble() { mBuilder = new SpannableStringBuilder(withTargets); replaceTarget(BTN_TARGET, mButtonText); - replaceUrlTarget(TOS_TARGET, R.string.terms_of_service, mFlowParameters.termsOfServiceUrl); - replaceUrlTarget(PP_TARGET, R.string.privacy_policy, mFlowParameters.privacyPolicyUrl); + replaceUrlTarget(TOS_TARGET, R.string.fui_terms_of_service, mFlowParameters.termsOfServiceUrl); + replaceUrlTarget(PP_TARGET, R.string.fui_privacy_policy, mFlowParameters.privacyPolicyUrl); } private void replaceTarget(String target, @StringRes int replacementRes) { @@ -84,13 +84,13 @@ private String getPreambleStringWithTargets() { boolean hasPp = !TextUtils.isEmpty(mFlowParameters.privacyPolicyUrl); if (hasTos && hasPp) { - return mContext.getString(R.string.create_account_preamble_tos_and_pp, + return mContext.getString(R.string.fui_create_account_preamble_tos_and_pp, BTN_TARGET, TOS_TARGET, PP_TARGET); } else if (hasTos) { - return mContext.getString(R.string.create_account_preamble_tos_only, + return mContext.getString(R.string.fui_create_account_preamble_tos_only, BTN_TARGET, TOS_TARGET); } else if (hasPp) { - return mContext.getString(R.string.create_account_preamble_pp_only, + return mContext.getString(R.string.fui_create_account_preamble_pp_only, BTN_TARGET, PP_TARGET); } else { return null; diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java index a13458df0..3c3a7631d 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java @@ -52,7 +52,7 @@ public static Intent createIntent(Context context, FlowParameters flowParams, St @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.forgot_password_layout); + setContentView(R.layout.fui_forgot_password_layout); mEmailFieldValidator = new EmailFieldValidator((TextInputLayout) findViewById(R.id.email_layout)); @@ -86,7 +86,7 @@ public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthInvalidUserException) { // No FirebaseUser exists with this email address, show error. - mEmailEditText.setError(getString(R.string.error_email_does_not_exist)); + mEmailEditText.setError(getString(R.string.fui_error_email_does_not_exist)); } } }); @@ -96,7 +96,7 @@ public void onFailure(@NonNull Exception e) { public void onClick(View view) { if (view.getId() == R.id.button_done) { if (mEmailFieldValidator.validate(mEmailEditText.getText())) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_sending); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_sending); next(mEmailEditText.getText().toString()); } } 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 25f5ee508..41f74336c 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 @@ -30,8 +30,8 @@ public static void show(String email, FragmentManager manager) { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getContext()) - .setTitle(R.string.title_confirm_recover_password) - .setMessage(getString(R.string.confirm_recovery_body, + .setTitle(R.string.fui_title_confirm_recover_password) + .setMessage(getString(R.string.fui_confirm_recovery_body, getArguments().getString(ExtraConstants.EXTRA_EMAIL))) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override 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 4f367d1e4..c1ec3fc52 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 @@ -27,10 +27,9 @@ import com.firebase.ui.auth.ui.ExtraConstants; import com.firebase.ui.auth.ui.FlowParameters; import com.firebase.ui.auth.ui.HelperActivityBase; -import com.firebase.ui.auth.ui.User; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.ui.accountlink.WelcomeBackIdpPrompt; import com.firebase.ui.auth.ui.accountlink.WelcomeBackPasswordPrompt; -import com.google.firebase.auth.EmailAuthProvider; /** * Activity to control the entire email sign up flow. Plays host to {@link CheckEmailFragment} and @@ -56,7 +55,7 @@ public static Intent createIntent(Context context, FlowParameters flowParams, St @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_register_email); + setContentView(R.layout.fui_activity_register_email); if (savedInstanceState != null) { return; @@ -96,8 +95,7 @@ public void onExistingEmailUser(User user) { WelcomeBackPasswordPrompt.createIntent( this, getFlowParams(), - new IdpResponse.Builder( - EmailAuthProvider.PROVIDER_ID, user.getEmail()).build()), + new IdpResponse.Builder(user).build()), RC_SIGN_IN); setSlideAnimation(); @@ -110,7 +108,7 @@ public void onExistingIdpUser(User user) { this, getFlowParams(), user, - new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID, user.getEmail()).build()); + new IdpResponse.Builder(user).build()); startActivityForResult(intent, RC_WELCOME_BACK_IDP); setSlideAnimation(); @@ -134,12 +132,12 @@ public void onNewUser(User user) { ft.disallowAddToBackStack().commit(); } else { - emailLayout.setError(getString(R.string.error_email_does_not_exist)); + emailLayout.setError(getString(R.string.fui_error_email_does_not_exist)); } } private void setSlideAnimation() { // Make the next activity slide in - overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); + overridePendingTransition(R.anim.fui_slide_in_right, R.anim.fui_slide_out_left); } } 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 4397f7bcc..728c18091 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 @@ -15,6 +15,7 @@ import com.firebase.ui.auth.IdpResponse; import com.firebase.ui.auth.R; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.provider.ProviderUtils; import com.firebase.ui.auth.ui.ExtraConstants; import com.firebase.ui.auth.ui.FlowParameters; @@ -22,7 +23,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.User; import com.firebase.ui.auth.ui.accountlink.WelcomeBackIdpPrompt; import com.firebase.ui.auth.ui.accountlink.WelcomeBackPasswordPrompt; import com.firebase.ui.auth.ui.email.fieldvalidators.EmailFieldValidator; @@ -94,7 +94,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.register_email_layout, container, false); + View v = inflater.inflate(R.layout.fui_register_email_layout, container, false); mEmailEditText = (EditText) v.findViewById(R.id.email); mNameEditText = (EditText) v.findViewById(R.id.name); @@ -105,7 +105,7 @@ public View onCreateView(LayoutInflater inflater, mPasswordFieldValidator = new PasswordFieldValidator( mPasswordInput, - getResources().getInteger(R.integer.min_password_length)); + getResources().getInteger(R.integer.fui_min_password_length)); mNameValidator = new RequiredFieldValidator( (TextInputLayout) v.findViewById(R.id.name_layout)); mEmailFieldValidator = new EmailFieldValidator(mEmailInput); @@ -158,7 +158,7 @@ public void run() { @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - getActivity().setTitle(R.string.title_register_email); + getActivity().setTitle(R.string.fui_title_register_email); if (!(getActivity() instanceof HelperActivityBase)) { throw new RuntimeException("Must be attached to a HelperActivityBase."); @@ -166,14 +166,14 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { mActivity = (HelperActivityBase) getActivity(); mSaveSmartLock = getAuthHelper().getSaveSmartLockInstance(mActivity); - new PreambleHandler(getContext(), getFlowParams(), R.string.button_text_save) + new PreambleHandler(getContext(), getFlowParams(), R.string.fui_button_text_save) .setPreamble(mAgreementText); } @Override public void onSaveInstanceState(Bundle outState) { outState.putParcelable(ExtraConstants.EXTRA_USER, - new User.Builder(mEmailEditText.getText().toString()) + new User.Builder(EmailAuthProvider.PROVIDER_ID, mEmailEditText.getText().toString()) .setName(mNameEditText.getText().toString()) .setPhotoUri(mUser.getPhotoUri()) .build()); @@ -215,7 +215,7 @@ private void validateAndRegisterUser() { boolean passwordValid = mPasswordFieldValidator.validate(password); boolean nameValid = mNameValidator.validate(name); if (emailValid && passwordValid && nameValid) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_signing_up); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_signing_up); registerUser(email, name, password); } } @@ -246,8 +246,11 @@ public void onComplete(@NonNull Task task) { // the credential to SmartLock (if enabled). mActivity.saveCredentialsOrFinish( mSaveSmartLock, user, password, - new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID, - email).build()); + new IdpResponse.Builder(new User.Builder( + EmailAuthProvider.PROVIDER_ID, email) + .setName(name) + .setPhotoUri(mUser.getPhotoUri()) + .build()).build()); } }); } @@ -258,10 +261,10 @@ public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthWeakPasswordException) { // Password too weak mPasswordInput.setError(getResources().getQuantityString( - R.plurals.error_weak_password, R.integer.min_password_length)); + R.plurals.fui_error_weak_password, R.integer.fui_min_password_length)); } else if (e instanceof FirebaseAuthInvalidCredentialsException) { // Email address is malformed - mEmailInput.setError(getString(R.string.invalid_email_address)); + mEmailInput.setError(getString(R.string.fui_invalid_email_address)); } else if (e instanceof FirebaseAuthUserCollisionException) { // Collision with existing user email, it should be very hard for // the user to even get to this error due to CheckEmailFragment. @@ -273,7 +276,7 @@ public void onFailure(@NonNull Exception e) { @Override public void onSuccess(String provider) { Toast.makeText(getContext(), - R.string.error_user_collision, + R.string.fui_error_user_collision, Toast.LENGTH_LONG) .show(); @@ -288,21 +291,20 @@ public void onSuccess(String provider) { WelcomeBackPasswordPrompt.createIntent( getContext(), getFlowParams(), - new IdpResponse.Builder( + new IdpResponse.Builder(new User.Builder( EmailAuthProvider.PROVIDER_ID, - email).build()), + email).build()).build()), RegisterEmailActivity.RC_WELCOME_BACK_IDP); } else { getActivity().startActivityForResult( WelcomeBackIdpPrompt.createIntent( getContext(), getFlowParams(), - new User.Builder(email) - .setProvider(provider) + new User.Builder(provider, email) .build(), - new IdpResponse.Builder( + new IdpResponse.Builder(new User.Builder( EmailAuthProvider.PROVIDER_ID, - email).build()), + email).build()).build()), RegisterEmailActivity.RC_WELCOME_BACK_IDP); } } @@ -317,7 +319,7 @@ public void onComplete(@NonNull Task task) { } else { // General error message, this branch should not be invoked but // covers future API changes - mEmailInput.setError(getString(R.string.email_account_creation_error)); + mEmailInput.setError(getString(R.string.fui_email_account_creation_error)); } getDialogHolder().dismissDialog(); diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/EmailFieldValidator.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/EmailFieldValidator.java index cb4bf0e00..81403644a 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/EmailFieldValidator.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/EmailFieldValidator.java @@ -23,8 +23,8 @@ public class EmailFieldValidator extends BaseValidator { public EmailFieldValidator(TextInputLayout errorContainer) { super(errorContainer); - mErrorMessage = mErrorContainer.getResources().getString(R.string.invalid_email_address); - mEmptyMessage = mErrorContainer.getResources().getString(R.string.missing_email_address); + mErrorMessage = mErrorContainer.getResources().getString(R.string.fui_invalid_email_address); + mEmptyMessage = mErrorContainer.getResources().getString(R.string.fui_missing_email_address); } @Override diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/PasswordFieldValidator.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/PasswordFieldValidator.java index fd60ad720..3316e3385 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/PasswordFieldValidator.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/PasswordFieldValidator.java @@ -25,7 +25,7 @@ public PasswordFieldValidator(TextInputLayout errorContainer, int minLength) { super(errorContainer); mMinLength = minLength; mErrorMessage = mErrorContainer.getResources() - .getQuantityString(R.plurals.error_weak_password, mMinLength, mMinLength); + .getQuantityString(R.plurals.fui_error_weak_password, mMinLength, mMinLength); } @Override diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/RequiredFieldValidator.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/RequiredFieldValidator.java index 3a56d7b4e..a6ba4ee0a 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/RequiredFieldValidator.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/fieldvalidators/RequiredFieldValidator.java @@ -21,7 +21,7 @@ public class RequiredFieldValidator extends BaseValidator { public RequiredFieldValidator(TextInputLayout errorContainer) { super(errorContainer); - mErrorMessage = mErrorContainer.getResources().getString(R.string.required_field); + mErrorMessage = mErrorContainer.getResources().getString(R.string.fui_required_field); } @Override 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 771d2ad0d..c52d68a25 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 @@ -19,6 +19,8 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.RestrictTo; +import android.support.constraint.ConstraintLayout; +import android.support.constraint.ConstraintSet; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -72,14 +74,21 @@ public static Intent createIntent(Context context, FlowParameters flowParams) { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.auth_method_picker_layout); + setContentView(R.layout.fui_auth_method_picker_layout); mSaveSmartLock = getAuthHelper().getSaveSmartLockInstance(this); populateIdpList(getFlowParams().providerInfo); int logoId = getFlowParams().logoId; if (logoId == AuthUI.NO_LOGO) { - findViewById(R.id.logo_layout).setVisibility(View.GONE); + findViewById(R.id.logo).setVisibility(View.GONE); + + ConstraintLayout layout = (ConstraintLayout) findViewById(R.id.root); + ConstraintSet constraints = new ConstraintSet(); + constraints.clone(layout); + constraints.setHorizontalBias(R.id.container, 0.5f); + constraints.setVerticalBias(R.id.container, 0.5f); + constraints.applyTo(layout); } else { ImageView logo = (ImageView) findViewById(R.id.logo); logo.setImageResource(logoId); @@ -121,7 +130,7 @@ private void populateIdpList(List providers) { @Override public void onClick(View view) { if (provider instanceof IdpProvider) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_loading); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_loading); } provider.startLogin(AuthMethodPickerActivity.this); } diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/idp/CredentialSignInHandler.java b/auth/src/main/java/com/firebase/ui/auth/ui/idp/CredentialSignInHandler.java index 6c71bda91..63fafb578 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/idp/CredentialSignInHandler.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/idp/CredentialSignInHandler.java @@ -25,7 +25,7 @@ import com.firebase.ui.auth.ResultCodes; import com.firebase.ui.auth.provider.ProviderUtils; import com.firebase.ui.auth.ui.HelperActivityBase; -import com.firebase.ui.auth.ui.User; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.ui.accountlink.WelcomeBackIdpPrompt; import com.firebase.ui.auth.ui.accountlink.WelcomeBackPasswordPrompt; import com.firebase.ui.auth.util.signincontainer.SaveSmartLock; @@ -115,9 +115,7 @@ public void onSuccess(String provider) { WelcomeBackIdpPrompt.createIntent( mActivity, mActivity.getFlowParams(), - new User.Builder(mResponse.getEmail()) - .setProvider(provider) - .build(), + new User.Builder(provider, mResponse.getEmail()).build(), mResponse), mAccountLinkRequestCode); } diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java index 978f8336f..3f46e9149 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java @@ -41,7 +41,7 @@ public CompletableProgressDialog(Context context, int theme) { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.phone_progress_dialog); + setContentView(R.layout.fui_phone_progress_dialog); mProgress = (ProgressBar) findViewById(R.id.progress_bar); mMessageView = (TextView) findViewById(R.id.progress_msg); diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListAdapter.java b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListAdapter.java index 505896928..a657b814f 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListAdapter.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListAdapter.java @@ -38,7 +38,7 @@ final class CountryListAdapter extends ArrayAdapter implements Sect private String[] sections; public CountryListAdapter(Context context) { - super(context, R.layout.dgts__country_row, android.R.id.text1); + super(context, R.layout.fui_dgts_country_row, android.R.id.text1); } // The list of countries should be sorted using locale-sensitive string comparison 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 b94c0b0cc..0a3864dd1 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 @@ -31,6 +31,7 @@ import com.firebase.ui.auth.IdpResponse; import com.firebase.ui.auth.R; import com.firebase.ui.auth.ResultCodes; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.ui.AppCompatBase; import com.firebase.ui.auth.ui.ExtraConstants; import com.firebase.ui.auth.ui.FlowParameters; @@ -82,7 +83,7 @@ public static Intent createIntent(Context context, FlowParameters flowParams, St @Override protected void onCreate(final Bundle savedInstance) { super.onCreate(savedInstance); - setContentView(R.layout.activity_register_phone); + setContentView(R.layout.fui_activity_register_phone); mHandler = new Handler(); mVerificationState = VerificationState.VERIFICATION_NOT_STARTED; @@ -150,14 +151,14 @@ protected void onDestroy() { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { - showLoadingDialog(getString(R.string.resending)); + showLoadingDialog(getString(R.string.fui_resending)); } else { - showLoadingDialog(getString(R.string.verifying)); + showLoadingDialog(getString(R.string.fui_verifying)); } } public void submitConfirmationCode(String confirmationCode) { - showLoadingDialog(getString(R.string.verifying)); + showLoadingDialog(getString(R.string.fui_verifying)); signingWithCreds(PhoneAuthProvider.getCredential(mVerificationId, confirmationCode)); } @@ -171,7 +172,7 @@ private void onVerificationSuccess(@NonNull final PhoneAuthCredential phoneAuthC getSubmitConfirmationCodeFragment(); - showLoadingDialog(getString(R.string.retrieving_sms)); + showLoadingDialog(getString(R.string.fui_retrieving_sms)); if (submitConfirmationCodeFragment != null) { submitConfirmationCodeFragment.setConfirmationCode(String.valueOf (phoneAuthCredential.getSmsCode())); @@ -181,7 +182,7 @@ private void onVerificationSuccess(@NonNull final PhoneAuthCredential phoneAuthC } private void onCodeSent() { - completeLoadingDialog(getString(R.string.code_sent)); + completeLoadingDialog(getString(R.string.fui_code_sent)); mHandler.postDelayed(new Runnable() { @Override public void run() { @@ -203,15 +204,15 @@ private void onVerificationFailed(@NonNull FirebaseException ex) { switch (error) { case ERROR_INVALID_PHONE_NUMBER: - verifyPhoneNumberFragment.showError(getString(R.string.invalid_phone_number)); + verifyPhoneNumberFragment.showError(getString(R.string.fui_invalid_phone_number)); dismissLoadingDialog(); break; case ERROR_TOO_MANY_REQUESTS: - showAlertDialog(getString(R.string.error_too_many_attempts), null); + showAlertDialog(getString(R.string.fui_error_too_many_attempts), null); dismissLoadingDialog(); break; case ERROR_QUOTA_EXCEEDED: - showAlertDialog(getString(R.string.error_quota_exceeded), null); + showAlertDialog(getString(R.string.fui_error_quota_exceeded), null); dismissLoadingDialog(); break; default: @@ -287,8 +288,10 @@ private void showSubmitCodeFragment() { } private void finish(FirebaseUser user) { - IdpResponse response = new IdpResponse.Builder(PhoneAuthProvider.PROVIDER_ID, null) - .setPhoneNumber(user.getPhoneNumber()) + IdpResponse response = new IdpResponse.Builder( + new User.Builder(PhoneAuthProvider.PROVIDER_ID, null) + .setPhoneNumber(user.getPhoneNumber()) + .build()) .build(); setResult(ResultCodes.OK, response.toIntent()); finish(); @@ -298,7 +301,7 @@ private void showAlertDialog(@NonNull String s, DialogInterface.OnClickListener onClickListener) { mAlertDialog = new AlertDialog.Builder(this) .setMessage(s) - .setPositiveButton(R.string.incorrect_code_dialog_positive_button_text, onClickListener) + .setPositiveButton(R.string.fui_incorrect_code_dialog_positive_button_text, onClickListener) .show(); } @@ -309,7 +312,7 @@ private void signingWithCreds(@NonNull PhoneAuthCredential phoneAuthCredential) @Override public void onSuccess(final AuthResult authResult) { mVerificationState = VerificationState.VERIFIED; - completeLoadingDialog(getString(R.string.verified)); + completeLoadingDialog(getString(R.string.fui_verified)); // Activity can be recreated before this message is handled mHandler.postDelayed(new Runnable() { @@ -335,7 +338,7 @@ public void onFailure(@NonNull Exception e) { switch (error) { case ERROR_INVALID_VERIFICATION_CODE: showAlertDialog( - getString(R.string.incorrect_code_dialog_body), + getString(R.string.fui_incorrect_code_dialog_body), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -346,7 +349,7 @@ public void onClick(DialogInterface dialog, int which) { break; case ERROR_SESSION_EXPIRED: showAlertDialog( - getString(R.string.error_session_expired), + getString(R.string.fui_error_session_expired), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { 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 974587cf2..12cc1300e 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 @@ -71,7 +71,7 @@ public static SubmitConfirmationCodeFragment newInstance(FlowParameters flowPara @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.confirmation_code_layout, container, false); + View v = inflater.inflate(R.layout.fui_confirmation_code_layout, container, false); FragmentActivity parentActivity = getActivity(); mEditPhoneTextView = (TextView) v.findViewById(R.id.edit_phone_number); @@ -83,7 +83,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, final String phoneNumber = getArguments().getString(ExtraConstants.EXTRA_PHONE); - parentActivity.setTitle(getString(R.string.verify_your_phone_title)); + parentActivity.setTitle(getString(R.string.fui_verify_your_phone_title)); setupConfirmationCodeEditText(); setupEditPhoneNumberTextView(phoneNumber); setupCountDown(RESEND_WAIT_MILLIS); @@ -129,7 +129,7 @@ public void onSaveInstanceState(Bundle outState) { } private void setTimer(long millisUntilFinished) { - mCountDownTextView.setText(String.format(getString(R.string.resend_code_in), + mCountDownTextView.setText(String.format(getString(R.string.fui_resend_code_in), timeRoundedToSeconds(millisUntilFinished))); } @@ -140,7 +140,7 @@ public void onClick(View v) { mVerifier.verifyPhoneNumber(phoneNumber, true); mResendCodeTextView.setVisibility(View.GONE); mCountDownTextView.setVisibility(View.VISIBLE); - mCountDownTextView.setText(String.format(getString(R.string.resend_code_in), + mCountDownTextView.setText(String.format(getString(R.string.fui_resend_code_in), RESEND_WAIT_MILLIS / 1000)); mCountdownTimer.renew(); } @@ -208,7 +208,7 @@ private void cancelTimer() { } private void setUpTermsOfService() { - new PreambleHandler(getContext(), getFlowParams(), R.string.continue_phone_login) + new PreambleHandler(getContext(), getFlowParams(), R.string.fui_continue_phone_login) .setPreamble(mAgreementText); } 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 b963a51fc..7c8ae7850 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 @@ -86,7 +86,7 @@ public void onAttach(Context context) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.phone_layout, container, false); + View v = inflater.inflate(R.layout.fui_phone_layout, container, false); countryListSpinner = (CountryListSpinner) v.findViewById(R.id.country_list); mPhoneEditText = (EditText) v.findViewById(R.id.phone_number); @@ -95,7 +95,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, mSmsTermsText = (TextView) v.findViewById(R.id.send_sms_tos); FragmentActivity parentActivity = getActivity(); - parentActivity.setTitle(getString(R.string.verify_phone_number_title)); + parentActivity.setTitle(getString(R.string.fui_verify_phone_number_title)); setUpCountrySpinner(); setupSendCodeButton(); setupTerms(); @@ -104,8 +104,8 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, } private void setupTerms() { - final String verifyPhoneButtonText = getString(R.string.verify_phone_number); - final String terms = getString(R.string.sms_terms_of_service, verifyPhoneButtonText); + final String verifyPhoneButtonText = getString(R.string.fui_verify_phone_number); + final String terms = getString(R.string.fui_sms_terms_of_service, verifyPhoneButtonText); mSmsTermsText.setText(terms); } @@ -168,7 +168,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onClick(View v) { String phoneNumber = getPseudoValidPhoneNumber(); if (phoneNumber == null) { - errorEditText.setText(R.string.invalid_phone_number); + errorEditText.setText(R.string.fui_invalid_phone_number); } else { mVerifier.verifyPhoneNumber(phoneNumber, false); } diff --git a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java index de54081e7..d6e96016d 100644 --- a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java +++ b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java @@ -14,6 +14,7 @@ package com.firebase.ui.auth.util.signincontainer; +import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; @@ -27,6 +28,7 @@ import com.firebase.ui.auth.ErrorCodes; import com.firebase.ui.auth.IdpResponse; import com.firebase.ui.auth.ResultCodes; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.provider.FacebookProvider; import com.firebase.ui.auth.provider.GoogleProvider; import com.firebase.ui.auth.provider.IdpProvider; @@ -38,7 +40,6 @@ import com.firebase.ui.auth.ui.FragmentBase; import com.firebase.ui.auth.ui.HelperActivityBase; import com.firebase.ui.auth.ui.TaskFailureLogger; -import com.firebase.ui.auth.ui.User; import com.firebase.ui.auth.ui.idp.CredentialSignInHandler; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.FacebookAuthProvider; @@ -82,13 +83,23 @@ public static IdpSignInContainer getInstance(FragmentActivity activity) { } } + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (!(getActivity() instanceof HelperActivityBase)) { + throw new RuntimeException("Can only attach IdpSignInContainer to HelperActivityBase."); + } + + mActivity = (HelperActivityBase) getActivity(); + } + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSaveSmartLock = getAuthHelper().getSaveSmartLockInstance(mActivity); User user = User.getUser(getArguments()); - String provider = user.getProvider(); + String provider = user.getProviderId(); AuthUI.IdpConfig providerConfig = null; for (AuthUI.IdpConfig config : getFlowParams().providerInfo) { @@ -122,17 +133,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) { } } - @Override - public void onActivityCreated(@Nullable Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - if (!(getActivity() instanceof HelperActivityBase)) { - throw new RuntimeException("Can only attach IdpSignInContainer to HelperActivityBase."); - } - - mActivity = (HelperActivityBase) getActivity(); - } - @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(ExtraConstants.HAS_EXISTING_INSTANCE, true); 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 359c38d91..abd68fd18 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 @@ -120,7 +120,7 @@ public void onConnected(Bundle bundle) { @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { - Toast.makeText(getContext(), R.string.general_error, Toast.LENGTH_SHORT).show(); + Toast.makeText(getContext(), R.string.fui_general_error, Toast.LENGTH_SHORT).show(); PendingIntent resolution = PlayServicesHelper.getGoogleApiAvailability() 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 8c20475d8..c997c8998 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 @@ -19,7 +19,7 @@ import com.firebase.ui.auth.ui.ExtraConstants; import com.firebase.ui.auth.ui.FlowParameters; import com.firebase.ui.auth.ui.TaskFailureLogger; -import com.firebase.ui.auth.ui.User; +import com.firebase.ui.auth.User; import com.firebase.ui.auth.ui.email.RegisterEmailActivity; import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity; import com.firebase.ui.auth.ui.phone.PhoneVerificationActivity; @@ -94,7 +94,7 @@ public void onCreate(Bundle savedInstance) { FlowParameters flowParams = getFlowParams(); if (flowParams.enableCredentials) { - getDialogHolder().showLoadingDialog(R.string.progress_dialog_loading); + getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_loading); mGoogleApiClient = new GoogleApiClient.Builder(getContext().getApplicationContext()) .addConnectionCallbacks(this) @@ -273,7 +273,8 @@ private void startAuthMethodChoice() { */ private void signInWithEmailAndPassword(String email, String password) { final IdpResponse response = - new IdpResponse.Builder(EmailAuthProvider.PROVIDER_ID, email).build(); + new IdpResponse.Builder(new User.Builder(EmailAuthProvider.PROVIDER_ID, email).build()) + .build(); getAuthHelper().getFirebaseAuth() .signInWithEmailAndPassword(email, password) @@ -341,8 +342,7 @@ private void redirectToIdpSignIn(String email, String accountType) { IdpSignInContainer.signIn( getActivity(), getFlowParams(), - new User.Builder(email) - .setProvider(accountTypeToProviderId(accountType)) + new User.Builder(SmartLockBase.accountTypeToProviderId(accountType), email) .build()); } else { Log.w(TAG, "Unknown provider: " + accountType); 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 5e685d8b0..744456793 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 @@ -123,7 +123,7 @@ public void onStart() { if (mActivityResultPair != null) { finish(mActivityResultPair.first, mActivityResultPair.second); } else if (mWasProgressDialogShowing) { - getDialogHolder().showLoadingDialog(com.firebase.ui.auth.R.string.progress_dialog_loading); + getDialogHolder().showLoadingDialog(com.firebase.ui.auth.R.string.fui_progress_dialog_loading); mWasProgressDialogShowing = false; } } @@ -158,7 +158,7 @@ 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, + com.firebase.ui.auth.R.string.fui_general_error, Toast.LENGTH_SHORT).show(); } diff --git a/auth/src/main/res/anim/slide_in_right.xml b/auth/src/main/res/anim/fui_slide_in_right.xml similarity index 100% rename from auth/src/main/res/anim/slide_in_right.xml rename to auth/src/main/res/anim/fui_slide_in_right.xml diff --git a/auth/src/main/res/anim/slide_out_left.xml b/auth/src/main/res/anim/fui_slide_out_left.xml similarity index 100% rename from auth/src/main/res/anim/slide_out_left.xml rename to auth/src/main/res/anim/fui_slide_out_left.xml diff --git a/auth/src/main/res/drawable/done_check_mark.xml b/auth/src/main/res/drawable/fui_done_check_mark.xml similarity index 100% rename from auth/src/main/res/drawable/done_check_mark.xml rename to auth/src/main/res/drawable/fui_done_check_mark.xml diff --git a/auth/src/main/res/drawable/ic_facebook_white_22dp.xml b/auth/src/main/res/drawable/fui_ic_facebook_white_22dp.xml similarity index 100% rename from auth/src/main/res/drawable/ic_facebook_white_22dp.xml rename to auth/src/main/res/drawable/fui_ic_facebook_white_22dp.xml diff --git a/auth/src/main/res/drawable/ic_googleg_color_24dp.xml b/auth/src/main/res/drawable/fui_ic_googleg_color_24dp.xml similarity index 100% rename from auth/src/main/res/drawable/ic_googleg_color_24dp.xml rename to auth/src/main/res/drawable/fui_ic_googleg_color_24dp.xml diff --git a/auth/src/main/res/drawable/ic_mail_white_24dp.xml b/auth/src/main/res/drawable/fui_ic_mail_white_24dp.xml similarity index 100% rename from auth/src/main/res/drawable/ic_mail_white_24dp.xml rename to auth/src/main/res/drawable/fui_ic_mail_white_24dp.xml diff --git a/auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml b/auth/src/main/res/drawable/fui_ic_settings_phone_white_24dp.xml similarity index 100% rename from auth/src/main/res/drawable/ic_settings_phone_white_24dp.xml rename to auth/src/main/res/drawable/fui_ic_settings_phone_white_24dp.xml diff --git a/auth/src/main/res/drawable/ic_twitter_bird_white_24dp.xml b/auth/src/main/res/drawable/fui_ic_twitter_bird_white_24dp.xml similarity index 100% rename from auth/src/main/res/drawable/ic_twitter_bird_white_24dp.xml rename to auth/src/main/res/drawable/fui_ic_twitter_bird_white_24dp.xml diff --git a/auth/src/main/res/drawable/idp_button_background_email.xml b/auth/src/main/res/drawable/fui_idp_button_background_email.xml similarity index 100% rename from auth/src/main/res/drawable/idp_button_background_email.xml rename to auth/src/main/res/drawable/fui_idp_button_background_email.xml diff --git a/auth/src/main/res/drawable/idp_button_background_facebook.xml b/auth/src/main/res/drawable/fui_idp_button_background_facebook.xml similarity index 100% rename from auth/src/main/res/drawable/idp_button_background_facebook.xml rename to auth/src/main/res/drawable/fui_idp_button_background_facebook.xml diff --git a/auth/src/main/res/drawable/idp_button_background_google.xml b/auth/src/main/res/drawable/fui_idp_button_background_google.xml similarity index 100% rename from auth/src/main/res/drawable/idp_button_background_google.xml rename to auth/src/main/res/drawable/fui_idp_button_background_google.xml diff --git a/auth/src/main/res/drawable/idp_button_background_phone.xml b/auth/src/main/res/drawable/fui_idp_button_background_phone.xml similarity index 100% rename from auth/src/main/res/drawable/idp_button_background_phone.xml rename to auth/src/main/res/drawable/fui_idp_button_background_phone.xml diff --git a/auth/src/main/res/drawable/idp_button_background_twitter.xml b/auth/src/main/res/drawable/fui_idp_button_background_twitter.xml similarity index 100% rename from auth/src/main/res/drawable/idp_button_background_twitter.xml rename to auth/src/main/res/drawable/fui_idp_button_background_twitter.xml 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 deleted file mode 100644 index 93d3b32f4..000000000 --- a/auth/src/main/res/layout-land/auth_method_picker_layout.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml b/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml new file mode 100644 index 000000000..4f78b6583 --- /dev/null +++ b/auth/src/main/res/layout-land/fui_auth_method_picker_layout.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + diff --git a/auth/src/main/res/layout/auth_method_picker_layout.xml b/auth/src/main/res/layout/auth_method_picker_layout.xml deleted file mode 100644 index 0b775db34..000000000 --- a/auth/src/main/res/layout/auth_method_picker_layout.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/auth/src/main/res/layout/activity_register_email.xml b/auth/src/main/res/layout/fui_activity_register_email.xml similarity index 100% rename from auth/src/main/res/layout/activity_register_email.xml rename to auth/src/main/res/layout/fui_activity_register_email.xml diff --git a/auth/src/main/res/layout/activity_register_phone.xml b/auth/src/main/res/layout/fui_activity_register_phone.xml similarity index 100% rename from auth/src/main/res/layout/activity_register_phone.xml rename to auth/src/main/res/layout/fui_activity_register_phone.xml diff --git a/auth/src/main/res/layout/fui_auth_method_picker_layout.xml b/auth/src/main/res/layout/fui_auth_method_picker_layout.xml new file mode 100644 index 000000000..0f883abca --- /dev/null +++ b/auth/src/main/res/layout/fui_auth_method_picker_layout.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + diff --git a/auth/src/main/res/layout/check_email_layout.xml b/auth/src/main/res/layout/fui_check_email_layout.xml similarity index 95% rename from auth/src/main/res/layout/check_email_layout.xml rename to auth/src/main/res/layout/fui_check_email_layout.xml index 3df939380..93305afe1 100644 --- a/auth/src/main/res/layout/check_email_layout.xml +++ b/auth/src/main/res/layout/fui_check_email_layout.xml @@ -28,6 +28,6 @@ android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_below="@id/email_layout" - android:text="@string/next_default" /> + android:text="@string/fui_next_default" /> diff --git a/auth/src/main/res/layout/confirmation_code_layout.xml b/auth/src/main/res/layout/fui_confirmation_code_layout.xml similarity index 90% rename from auth/src/main/res/layout/confirmation_code_layout.xml rename to auth/src/main/res/layout/fui_confirmation_code_layout.xml index feebef937..0a41198ae 100644 --- a/auth/src/main/res/layout/confirmation_code_layout.xml +++ b/auth/src/main/res/layout/fui_confirmation_code_layout.xml @@ -16,7 +16,7 @@ style="@style/FirebaseUI.Text.T08" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/enter_confirmation_code" /> + android:text="@string/fui_enter_confirmation_code" /> + android:text="@string/fui_continue_phone_login" /> @@ -95,7 +95,7 @@ style="@style/FirebaseUI.Text.BodyText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/field_padding_vert" + android:layout_marginTop="@dimen/fui_field_padding_vert" android:layout_below="@id/resend_code_layout" android:textIsSelectable="false" tools:text="@string/create_account_preamble" /> diff --git a/auth/src/main/res/layout/dgts__country_row.xml b/auth/src/main/res/layout/fui_dgts_country_row.xml similarity index 100% rename from auth/src/main/res/layout/dgts__country_row.xml rename to auth/src/main/res/layout/fui_dgts_country_row.xml diff --git a/auth/src/main/res/layout/forgot_password_layout.xml b/auth/src/main/res/layout/fui_forgot_password_layout.xml similarity index 87% rename from auth/src/main/res/layout/forgot_password_layout.xml rename to auth/src/main/res/layout/fui_forgot_password_layout.xml index be7c58cd8..ff0551ca8 100644 --- a/auth/src/main/res/layout/forgot_password_layout.xml +++ b/auth/src/main/res/layout/fui_forgot_password_layout.xml @@ -12,7 +12,7 @@ + android:text="@string/fui_password_recovery_body" />