CHANGELOG.md 17.3 KB
Newer Older
J
Jake Wharton 已提交
1 2 3
Change Log
==========

J
Jake Wharton 已提交
4 5 6 7 8 9 10
Version 10.0.0 *(2019-01-03)*
-----------------------------

 * Equivalent to 9.0.0 but only supports AndroidX-enabled builds.
 * Removed APIs deprecated in 9.0.0.


J
Jake Wharton 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
Version 9.0.0 *(2019-01-03)*
----------------------------

 * New: Support for AndroidX. Requires `android.useAndroidX=true` in `gradle.properties` to generate
   AndroidX code.

 * New: A `butterknife-runtime` artifact has been extracted from `butterknife` which contains the APIs
   required for the generated code but does not contain the code to reflectively look up the generated
   code. This allows you to reference the generated code directly such that R8/ProGuard optimization can
   rename both the generated code and your classes. `ButterKnife.bind` and the consumer R8/ProGuard rules
   remain in the old `butterknife` artifact.
 
 * New: Experimental `butterknife-reflect` artifact eliminates the need to run the annotation
   processor for IDE builds. This artifact is binary compatible with `butterknife` so it can be interchanged
   depending on how your build is being invoked. See [its README](butterknife-reflect/README.md) for more
   information. Currently about 90% of functionality is covered. File bugs for anything that does not work.

   Note: This artifact requires Java 8. There's no good reason for this except to push the ecosystem to
   having this be a default. As of AGP 3.2 there is no reason not to do this.

 * New: Lint checks have been ported to UAST and now work on Kotlin code.

 * Add support for Android Gradle plugin 3.3 and newer where `R` is no longer generated as Java source. This
   has a side-effect of removing support for Android Gradle plugin 3.0.x (and older).
 * Use Java 8 bytecode for all artifacts as announced in RC1 release notes.
 * Fix: Allow `@BindFont` to work prior to API 26 using `ResourcesCompat`.
 * Fix: Update Android Gradle plugin to 3.1 or newer to fix binary incompatibilities.
 * Fix: Correct generated resource annotation names when running Turkish locale.
 * Fix: Use the application ID instead of the resource package for generating `R2`.
 * Cache the fact that a class hierarchy has no remaining bindings to prevent traversing the hierarchy
   multiple times.
 * Deprecated methods from 8.x have been removed.


J
Jake Wharton 已提交
45 46 47 48 49 50 51 52
Version 9.0.0-rc3 *(2018-12-20)*
--------------------------------

 * Fix: Correct generated resource annotation names when running Turkish locale.
 * Cache the fact that a class hierarchy has no remaining bindings to prevent traversing the hierarchy
   multiple times.


J
Jake Wharton 已提交
53 54 55 56 57 58 59 60
Version 9.0.0-rc2 *(2018-11-19)*
--------------------------------

 * Add support for Android Gradle plugin 3.3 and newer where `R` is no longer generated as Java source. This
   has a side-effect of removing support for Android Gradle plugin 3.0.x (and older).
 * Use Java 8 bytecode for all artifacts as announced in RC1 release notes.


J
Jake Wharton 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
Version 9.0.0-rc1 *(2018-10-10)*
--------------------------------

 * New: Support for AndroidX. Requires `android.useAndroidX=true` in `gradle.properties` to generate
   AndroidX code.

 * New: A `butterknife-runtime` artifact has been extracted from `butterknife` which contains the APIs
   required for the generated code but does not contain the code to reflectively look up the generated
   code. This allows you to reference the generated code directly such that R8/ProGuard optimization can
   rename both the generated code and your classes. `ButterKnife.bind` and the consumer R8/ProGuard rules
   remain in the old `butterknife` artifact.
 
 * New: Experimental `butterknife-reflect` artifact eliminates the need to run the annotation
   processor for IDE builds. This artifact is binary compatible with `butterknife` so it can be interchanged
   depending on how your build is being invoked. See [its README](butterknife-reflect/README.md) for more
   information. Currently about 90% of functionality is covered. File bugs for anything that does not work.

   Note: This artifact requires Java 8. There's no good reason for this except to push the ecosystem to
   having this be a default. As of AGP 3.2 there is no reason not to do this.

 * New: Lint checks have been ported to UAST and now work on Kotlin code.

 * Fix: Allow `@BindFont` to work prior to API 26 using `ResourcesCompat`.
 * Fix: Update Android Gradle plugin to 3.1 or newer to fix binary incompatibilities.
 * Fix: Use the application ID instead of the resource package for generating `R2`.
 * Deprecated methods from 8.x have been removed.

