Skip to content

Password visibility toggle fix #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ android:
components:
- platform-tools
- tools
- build-tools-23.0.3
- android-23
- build-tools-24.0.3
- android-24

# Extras
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-24
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
script:
- ./gradlew clean :library:testAll :library:prepareArtifacts
8 changes: 5 additions & 3 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ android {

dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile "org.robolectric:robolectric:3.1.1"
compile "com.android.support:appcompat-v7:${project.ext.support_library_version}"
testCompile 'org.mockito:mockito-core:2.2.0'
testCompile 'org.robolectric:robolectric:3.1.2'
// See https://github.com/robolectric/robolectric/issues/1932#issuecomment-219796474
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'

compile 'com.facebook.android:facebook-android-sdk:4.14.1'
compile "com.android.support:design:${project.ext.support_library_version}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (mIdpProvider == null) {
getIntent().putExtra(
ExtraConstants.EXTRA_ERROR_MESSAGE,
"Firebase login successful. Account linking failed due to provider not "
+ "enabled by application");
"Firebase login successful. Account linking failed due to provider not enabled by application");
finish(RESULT_CANCELED, getIntent());
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ protected void onCreate(Bundle savedInstanceState) {
TextView bodyTextView = ((TextView) findViewById(R.id.welcome_back_password_body));
bodyTextView.setText(spannableStringBuilder);

((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);

// Click listeners
findViewById(R.id.button_done).setOnClickListener(this);
findViewById(R.id.toggle_visibility).setOnClickListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ public void onFocusChange(View v, boolean hasFocus) {
} else {
mTogglePasswordImage.setAlpha(mSlightlyVisible);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class RegisterEmailActivity extends AppCompatBase implements View.OnClick
private EmailFieldValidator mEmailFieldValidator;
private PasswordFieldValidator mPasswordFieldValidator;
private RequiredFieldValidator mNameValidator;
private ImageView mTogglePasswordImage;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -83,14 +82,15 @@ protected void onCreate(Bundle savedInstanceState) {
getResources().getValue(R.dimen.slightly_visible_icon, slightlyVisibleIcon, true);

mPasswordEditText = (EditText) findViewById(R.id.password);
mTogglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);
ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);

mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger(
mTogglePasswordImage,
togglePasswordImage,
visibleIcon.getFloat(),
slightlyVisibleIcon.getFloat()));

mTogglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));

mNameEditText = (EditText) findViewById(R.id.name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class SignInActivity extends AppCompatBase implements View.OnClickListene
private EditText mPasswordEditText;
private EmailFieldValidator mEmailValidator;
private RequiredFieldValidator mPasswordValidator;
private ImageView mTogglePasswordImage;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -68,14 +67,15 @@ protected void onCreate(Bundle savedInstanceState) {
getResources().getValue(R.dimen.slightly_visible_icon, slightlyVisibleIcon, true);

mPasswordEditText = (EditText) findViewById(R.id.password);
mTogglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);
ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);

mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger(
mTogglePasswordImage,
togglePasswordImage,
visibleIcon.getFloat(),
slightlyVisibleIcon.getFloat()));

mTogglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));

mEmailValidator = new EmailFieldValidator((TextInputLayout) findViewById(R.id
.email_layout));
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/layout/sign_in_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_height="wrap_content">

<EditText
style="@style/FirebaseUI.EditText"
style="@style/FirebaseUI.EditText.PasswordField"
android:id="@+id/password"
android:hint="@string/password_hint"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:layout_height="wrap_content">

<EditText
style="@style/FirebaseUI.EditText"
style="@style/FirebaseUI.EditText.PasswordField"
android:id="@+id/password"
android:hint="@string/password_hint"
/>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<item name="android:inputType">textPassword</item>
</style>

<style name="FirebaseUI.ImageView"></style>
<style name="FirebaseUI.ImageView"/>

<style name="FirebaseUI.ImageView.VisibilityToggle">
<item name="android:layout_marginBottom">12dp</item>
Expand Down
6 changes: 3 additions & 3 deletions auth/src/test/java/com/firebase/ui/auth/AuthUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package com.firebase.ui.auth;

import static junit.framework.Assert.assertEquals;

import android.content.Intent;

import com.firebase.ui.auth.test_helpers.CustomRobolectricGradleTestRunner;
Expand All @@ -31,8 +29,10 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import static junit.framework.Assert.assertEquals;

