|
| 1 | +# ViewBindingKTX |
| 2 | + |
| 3 | +[](https://www.jitpack.io/#DylanCaiCoding/ViewBindingKTX) |
| 4 | +[](https://github.com/DylanCaiCoding/ViewBindingKtx/blob/master/LICENSE) |
| 5 | +[](https://github.com/DylanCaiCoding/ViewBindingKTX) |
| 6 | + |
| 7 | +[ViewBinding](https://developer.android.com/topic/libraries/view-binding) reduces exceptions caused by id or type errors, which are recommended by both Google officials and Jake Wharton, but it can be a bit cumbersome to use, so this library can **help you use ViewBinding with as little code as possible in any usage scenario**. |
| 8 | + |
| 9 | +## Feature |
| 10 | + |
| 11 | +- Support for the usage of Kotlin and Java |
| 12 | +- Support for the usage of reflection and non-reflection |
| 13 | +- Support to modify your base class to support ViewBinding |
| 14 | +- Support for BaseRecyclerViewAdapterHelper |
| 15 | +- Support for Activity, Fragment, Dialog, Adapter |
| 16 | +- Support automatic release of binding class instance in Fragment |
| 17 | +- Support for custom combination view |
| 18 | +- Support for TabLayout to set custom view |
| 19 | +- Support for NavigationView to set header view |
| 20 | +- Support for DataBinding to automatically set the lifecycle owner |
| 21 | + |
| 22 | +## Gradle |
| 23 | + |
| 24 | +Add it in your root build.gradle at the end of repositories: |
| 25 | +```groovy |
| 26 | +allprojects { |
| 27 | + repositories { |
| 28 | + // ... |
| 29 | + maven { url 'https://www.jitpack.io' } |
| 30 | + } |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +Add dependencies and configurations: |
| 35 | + |
| 36 | +```groovy |
| 37 | +android { |
| 38 | + buildFeatures { |
| 39 | + viewBinding true |
| 40 | + } |
| 41 | +} |
| 42 | +
|
| 43 | +dependencies { |
| 44 | + // The following are optional, please add as needed |
| 45 | + implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-ktx:1.2.6' |
| 46 | + implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-nonreflection-ktx:1.2.6' |
| 47 | + implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-base:1.2.6' |
| 48 | + implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-brvah:1.2.6' |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +## Change log |
| 53 | + |
| 54 | +[Releases](https://github.com/DylanCaiCoding/ViewBindingKTX/releases) |
| 55 | + |
| 56 | +## Author's other libraries |
| 57 | + |
| 58 | +| Library | Description | |
| 59 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | |
| 60 | +| [Longan](https://github.com/DylanCaiCoding/Longan) | A collection of Kotlin utils which makes Android application development faster and easier. | |
| 61 | +| [LoadingStateView](https://github.com/DylanCaiCoding/LoadingStateView) | Decoupling the code of toolbar or loading status view. | |
| 62 | +| [MMKV-KTX](https://github.com/DylanCaiCoding/MMKV-KTX) | Use MMKV with property delegates. | |
| 63 | +| [ActivityResultLauncher](https://github.com/DylanCaiCoding/ActivityResultLauncher) | Replace startActivityForResult() method gracefully. | |
| 64 | + |
| 65 | +## License |
| 66 | + |
| 67 | +``` |
| 68 | +Copyright (C) 2020. Dylan Cai |
| 69 | +
|
| 70 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 71 | +you may not use this file except in compliance with the License. |
| 72 | +You may obtain a copy of the License at |
| 73 | +
|
| 74 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 75 | +
|
| 76 | +Unless required by applicable law or agreed to in writing, software |
| 77 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 78 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 79 | +See the License for the specific language governing permissions and |
| 80 | +limitations under the License. |
| 81 | +``` |
0 commit comments