Note: The next release candidate will switch all artifacts to require Java 8 bytecode which will force
your applications to enable Java 8 bytecode. As of AGP 3.2 there is no cost to this, and there is no
reason to have it set any lower.


J
Jake Wharton 已提交
93 94 95 96 97 98
Version 8.8.1 *(2017-08-09)*
----------------------------

 * Fix: Properly emit casts for single-bound view subtypes when `butterknife.debuggable` is set to `false`.


J
Jake Wharton 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111
Version 8.8.0 *(2017-08-04)*
----------------------------

 * New: Processor option `butterknife.debuggable` controls whether debug information is generated. When
   specified as `false`, 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 `findById` methods. Compile against API 26 and use the normal `findViewById` for the same
   functionality.
 * Fix: Correct `@BindFont` code generation on pre-API 26 builds to pass a `Context` (not a `Resources`) to
   `ResourceCompat`.


J
Jake Wharton 已提交
112 113 114 115 116 117 118 119 120 121
Version 8.7.0 *(2017-07-07)*
----------------------------

 * New: `@BindFont` annotation binds `Typeface` instances with an optional style. Requires support libraries
   26.0.0-beta1 or newer.
 * New: `@BindAnim` annotation binds `Animation` instances.
 * New: Generate `R2` constants for animation, layout, menu, plurals, styles, and styleables.
 * Fix: Properly catch and re-throw type cast exceptions when method binding arguments do not match.


J
Jake Wharton 已提交
122 123 124 125 126 127 128 129
Version 8.6.0 *(2017-05-16)*
----------------------------

 * 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.


J
Jake Wharton 已提交
130 131 132 133 134 135
Version 8.5.1 *(2017-01-24)*
----------------------------

 * Fix: Tweak bundled ProGuard rules to only retain the two-argument constructor accessed via reflection.


J
Jake Wharton 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148
Version 8.5.0 *(2017-01-23)*
----------------------------

 * Emit `@SuppressLint` when using `@OnTouch` to 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.minSdk` until 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`, and `Dialog` subclasses.
 * Generated classes are no longer generic.
 * Minimum supported SDK is now 9.


J
Jake Wharton 已提交
149 150 151 152 153 154 155 156 157
Version 8.4.0 *(2016-08-26)*
----------------------------

 * New: `@BindFloat` annotation for dimensions whose format is of type 'float'. See the annotation for more
   information.
 * Generated constructors are now annotated with `@UiThread` and non-final, base classes `unbind()` methods
   are annotated with `@CallSuper`.


J
Jake Wharton 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170
Version 8.3.0 *(2016-08-23)*
----------------------------

 * New: Support for Jack compiler in application projects.
 * Fix: Generate ~20% less code and ~40% less methods.
 * Fix: Allow `@BindView` to 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 named `Test_ViewBinding`. Calling its constructor will bind the instance passed in, and
   the create object is also the implementation of `Unbinder` that can be used to unbind the views.
   Note: The API of this generated code is subject to backwards-incompatible changes until v9.0.


J
Jake Wharton 已提交
171 172 173 174 175 176 177 178
Version 8.2.1 *(2016-07-11)*
----------------------------

 * Fix: Do not emit `android.R` imports in generated code.
 * Fix: Ensure the processor does not crash when scanning for `R` classes. This can occur when used in a
   Kotlin project.


J
Jake Wharton 已提交
179 180 181 182 183
Version 8.2.0 *(2016-07-10)*
----------------------------

 * New: Support for library projects. Requires application of a Butter Knife Gradle plugin. See README for
   details.
J
Jake Wharton 已提交
184
 * New: Generated code now emits `R` references instead of raw integer IDs.
S
Santiago Castro 已提交
185
 * Fix: `@OnPageChange` listener binding now uses the 'add'/'remove' methods on `ViewPager` instead of 'set'.
J
Jake Wharton 已提交
186 187


J
Jake Wharton 已提交
188 189 190 191 192 193 194 195 196
Version 8.1.0 *(2016-06-14)*
----------------------------

 * 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 `TextView` to unbind `@OnTextChanged` uses.
 * Fix: Properly handle package names which contain uppercase letters.


J
Jake Wharton 已提交
197 198 199 200 201 202 203
Version 8.0.1 *(2016-04-27)*
----------------------------

 * Fix: ProGuard rules now prevent obfuscation of only types which reference ButterKnife annotations.
 * Eliminate some of the generated machinery when referenced from `final` types.


