Skip to content
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

Anvil event listeners don't handle focus properly #96

Open
aem opened this issue Feb 3, 2017 · 1 comment
Open

Anvil event listeners don't handle focus properly #96

aem opened this issue Feb 3, 2017 · 1 comment

Comments

@aem
Copy link

aem commented Feb 3, 2017

Anvil version: 0.4.0

Trying to set a listener for onFocusChange or onTextChanged on an EditText via Anvil does not work properly. Each time the listener gets called the EditText loses focus, even with an empty handler body.

This has been isolated to an Anvil issue, as my workaround to manually set the listener via Anvil.currentView<EditText>().onFocusChangeListener = MyChangeListener() works fine.

This is reproducible on multiple versions of Android on both physical and virtual devices.

@Martori
Copy link

Martori commented Jul 28, 2017

I detected the same issue. My workaround is to set it on the init method:
init(() -> { Anvil.currentView().setOnFocusChangeListener((v, focus) -> { //my logic here }); });
With the onTextChanged I haven't found a passable solution yet. All the solution that come to my mind add to much boilerplate to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants