- Fix: Correct
ClassCastException
which occurred when@Nullable
array bindings had missing views.
@Bind
replaces@InjectView
and@InjectViews
.ButterKnife.bind
andButterKnife.unbind
replacesButterKnife.inject
andButterKnife.reset
, respectively.@Optional
has been removed. Use@Nullable
from the 'support-annotations' library, or any other annotation named "Nullable".- New: Resource binding annotations!
@BindBool
binds anR.bool
ID to aboolean
field.@BindColor
binds anR.color
ID to anint
orColorStateList
field.@BindDimen
binds anR.dimen
ID to anint
(for pixel size) orfloat
(for exact value) field.@BindDrawable
binds anR.drawable
ID to aDrawable
field.@BindInt
binds anR.int
ID to anint
field.@BindString
binds anR.string
ID to aString
field.
- Fix: Missing views will be filtered out from list and array bindings.
- Note: If you are using Proguard, the generated class name has changed from being suffixed with
$$ViewInjector
to$$ViewBinder
.
- New: Support for injecting interface types everywhere that views were previously supported (e.g.,
Checkable
). - Eliminate reflection-based method invocation for injection and resetting. This makes performance slightly faster
(although if you are worried about the performance of Butter Knife you have other problems). The only reflection
in the library is a single
Class.forName
lookup for each type.
- New: Listeners can bind to the root view being injected by omitting a view ID on the annotation.
- New: Exceptions thrown from missing views now include the human-readable ID name (e.g., 'button1').
- Specifying multiple fields binding to the same ID is now considered an error.
findById
overload for view lookup onDialog
instances.- Experimental: Click listeners are now globally debounced per frame. This means that only a single click will be processed per frame preventing race conditions due to queued input events.
- Experimental: Multiple methods can bind to the same listener provided that listener's callback method does not require a return value.
- Report an error if the annotations are on a class inside the
android.*
orjava.*
package. Since we ignore these packages in the runtime, injection would never work.
- Fix: Correct rare
ClassCastException
when unwinding anInvocationTargetException
.
- New listener!
View
:@OnTouch
.
- Fix:
@Optional
now correctly works for@InjectViews
fields. - Fix: Correct erasure problem which may have prevented the processor from running in Eclipse.
- New: Support
Dialog
as injection source. - Fix: Unwrap
InvocationTargetException
causes for more helpful exceptions.
- New:
@InjectViews
annotation groups multiple IDs into aList
or array. - New:
ButterKnife.apply
method applies anAction
,Setter
, or AndroidProperty
to views in a list. - New listeners!
ViewPager
:@OnPageChange
.AdapterView
:@OnItemSelected
.TextView
:@OnTextChanged
.
- New: Multi-method listener support. Specify a
callback
argument to choose which method the binding is for. (See@OnItemSelected
for an example) - Fix: Support for generic types which are declared with an upper-bound.
- Fix: Use less sophisticated method injection inspection in the annotation processor. The previous method caused problems with some Eclipse configurations.
- Fix: Correct a problem preventing the annotation processor to access Android types when certain
javac
configurations were used to build.
Views
class is now named ButterKnife
- New listeners!
View
:@OnLongClick
and@OnFocusChanged
.TextView
:@OnEditorAction
.AdapterView
:@OnItemClick
and@OnItemLongClick
.CompoundButton
:@OnCheckedChanged
.
- New: Views are now only checked to be
null
once if at least one of the fields and/or methods lack the@Optional
annotation. - Fix: Do no emit redundant casts to
View
for methods.
- Fix: Do not emit redundant casts to
View
.
- New: Injections are now required. An exception will be thrown if a view is
not found. Add
@Optional
annotation to suppress this verification.
- New: Control debug logging via
Views.setDebug
.
- New:
@OnClick
annotation for binding click listeners to methods!
- New:
Views.reset
for settings injections back tonull
in a fragment'sonDestroyView
callback. - Fix: Support parent class injection when the parent class has generics.
- Multiple injections of the same view ID only require a single find call.
- Fix: Ensure injection happens on classes who do not have any injections but their superclasses do.
- Fix: Parent class inflater resolution now generates correct code.
- New: Injection on objects that have zero
@InjectView
-annotated fields will no longer throw an exception.
- Fix: Prevent annotations on private classes.
- Fix: Correct generated code for parent class inflation.
- Fix: Allow injection on
protected
-scoped fields.
- Support injection on any object using an Activity as the view root.
- Support injection on views for their children.
- Fix: Annotation errors now appear on the affected field in IDEs.
- Fix: Verify that the target type extends from
View
. - Fix: Correct package name resolution in Eclipse 4.2
- Perform injection on any object by passing a view root.
- Fix: Correct naming of static inner-class injection points.
- Fix: Enforce
findById
can only be used with child classes ofView
.
Initial release.