diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java b/auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java index 655b420c8..9ff7bc4fd 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java @@ -37,7 +37,6 @@ 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.email.PasswordToggler; import com.firebase.ui.auth.ui.email.RecoverPasswordActivity; import com.firebase.ui.auth.util.signincontainer.SaveSmartLock; import com.google.android.gms.tasks.OnFailureListener; @@ -58,7 +57,8 @@ public class WelcomeBackPasswordPrompt extends AppCompatBase implements View.OnC private TextInputLayout mPasswordLayout; private EditText mPasswordField; private IdpResponse mIdpResponse; - @Nullable private SaveSmartLock mSaveSmartLock; + @Nullable + private SaveSmartLock mSaveSmartLock; @Override protected void onCreate(Bundle savedInstanceState) { @@ -76,15 +76,16 @@ protected void onCreate(Bundle savedInstanceState) { bodyText = String.format(bodyText, mEmail); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(bodyText); int emailStart = bodyText.indexOf(mEmail); - spannableStringBuilder.setSpan(BOLD, emailStart, emailStart + mEmail.length(), Spannable - .SPAN_INCLUSIVE_INCLUSIVE); + spannableStringBuilder.setSpan(BOLD, + emailStart, + emailStart + mEmail.length(), + Spannable.SPAN_INCLUSIVE_INCLUSIVE); TextView bodyTextView = ((TextView) findViewById(R.id.welcome_back_password_body)); bodyTextView.setText(spannableStringBuilder); // Click listeners findViewById(R.id.button_done).setOnClickListener(this); - findViewById(R.id.toggle_visibility).setOnClickListener(new PasswordToggler(mPasswordField)); findViewById(R.id.trouble_signing_in).setOnClickListener(this); } @@ -131,7 +132,8 @@ public void onSuccess(AuthResult authResult) { // Sign in with the credential firebaseAuth.signInWithCredential(authCredential) .addOnFailureListener( - new TaskFailureLogger(TAG, "Error signing in with credential")) + new TaskFailureLogger(TAG, + "Error signing in with credential")) .addOnSuccessListener( new OnSuccessListener() { @Override diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/ImageFocusTransparencyChanger.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/ImageFocusTransparencyChanger.java deleted file mode 100644 index 3cc4824f7..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/ImageFocusTransparencyChanger.java +++ /dev/null @@ -1,43 +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.ui.email; - -import android.view.View; -import android.widget.ImageView; - -class ImageFocusTransparencyChanger implements View.OnFocusChangeListener { - private final ImageView mTogglePasswordImage; - private final float mSlightlyVisible; - private final float mVisible; - - public ImageFocusTransparencyChanger( - ImageView togglePasswordImage, - float visible, - float slightlyVisible) { - mTogglePasswordImage = togglePasswordImage; - mVisible = visible; - mSlightlyVisible = slightlyVisible; - mTogglePasswordImage.setAlpha(mSlightlyVisible); - } - - @Override - public void onFocusChange(View v, boolean hasFocus) { - if (hasFocus) { - mTogglePasswordImage.setAlpha(mVisible); - } else { - mTogglePasswordImage.setAlpha(mSlightlyVisible); - } - } -} diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/PasswordToggler.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/PasswordToggler.java deleted file mode 100644 index 0be8d2881..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/PasswordToggler.java +++ /dev/null @@ -1,48 +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.ui.email; - -import android.text.InputType; -import android.view.View; -import android.widget.EditText; -import android.widget.ImageView; - -import com.firebase.ui.auth.R; - -/** - * Shows and hides the contents of password fields, to improve their usability. - */ -public class PasswordToggler implements ImageView.OnClickListener { - private final EditText mField; - private boolean mTextVisible = false; - - public PasswordToggler(EditText field) { - mField = field; - mField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); - } - - @Override - public void onClick(View view) { - ImageView imageView = (ImageView) view; - mTextVisible = !mTextVisible; - if (mTextVisible) { - imageView.setImageResource(R.drawable.ic_visibility_off_black_24dp); - mField.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); - } else { - imageView.setImageResource(R.drawable.ic_visibility_black_24dp); - mField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); - } - } -} 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 84f85b781..cccdad925 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 @@ -24,11 +24,9 @@ import android.support.v4.content.ContextCompat; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; -import android.util.TypedValue; import android.view.View; import android.widget.Button; import android.widget.EditText; -import android.widget.ImageView; import android.widget.TextView; import com.firebase.ui.auth.R; @@ -75,33 +73,17 @@ protected void onCreate(Bundle savedInstanceState) { mSaveSmartLock = mActivityHelper.getSaveSmartLockInstance(); - String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL); mEmailEditText = (EditText) findViewById(R.id.email); - - TypedValue visibleIcon = new TypedValue(); - TypedValue slightlyVisibleIcon = new TypedValue(); - - getResources().getValue(R.dimen.visible_icon, visibleIcon, true); - getResources().getValue(R.dimen.slightly_visible_icon, slightlyVisibleIcon, true); - - mPasswordEditText = (EditText) findViewById(R.id.password); - ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility); - - mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger( - togglePasswordImage, - visibleIcon.getFloat(), - slightlyVisibleIcon.getFloat())); - - togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText)); - mNameEditText = (EditText) findViewById(R.id.name); + mPasswordEditText = (EditText) findViewById(R.id.password); - mPasswordFieldValidator = new PasswordFieldValidator((TextInputLayout) - findViewById(R.id.password_layout), + mPasswordFieldValidator = new PasswordFieldValidator( + (TextInputLayout) findViewById(R.id.password_layout), getResources().getInteger(R.integer.min_password_length)); mNameValidator = new RequiredFieldValidator((TextInputLayout) findViewById(R.id.name_layout)); mEmailFieldValidator = new EmailFieldValidator((TextInputLayout) findViewById(R.id.email_layout)); + String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL); if (email != null) { mEmailEditText.setText(email); mEmailEditText.setEnabled(false); diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java index 864ece2f8..f8b17d365 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java @@ -20,11 +20,9 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.TextInputLayout; -import android.util.TypedValue; import android.view.View; import android.widget.Button; import android.widget.EditText; -import android.widget.ImageView; import android.widget.TextView; import com.firebase.ui.auth.R; @@ -60,34 +58,17 @@ protected void onCreate(Bundle savedInstanceState) { mSaveSmartLock = mActivityHelper.getSaveSmartLockInstance(); - String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL); - mEmailEditText = (EditText) findViewById(R.id.email); - - TypedValue visibleIcon = new TypedValue(); - TypedValue slightlyVisibleIcon = new TypedValue(); - - getResources().getValue(R.dimen.visible_icon, visibleIcon, true); - getResources().getValue(R.dimen.slightly_visible_icon, slightlyVisibleIcon, true); - mPasswordEditText = (EditText) findViewById(R.id.password); - ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility); - - mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger( - togglePasswordImage, - visibleIcon.getFloat(), - slightlyVisibleIcon.getFloat())); - - togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText)); - mEmailValidator = new EmailFieldValidator((TextInputLayout) findViewById(R.id.email_layout)); mPasswordValidator = new RequiredFieldValidator((TextInputLayout) findViewById(R.id.password_layout)); - Button signInButton = (Button) findViewById(R.id.button_done); - TextView recoveryButton = (TextView) findViewById(R.id.trouble_signing_in); + String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL); if (email != null) { mEmailEditText.setText(email); } + Button signInButton = (Button) findViewById(R.id.button_done); + TextView recoveryButton = (TextView) findViewById(R.id.trouble_signing_in); signInButton.setOnClickListener(this); recoveryButton.setOnClickListener(this); } diff --git a/auth/src/main/res/drawable-hdpi/ic_visibility_black_24dp.png b/auth/src/main/res/drawable-hdpi/ic_visibility_black_24dp.png deleted file mode 100644 index 329e617e9..000000000 Binary files a/auth/src/main/res/drawable-hdpi/ic_visibility_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-hdpi/ic_visibility_off_black_24dp.png b/auth/src/main/res/drawable-hdpi/ic_visibility_off_black_24dp.png deleted file mode 100644 index b21a68629..000000000 Binary files a/auth/src/main/res/drawable-hdpi/ic_visibility_off_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-mdpi/ic_visibility_black_24dp.png b/auth/src/main/res/drawable-mdpi/ic_visibility_black_24dp.png deleted file mode 100644 index 58597e91b..000000000 Binary files a/auth/src/main/res/drawable-mdpi/ic_visibility_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-mdpi/ic_visibility_off_black_24dp.png b/auth/src/main/res/drawable-mdpi/ic_visibility_off_black_24dp.png deleted file mode 100644 index 3efdf4922..000000000 Binary files a/auth/src/main/res/drawable-mdpi/ic_visibility_off_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xhdpi/ic_visibility_black_24dp.png b/auth/src/main/res/drawable-xhdpi/ic_visibility_black_24dp.png deleted file mode 100644 index 1f7b4cc8f..000000000 Binary files a/auth/src/main/res/drawable-xhdpi/ic_visibility_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xhdpi/ic_visibility_off_black_24dp.png b/auth/src/main/res/drawable-xhdpi/ic_visibility_off_black_24dp.png deleted file mode 100644 index 46bf0c931..000000000 Binary files a/auth/src/main/res/drawable-xhdpi/ic_visibility_off_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xxhdpi/ic_visibility_black_24dp.png b/auth/src/main/res/drawable-xxhdpi/ic_visibility_black_24dp.png deleted file mode 100644 index c816ab49d..000000000 Binary files a/auth/src/main/res/drawable-xxhdpi/ic_visibility_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xxhdpi/ic_visibility_off_black_24dp.png b/auth/src/main/res/drawable-xxhdpi/ic_visibility_off_black_24dp.png deleted file mode 100644 index 13eb65df3..000000000 Binary files a/auth/src/main/res/drawable-xxhdpi/ic_visibility_off_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xxxhdpi/ic_visibility_black_24dp.png b/auth/src/main/res/drawable-xxxhdpi/ic_visibility_black_24dp.png deleted file mode 100644 index e005b976c..000000000 Binary files a/auth/src/main/res/drawable-xxxhdpi/ic_visibility_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/drawable-xxxhdpi/ic_visibility_off_black_24dp.png b/auth/src/main/res/drawable-xxxhdpi/ic_visibility_off_black_24dp.png deleted file mode 100644 index ce3c9d84d..000000000 Binary files a/auth/src/main/res/drawable-xxxhdpi/ic_visibility_off_black_24dp.png and /dev/null differ diff --git a/auth/src/main/res/layout/register_email_layout.xml b/auth/src/main/res/layout/register_email_layout.xml index bd7e93df7..a02a9c63f 100644 --- a/auth/src/main/res/layout/register_email_layout.xml +++ b/auth/src/main/res/layout/register_email_layout.xml @@ -57,7 +57,8 @@ android:layout_height="wrap_content" android:paddingTop="224dp" app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText" - app:hintTextAppearance="@style/FirebaseUI.Text.HintText"> + app:hintTextAppearance="@style/FirebaseUI.Text.HintText" + app:passwordToggleEnabled="true"> - - - + android:layout_height="wrap_content" + app:passwordToggleEnabled="true"> - - - + android:layout_height="wrap_content" + app:passwordToggleEnabled="true"> - - textPassword - - diff --git a/auth/src/main/res/values/values.xml b/auth/src/main/res/values/values.xml index 6869c25c2..818e6fef2 100644 --- a/auth/src/main/res/values/values.xml +++ b/auth/src/main/res/values/values.xml @@ -1,6 +1,4 @@ 6 - 1.0 - 0.4