- Fix: Properly emit casts for single-bound view subtypes when
butterknife.debuggableis set tofalse.
- New: Processor option
butterknife.debuggablecontrols whether debug information is generated. When specified asfalse, checks for required views being non-null are elided and casts are no longer guarded with user-friendly error messages. This reduces the amount of generated code for release builds at the expense of less friendly exceptions when something breaks. - Deprecate the
findByIdmethods. Compile against API 26 and use the normalfindViewByIdfor the same functionality. - Fix: Correct
@BindFontcode generation on pre-API 26 builds to pass aContext(not aResources) toResourceCompat.
- New:
@BindFontannotation bindsTypefaceinstances with an optional style. Requires support libraries 26.0.0-beta1 or newer. - New:
@BindAnimannotation bindsAnimationinstances. - New: Generate
R2constants for animation, layout, menu, plurals, styles, and styleables. - Fix: Properly catch and re-throw type cast exceptions when method binding arguments do not match.
- Plugin was ported to Kotlin and updated to support future Android Gradle plugin versions.
- Fix: Properly handle multiple library modules using Butter Knife and defining the same ID.
- Fix: Use the same classloader of the binding target to load the generated view binding class.
- Fix: Tweak bundled ProGuard rules to only retain the two-argument constructor accessed via reflection.
- Emit
@SuppressLintwhen using@OnTouchto avoid a lint warning. - Migrate lint checks from Lombok AST to JetBrains PSI.
- Annotations are no longer claimed by the processor.
- Based on the minimum SDK version (as specified by
butterknife.minSdkuntil http://b.android.com/187527 is released) the generated code now changes to use newer APIs when available. - Generated classes now include single-argument overloads for
View,Activity, andDialogsubclasses. - Generated classes are no longer generic.
- Minimum supported SDK is now 9.
- New:
@BindFloatannotation for dimensions whose format is of type 'float'. See the annotation for more information. - Generated constructors are now annotated with
@UiThreadand non-final, base classesunbind()methods are annotated with@CallSuper.
- New: Support for Jack compiler in application projects.
- Fix: Generate ~20% less code and ~40% less methods.
- Fix: Allow
@BindViewto reference types which are generated by other annotation processors. - Experimental: The generated view binding class can now be used directly. This allows ProGuard shrinking,
optimization, and obfuscation to work without any rules being needed. For a class
Test, the binding class will be namedTest_ViewBinding. Calling its constructor will bind the instance passed in, and the create object is also the implementation ofUnbinderthat can be used to unbind the views. Note: The API of this generated code is subject to backwards-incompatible changes until v9.0.
- Fix: Do not emit
android.Rimports in generated code. - Fix: Ensure the processor does not crash when scanning for
Rclasses. This can occur when used in a Kotlin project.
- New: Support for library projects. Requires application of a Butter Knife Gradle plugin. See README for details.
- New: Generated code now emits
Rreferences instead of raw integer IDs. - Fix:
@OnPageChangelistener binding now uses the 'add'/'remove' methods onViewPagerinstead of 'set'.
- New: Change the structure of generated view binders to optimize for performance and generated code. This should result in faster binding (not that it's slow) and a reduction of methods.
- Fix: Call the correct method on
TextViewto unbind@OnTextChangeduses. - Fix: Properly handle package names which contain uppercase letters.
- Fix: ProGuard rules now prevent obfuscation of only types which reference ButterKnife annotations.
- Eliminate some of the generated machinery when referenced from
finaltypes.
-
@Bindbecomes@BindViewand@BindViews(one view and multiple views, respectively). -
Calls to
bindnow return anUnbinderinstance which can be used tonullreferences. This replaces theunbindAPI and adds support for being able to clear listeners. -
New:
@BindArraybindsString,CharSequence, andintarrays andTypeArrayto fields. -
New:
@BindBitmapbindsBitmapinstances from resources to fields. -
@BindDrawablenow supports atintfield which accepts a theme attribute. -
The runtime and compiler are now split into two artifacts.
compile 'com.jakewharton:butterknife:8.0.0' apt 'com.jakewharton:butterknife-compiler:8.0.0'
-
New:
applyoverloads which accept a single view and arrays of views. -
ProGuard rules now ship inside of the library and are included automatically.
-
@Optionalannotation is back to mark methods as being optional.
- Fix: Correct
ClassCastExceptionwhich occurred when@Nullablearray bindings had missing views.
@Bindreplaces@InjectViewand@InjectViews.ButterKnife.bindandButterKnife.unbindreplacesButterKnife.injectandButterKnife.reset, respectively.@Optionalhas been removed. Use@Nullablefrom the 'support-annotations' library, or any other annotation named "Nullable".- New: Resource binding annotations!
@BindBoolbinds anR.boolID to abooleanfield.@BindColorbinds anR.colorID to anintorColorStateListfield.@BindDimenbinds anR.dimenID to anint(for pixel size) orfloat(for exact value) field.@BindDrawablebinds anR.drawableID to aDrawablefield.@BindIntbinds anR.intID to anintfield.@BindStringbinds anR.stringID to aStringfield.
- 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
$$ViewInjectorto$$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.forNamelookup 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.
findByIdoverload for view lookup onDialoginstances.- 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
ClassCastExceptionwhen unwinding anInvocationTargetException.
- New listener!
View:@OnTouch.
- Fix:
@Optionalnow correctly works for@InjectViewsfields. - Fix: Correct erasure problem which may have prevented the processor from running in Eclipse.
- New: Support
Dialogas injection source. - Fix: Unwrap
InvocationTargetExceptioncauses for more helpful exceptions.
- New:
@InjectViewsannotation groups multiple IDs into aListor array. - New:
ButterKnife.applymethod applies anAction,Setter, or AndroidPropertyto views in a list. - New listeners!
ViewPager:@OnPageChange.AdapterView:@OnItemSelected.TextView:@OnTextChanged.
- New: Multi-method listener support. Specify a
callbackargument to choose which method the binding is for. (See@OnItemSelectedfor 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
javacconfigurations were used to build.
Views class is now named ButterKnife
- New listeners!
View:@OnLongClickand@OnFocusChanged.TextView:@OnEditorAction.AdapterView:@OnItemClickand@OnItemLongClick.CompoundButton:@OnCheckedChanged.
- New: Views are now only checked to be
nullonce if at least one of the fields and/or methods lack the@Optionalannotation. - Fix: Do no emit redundant casts to
Viewfor 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
@Optionalannotation to suppress this verification.
- New: Control debug logging via
Views.setDebug.
- New:
@OnClickannotation for binding click listeners to methods!
- New:
Views.resetfor settings injections back tonullin a fragment'sonDestroyViewcallback. - 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
findByIdcan only be used with child classes ofView.
Initial release.