@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, sdk = 23)
public class AuthUITest {
private FirebaseApp mFirebaseApp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import com.firebase.ui.auth.util.FirebaseAuthWrapperImpl;

import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.internal.bytecode.InstrumentationConfiguration;

public class CustomRobolectricGradleTestRunner extends RobolectricGradleTestRunner {
public class CustomRobolectricGradleTestRunner extends RobolectricTestRunner {
public CustomRobolectricGradleTestRunner(Class<?> klass) throws InitializationError {
super(klass);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import static org.mockito.Mockito.when;

@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, shadows = {ActivityHelperShadow.class}, sdk = 21)
@Config(constants = BuildConfig.class, shadows = {ActivityHelperShadow.class}, sdk = 23)
public class ChooseAccountActivityTest {
private FirebaseApp mFirebaseApp;
@Mock private CredentialsAPI mCredentialsAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@

package com.firebase.ui.auth.ui.email;

import static junit.framework.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.Intent;
import android.widget.Button;

import com.firebase.ui.auth.BuildConfig;
import com.firebase.ui.auth.R;
import com.firebase.ui.auth.test_helpers.ActivityHelperShadow;
import com.firebase.ui.auth.test_helpers.AutoCompleteTask;
import com.firebase.ui.auth.BuildConfig;
import com.firebase.ui.auth.test_helpers.CustomRobolectricGradleTestRunner;
import com.firebase.ui.auth.R;
import com.firebase.ui.auth.test_helpers.TestConstants;
import com.firebase.ui.auth.test_helpers.TestHelper;
import com.firebase.ui.auth.ui.ExtraConstants;
Expand All @@ -40,8 +36,12 @@

import java.util.Collections;

import static junit.framework.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, sdk = 23)
public class RecoverPasswordActivityTest {

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@


@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, sdk = 23)
public class RegisterEmailActivityTest {

private RegisterEmailActivity createActivity(String email) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import static org.mockito.Mockito.when;

@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, sdk = 23)
public class SignInActivityTest {

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@

package com.firebase.ui.auth.ui.email;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

import android.content.Intent;
import android.support.design.widget.TextInputLayout;
import android.widget.Button;
import android.widget.EditText;

import com.firebase.ui.auth.test_helpers.ActivityHelperShadow;
import com.firebase.ui.auth.AuthUI;
import com.firebase.ui.auth.test_helpers.AutoCompleteTask;
import com.firebase.ui.auth.BuildConfig;
import com.firebase.ui.auth.R;
import com.firebase.ui.auth.test_helpers.ActivityHelperShadow;
import com.firebase.ui.auth.test_helpers.AutoCompleteTask;
import com.firebase.ui.auth.test_helpers.CustomRobolectricGradleTestRunner;
import com.firebase.ui.auth.test_helpers.FakeProviderQueryResult;
import com.firebase.ui.auth.R;
import com.firebase.ui.auth.test_helpers.TestConstants;
import com.firebase.ui.auth.test_helpers.TestHelper;
import com.firebase.ui.auth.ui.ExtraConstants;
Expand All @@ -47,9 +44,12 @@
import java.util.Arrays;
import java.util.Collections;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;


@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
@Config(constants = BuildConfig.class, sdk = 23)
public class SignInNoPasswordActivityTest {
@Before
public void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
GoogleProviderShadow.class,
FacebookProviderShadow.class,
LoginManagerShadow.class
}, sdk = 21)
}, sdk = 23)
public class AuthMethodPickerActivityTest {

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@


@RunWith(CustomRobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, shadows = {ActivityHelperShadow.class})
@Config(constants = BuildConfig.class, sdk = 23, shadows = {ActivityHelperShadow.class})
public class CredentialSignInHandlerTest {
private static final int RC_ACCOUNT_LINK = 3;
private static final int RC_SAVE_CREDENTIALS = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.when;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk=23)
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
public class HeadlessAPIWrapperImplTest {

private FirebaseAuthWrapperImpl mHeadlessAPIWrapperImpl;
Expand Down
10 changes: 5 additions & 5 deletions common/constants.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
project.ext.firebase_version = '9.6.0'
project.ext.support_library_version = '23.4.0'
project.ext.firebase_version = '9.6.1'
project.ext.support_library_version = '24.2.1'

project.ext.submodules = ['database', 'auth', 'storage']
project.ext.group = 'com.firebaseui'
project.ext.version = '0.6.0'
project.ext.pomdesc = 'Firebase UI Android'
project.ext.buildtools = '23.0.3'
project.ext.compileSdk = 23
project.ext.targetSdk = 23
project.ext.buildtools = '24.0.3'
project.ext.compileSdk = 24
project.ext.targetSdk = 24