avast / android-butterknife-zelezny

Android Studio plug-in for generating ButterKnife injections from selected layout XML.
Apache License 2.0
3.38k stars 413 forks source link

Avoid auto-generating methods if already present in parent classes #127

Open siempredelao opened 7 years ago

siempredelao commented 7 years ago

Hi @TomasKypta, this PR solves issues #68, #74, #82, #100, #108 following @NikolaDespotoski's explanation here #74.

Behaviour followed has been: 1. find method (onCreate/onCreateView/onDestroyView) in current class and superclasses. 1.a. if list returned has size 1, that means that the only method found is the Android code base one. Then, add method in current class with bind/unbind. 1.b. otherwise 1.b.1. if no methods from 1 (that is to say, current class and superclasses) has ButterKnife bind/unbind declared. 1.b.1.1. find method only in current class 1.b.1.1.a. if method is found, just add bind/unbind. 1.b.1.1.b. otherwise, add method with bind/unbind. 1.b.2. otherwise, no action is needed

(not sure if it's the best explanation that way, maybe a flow chart would have been better).