J
Jake Wharton 已提交
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
Version 8.0.0 *(2016-04-25)*
----------------------------

 *  `@Bind` becomes `@BindView` and `@BindViews` (one view and multiple views, respectively).
 *  Calls to `bind` now return an `Unbinder` instance which can be used to `null` references. This replaces
    the `unbind` API and adds support for being able to clear listeners.
 *  New: `@BindArray` binds `String`, `CharSequence`, and `int` arrays and `TypeArray` to fields.
 *  New: `@BindBitmap` binds `Bitmap` instances from resources to fields.
 *  `@BindDrawable` now supports a `tint` field which accepts a theme attribute.
 *  The runtime and compiler are now split into two artifacts.

    ```groovy
    compile 'com.jakewharton:butterknife:8.0.0'
    apt 'com.jakewharton:butterknife-compiler:8.0.0'
    ```
 *  New: `apply` overloads which accept a single view and arrays of views.
 *  ProGuard rules now ship inside of the library and are included automatically.
 *  `@Optional` annotation is back to mark methods as being optional.


J
Jake Wharton 已提交
224 225 226 227 228 229
Version 7.0.1 *(2015-06-30)*
----------------------------

 * Fix: Correct `ClassCastException` which occurred when `@Nullable` array bindings had missing views.


J
Jake Wharton 已提交
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
Version 7.0.0 *(2015-06-27)*
----------------------------

 * `@Bind` replaces `@InjectView` and `@InjectViews`.
 * `ButterKnife.bind` and `ButterKnife.unbind` replaces `ButterKnife.inject` and `ButterKnife.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 an `R.bool` ID to a `boolean` field.
   * `@BindColor` binds an `R.color` ID to an `int` or `ColorStateList` field.
   * `@BindDimen` binds an `R.dimen` ID to an `int` (for pixel size) or `float` (for exact value) field.
   * `@BindDrawable` binds an `R.drawable` ID to a `Drawable` field.
   * `@BindInt` binds an `R.int` ID to an `int` field.
   * `@BindString` binds an `R.string` ID to a `String` field.
 * Fix: Missing views will be filtered out from list and array bindings.
245 246
 * Note: If you are using Proguard, the generated class name has changed from being suffixed with `$$ViewInjector`
   to `$$ViewBinder`.
J
Jake Wharton 已提交
247 248


J
Jake Wharton 已提交
249 250 251 252
Version 6.1.0 *(2015-01-29)*
----------------------------

 * New: Support for injecting interface types everywhere that views were previously supported (e.g., `Checkable`).
P
Prateek Srivastava 已提交
253
 * Eliminate reflection-based method invocation for injection and resetting. This makes performance slightly faster
J
Jake Wharton 已提交
254 255 256 257
   (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.


J
Jake Wharton 已提交
258 259
Version 6.0.0 *(2014-10-27)*
----------------------------
J
Jake Wharton 已提交
260 261

 * New: Listeners can bind to the root view being injected by omitting a view ID on the annotation.
J
Jake Wharton 已提交
262 263
 * 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.
J
Jake Wharton 已提交
264 265 266 267 268 269 270
 * `findById` overload for view lookup on `Dialog` 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.


J
Jake Wharton 已提交
271 272 273 274 275 276 277
Version 5.1.2 *(2014-08-01)*
----------------------------

 * Report an error if the annotations are on a class inside the `android.*` or `java.*`
   package. Since we ignore these packages in the runtime, injection would never work.


J
Jake Wharton 已提交
278 279 280 281 282 283
Version 5.1.1 *(2014-06-19)*
----------------------------

 * Fix: Correct rare `ClassCastException` when unwinding an `InvocationTargetException`.


J
Jake Wharton 已提交
284 285 286 287 288 289 290 291 292
Version 5.1.0 *(2014-05-20)*
----------------------------

 * 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.


J
Jake Wharton 已提交
293 294
Version 5.0.1 *(2014-05-04)*
----------------------------
295 296 297 298 299

 * New: Support `Dialog` as injection source.
 * Fix: Unwrap `InvocationTargetException` causes for more helpful exceptions.


J
Jake Wharton 已提交
300 301
Version 5.0.0 *(2014-04-21)*
----------------------------
J
Jake Wharton 已提交
302 303

 * New: `@InjectViews` annotation groups multiple IDs into a `List` or array.
J
Jake Wharton 已提交
304 305
 * New: `ButterKnife.apply` method applies an `Action`, `Setter`, or Android `Property` to views in
   a list.
306 307 308 309 310
 * New listeners!
   * `ViewPager`: `@OnPageChange`.
   * `AdapterView`: `@OnItemSelected`.
   * `TextView`: `@OnTextChanged`.
 * New: Multi-method listener support. Specify a `callback` argument to choose which method the
J
Jake Wharton 已提交
311
   binding is for. *(See `@OnItemSelected` for an example)*
J
Jake Wharton 已提交
312 313 314 315 316
 * 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.


J
Jake Wharton 已提交
317 318 319 320 321 322 323
Version 4.0.1 *(2013-11-25)*
----------------------------

 * Fix: Correct a problem preventing the annotation processor to access Android types when certain
   `javac` configurations were used to build.


J
Jake Wharton 已提交
324 325
Version 4.0.0 *(2013-11-25)*
----------------------------
J
Jake Wharton 已提交
326 327 328

`Views` class is now named `ButterKnife`

J
Jake Wharton 已提交
329 330 331 332 333
 * New listeners!
   * `View`: `@OnLongClick` and `@OnFocusChanged`.
   * `TextView`: `@OnEditorAction`.
   * `AdapterView`: `@OnItemClick` and `@OnItemLongClick`.
   * `CompoundButton`: `@OnCheckedChanged`.
J
Jake Wharton 已提交
334 335 336 337 338
 * 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.


J
Jake Wharton 已提交
339 340 341 342 343 344
Version 3.0.1 *(2013-11-12)*
----------------------------

 * Fix: Do not emit redundant casts to `View`.


J
Jake Wharton 已提交
345 346
Version 3.0.0 *(2013-09-10)*
----------------------------
347 348 349 350 351

 * New: Injections are now required. An exception will be thrown if a view is
   not found. Add `@Optional` annotation to suppress this verification.


352 353 354 355 356 357
Version 2.0.1 *(2013-07-18)*
----------------------------

 * New: Control debug logging via `Views.setDebug`.


358 359 360 361 362 363
Version 2.0.0 *(2013-07-16)*
----------------------------

 * New: `@OnClick` annotation for binding click listeners to methods!


J
Jake Wharton 已提交
364 365 366 367 368
Version 1.4.0 *(2013-06-03)*
----------------------------

 * New: `Views.reset` for settings injections back to `null` in a fragment's
   `onDestroyView` callback.
C
Christian Becker 已提交
369
 * Fix: Support parent class injection when the parent class has generics.
J
Jake Wharton 已提交
370 371


J
Jake Wharton 已提交
372 373
Version 1.3.2 *(2013-04-27)*
----------------------------
374

375
 * Multiple injections of the same view ID only require a single find call.
376 377 378 379
 * Fix: Ensure injection happens on classes who do not have any injections but
   their superclasses do.


J
Jake Wharton 已提交
380 381 382 383 384 385
Version 1.3.1 *(2013-04-12)*
----------------------------

 * Fix: Parent class inflater resolution now generates correct code.


J
Jake Wharton 已提交
386 387
Version 1.3.0 *(2013-03-26)*
----------------------------
388

J
Jake Wharton 已提交
389 390
 * New: Injection on objects that have zero `@InjectView`-annotated fields will
   no longer throw an exception.
391 392


393 394 395 396 397 398
Version 1.2.2 *(2013-03-11)*
----------------------------

 * Fix: Prevent annotations on private classes.


J
Jake Wharton 已提交
399 400
Version 1.2.1 *(2013-03-11)*
----------------------------
401 402

 * Fix: Correct generated code for parent class inflation.
J
Jake Wharton 已提交
403
 * Fix: Allow injection on `protected`-scoped fields.
404 405


406 407
Version 1.2.0 *(2013-05-07)*
----------------------------
408 409 410

 * Support injection on any object using an Activity as the view root.
 * Support injection on views for their children.
411
 * Fix: Annotation errors now appear on the affected field in IDEs.
412 413


J
Jake Wharton 已提交
414 415 416 417 418 419 420
Version 1.1.1 *(2013-05-06)*
----------------------------

 * Fix: Verify that the target type extends from `View`.
 * Fix: Correct package name resolution in Eclipse 4.2


J
Jake Wharton 已提交
421 422
Version 1.1.0 *(2013-03-05)*
----------------------------
423

J
Jake Wharton 已提交
424 425
 * Perform injection on any object by passing a view root.
 * Fix: Correct naming of static inner-class injection points.
426 427 428
 * Fix: Enforce `findById` can only be used with child classes of `View`.


J
Jake Wharton 已提交
429 430 431 432
Version 1.0.0 *(2013-03-05)*
----------------------------

Initial release.