Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Add options about auto-generation of inject code for Activity and Fragment #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bruce3x
Copy link

@bruce3x bruce3x commented Dec 21, 2016

Add two options in plugin's setting screen, about auto-generation of inject code for Activity and Fragment.

@bruce3x
Copy link
Author

bruce3x commented Dec 21, 2016

image

@bruce3x
Copy link
Author

bruce3x commented Dec 21, 2016

Hi @TomasKypta ,this can solve issues: #108 #100 #91 #68

@siempredelao
Copy link
Contributor

Hi @BruceZZ, if you read those issues carefully, the problem is that we have a superclass where we already bind the views and we want to avoid auto-generating that code in inherited classes.

Check those explanations:

...because I do bind my views in my parent class.

The onCreateView method is overridden by the plugin even if binding ButterKnife from a base class.

The general way I use is that do ButterKnife.bind(this); in BaseActivity...

Usually I've some BaseActivity and/or BaseFragment... ...but the plugin does not play well with Butterknife binding as superclass-made behavior.

The solution you provide here avoids auto-generating code as soon as the user checks those CheckBox's, even if it is needed.

@bruce3x
Copy link
Author

bruce3x commented Dec 21, 2016

Hi @siempredelao , thanks for reply.

In my application, I use ButterKnife.bind(this) in BaseActivity#onCreate(), so I no longer need to write it in the subclass in most cases. It means that the plugin shouldn't generate the inject code in my subclasses. Then I add two options into the Preferences which can turn off auto-generation of inject code.

My solution is a tricky way to avoid auto-generation of inject code in inherited classes. :)

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

Successfully merging this pull request may close these issues.

2 participants