Commit 85a87f9e authored by Reda Tawfik's avatar Reda Tawfik Committed by Commit Bot

[Android][Mfill] Fix a bug in AllPasswordsBottomSheetViewTest

This CL fixes this bug crbug.com/1127200. Which arise when
`View.setOnClickListener(null)` is called. This causes the view
to become clickable again, even though no click listener exists.

TBR=fhorschig@chromium.org

Bug: 1127200
Change-Id: I0eb0a404346aa97830c29ac0cf4f959c40e06beb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405581Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Commit-Queue: Reda Tawfik <redatawfik@google.com>
Commit-Queue: Ioana Pandele <ioanap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806223}
parent 3b81f9c6
...@@ -104,10 +104,15 @@ class AllPasswordsBottomSheetViewBinder { ...@@ -104,10 +104,15 @@ class AllPasswordsBottomSheetViewBinder {
passwordView.setOnClickListener( passwordView.setOnClickListener(
src -> model.get(ON_CLICK_LISTENER).onResult(credential)); src -> model.get(ON_CLICK_LISTENER).onResult(credential));
usernameView.setOnClickListener(null); usernameView.setOnClickListener(null);
usernameView.setClickable(false);
} else { } else {
usernameView.setOnClickListener( String username = credential.getUsername();
src -> model.get(ON_CLICK_LISTENER).onResult(credential)); usernameView.setOnClickListener(username.isEmpty()
? null
: src -> model.get(ON_CLICK_LISTENER).onResult(credential));
usernameView.setClickable(!username.isEmpty());
passwordView.setOnClickListener(null); passwordView.setOnClickListener(null);
passwordView.setClickable(false);
} }
} else if (propertyKey == IS_PASSWORD_FIELD) { } else if (propertyKey == IS_PASSWORD_FIELD) {
boolean isPasswordField = model.get(IS_PASSWORD_FIELD); boolean isPasswordField = model.get(IS_PASSWORD_FIELD);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment