Skip to content

Commit 8438c49

Browse files
SUPERCILEXsamtstern
authored andcommitted
Password visibility toggle fix (#349)
* Update dependencies * Update tests * Update test dependencies * Add workaround for password toggle * Update .travis.yml
1 parent 3ccbd66 commit 8438c49

21 files changed

+55
-55
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ android:
55
components:
66
- platform-tools
77
- tools
8-
- build-tools-23.0.3
9-
- android-23
8+
- build-tools-24.0.3
9+
- android-24
10+
11+
# Extras
1012
- extra-google-google_play_services
1113
- extra-google-m2repository
1214
- extra-android-m2repository
1315
- addon-google_apis-google-24
14-
licenses:
15-
- 'android-sdk-preview-license-52d11cd2'
16-
- 'android-sdk-license-.+'
17-
- 'google-gdk-license-.+'
1816
script:
1917
- ./gradlew clean :library:testAll :library:prepareArtifacts

auth/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ android {
3131

3232
dependencies {
3333
testCompile 'junit:junit:4.12'
34-
testCompile 'org.mockito:mockito-core:1.10.19'
35-
testCompile "org.robolectric:robolectric:3.1.1"
36-
compile "com.android.support:appcompat-v7:${project.ext.support_library_version}"
34+
testCompile 'org.mockito:mockito-core:2.2.0'
35+
testCompile 'org.robolectric:robolectric:3.1.2'
36+
// See https://github.com/robolectric/robolectric/issues/1932#issuecomment-219796474
37+
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
38+
3739
compile 'com.facebook.android:facebook-android-sdk:4.14.1'
3840
compile "com.android.support:design:${project.ext.support_library_version}"
3941

auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackIDPPrompt.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ protected void onCreate(Bundle savedInstanceState) {
9090
if (mIdpProvider == null) {
9191
getIntent().putExtra(
9292
ExtraConstants.EXTRA_ERROR_MESSAGE,
93-
"Firebase login successful. Account linking failed due to provider not "
94-
+ "enabled by application");
93+
"Firebase login successful. Account linking failed due to provider not enabled by application");
9594
finish(RESULT_CANCELED, getIntent());
9695
return;
9796
}

auth/src/main/java/com/firebase/ui/auth/ui/account_link/WelcomeBackPasswordPrompt.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ protected void onCreate(Bundle savedInstanceState) {
8181
TextView bodyTextView = ((TextView) findViewById(R.id.welcome_back_password_body));
8282
bodyTextView.setText(spannableStringBuilder);
8383

84+
((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);
85+
8486
// Click listeners
8587
findViewById(R.id.button_done).setOnClickListener(this);
8688
findViewById(R.id.toggle_visibility).setOnClickListener(

auth/src/main/java/com/firebase/ui/auth/ui/email/ImageFocusTransparencyChanger.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ public void onFocusChange(View v, boolean hasFocus) {
3939
} else {
4040
mTogglePasswordImage.setAlpha(mSlightlyVisible);
4141
}
42-
4342
}
4443
}

auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public class RegisterEmailActivity extends AppCompatBase implements View.OnClick
6666
private EmailFieldValidator mEmailFieldValidator;
6767
private PasswordFieldValidator mPasswordFieldValidator;
6868
private RequiredFieldValidator mNameValidator;
69-
private ImageView mTogglePasswordImage;
7069

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

8584
mPasswordEditText = (EditText) findViewById(R.id.password);
86-
mTogglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
85+
((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);
86+
ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
8787

8888
mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger(
89-
mTogglePasswordImage,
89+
togglePasswordImage,
9090
visibleIcon.getFloat(),
9191
slightlyVisibleIcon.getFloat()));
9292

93-
mTogglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
93+
togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
9494

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

auth/src/main/java/com/firebase/ui/auth/ui/email/SignInActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public class SignInActivity extends AppCompatBase implements View.OnClickListene
5050
private EditText mPasswordEditText;
5151
private EmailFieldValidator mEmailValidator;
5252
private RequiredFieldValidator mPasswordValidator;
53-
private ImageView mTogglePasswordImage;
5453

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

7069
mPasswordEditText = (EditText) findViewById(R.id.password);
71-
mTogglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
70+
((TextInputLayout) findViewById(R.id.password_layout)).setPasswordVisibilityToggleEnabled(false);
71+
ImageView togglePasswordImage = (ImageView) findViewById(R.id.toggle_visibility);
7272

7373
mPasswordEditText.setOnFocusChangeListener(new ImageFocusTransparencyChanger(
74-
mTogglePasswordImage,
74+
togglePasswordImage,
7575
visibleIcon.getFloat(),
7676
slightlyVisibleIcon.getFloat()));
7777

78-
mTogglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
78+
togglePasswordImage.setOnClickListener(new PasswordToggler(mPasswordEditText));
7979

8080
mEmailValidator = new EmailFieldValidator((TextInputLayout) findViewById(R.id
8181
.email_layout));

auth/src/main/res/layout/sign_in_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
android:layout_height="wrap_content">
3535

3636
<EditText
37-
style="@style/FirebaseUI.EditText"
37+
style="@style/FirebaseUI.EditText.PasswordField"
3838
android:id="@+id/password"
3939
android:hint="@string/password_hint"
4040
/>

auth/src/main/res/layout/welcome_back_password_prompt_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
android:layout_height="wrap_content">
2929

3030
<EditText
31-
style="@style/FirebaseUI.EditText"
31+
style="@style/FirebaseUI.EditText.PasswordField"
3232
android:id="@+id/password"
3333
android:hint="@string/password_hint"
3434
/>

auth/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
<item name="android:inputType">textPassword</item>
161161
</style>
162162

163-
<style name="FirebaseUI.ImageView"></style>
163+
<style name="FirebaseUI.ImageView"/>
164164

165165
<style name="FirebaseUI.ImageView.VisibilityToggle">
166166
<item name="android:layout_marginBottom">12dp</item>

0 commit comments

Comments
 (0)