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

Add containerClick #34

Open
miszmaniac opened this issue Jan 19, 2018 · 3 comments
Open

Add containerClick #34

miszmaniac opened this issue Jan 19, 2018 · 3 comments

Comments

@miszmaniac
Copy link

Many times, we need to support click on whole element, so if it's possible, could you add methods
.click and .longClick without additional ID parameter, and pass that to whole injected view?

@JoaoVictordaSilva
Copy link

JoaoVictordaSilva commented Jan 19, 2018

SlimAdapter.create()
                .register(R.layout.recycler_item, new SlimInjector<Foo>() {
                    @Override
                    public void onInject(Foo data, IViewInjector injector) {
                        injector.clicked(R.id.YOUR_ID_ROOT_ELEMENT, view -> {
                                   //Some Action
                                });
                      }
                })
                .attachTo(mRecycler);

@miszmaniac
Try to put ID in your root element. I guess that's what you want.

@miszmaniac
Copy link
Author

I know that I can do that this way, it's just cumbersome, and in Kotlin it prevents for use of {}

@JoaoVictordaSilva
Copy link

JoaoVictordaSilva commented Feb 14, 2018

@miszmaniac
Just call 'clicked' passing a listener. I'll wait your feedback, if all things are ok make a pull request.

Replace these files.
DefaultViewInjector.txt
IViewInjector.txt

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