项目作者: blipinsk

项目描述 :
Kotlin extension bridge library for Butterknife (proof-of-concept)
高级语言: Java
项目地址: git://github.com/blipinsk/butterknife-ktx.git
创建时间: 2018-06-10T19:08:43Z
项目社区:https://github.com/blipinsk/butterknife-ktx

开源协议:

下载


butterknife-ktx

ButterKnife using Kotlin extension functions instead of Java Reflection.


Kotlin extension bridge library for ButterKnife (proof-of-concept)

Read more here: @blipinsk/kotlin-extension-methods-generation-15b5e6499dc8">Kotlin extension function generation 🚀…

Usage

For a working usage of this library see the sample/ module.

  1. Add to your app’s build.gradle

    1. sourceSets {
    2. main.java.srcDirs += 'src/main/kotlin'
    3. debug.java.srcDirs += 'src/debug/kotlin'
    4. release.java.srcDirs += 'src/release/kotlin'
    5. test.java.srcDirs += 'src/test/kotlin'
    6. // For kapt stubs
    7. main.java.srcDirs += [file("$buildDir/generated/source/kapt/main")]
    8. debug.java.srcDirs += [file("$buildDir/generated/source/kapt/debug")]
    9. release.java.srcDirs += [file("$buildDir/generated/source/kapt/release")]
    10. test.java.srcDirs += [file("$buildDir/generated/source/kapt/test")]
    11. // For kotlin code gen during kapt
    12. main.java.srcDirs += [file("$buildDir/generated/source/kaptKotlin/main")]
    13. debug.java.srcDirs += [file("$buildDir/generated/source/kaptKotlin/debug")]
    14. release.java.srcDirs += [file("$buildDir/generated/source/kaptKotlin/release")]
    15. test.java.srcDirs += [file("$buildDir/generated/source/kaptKotlin/test")]
    16. }
  2. Change:

    1. ButterKnife.bind(target)

    to (add Ktx after ButterKnife):

    1. ButterKnifeKtx.bind(target)
  3. Enjoy Reflection-free ButterKnife

Including In Your Project

Add in your build.gradle:

  1. repositories {
  2. maven { url 'https://dl.bintray.com/blipinsk/maven/' }
  3. }
  4. dependencies {
  5. kapt "com.bartoszlipinski:butterknife-ktx-compiler:0.2.0"
  6. implementation "com.bartoszlipinski:butterknife-ktx:0.2.0"
  7. }

Developed by

  • Bartosz Lipiński

License

  1. Copyright 2018 Bartosz Lipiński
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.