From e55515eae5625c3a7babfc113c257f20ffce6218 Mon Sep 17 00:00:00 2001 From: skydoves Date: Fri, 19 Feb 2021 23:09:46 +0900 Subject: [PATCH] Update function documentations of the BindingManager and BindingInitProvider --- .../java/com/skydoves/bindables/BindingInitProvider.kt | 10 +++++++--- .../main/java/com/skydoves/bindables/BindingManager.kt | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bindables/src/main/java/com/skydoves/bindables/BindingInitProvider.kt b/bindables/src/main/java/com/skydoves/bindables/BindingInitProvider.kt index 6dc917c..4a0446b 100644 --- a/bindables/src/main/java/com/skydoves/bindables/BindingInitProvider.kt +++ b/bindables/src/main/java/com/skydoves/bindables/BindingInitProvider.kt @@ -23,14 +23,17 @@ import android.net.Uri import android.util.Log /** - * A binding initialization provider for binding Bindable properties when an application is started. + * @author skydoves (Jaewoong Eum) + * + * A binding initialization provider for binding `@Bindable` properties when an application is started. + * This initialization provider will be registered on the application as a content provider. */ class BindingInitProvider : ContentProvider() { override fun onCreate(): Boolean { val fieldSize = BindingManager.bind(BR::class) - if (fieldSize <= 1) { - Log.i(TAG, "BindingManager initialization successful, but empty bindable fields.") + if (fieldSize <= MIN_FIELD_SIZE) { + Log.i(TAG, "BindingManager initialization successful, but empty `@Bindable` fields.") } else { Log.i(TAG, "BindingManager initialization successful.") } @@ -45,5 +48,6 @@ class BindingInitProvider : ContentProvider() { companion object { private const val TAG = "BindingInitProvider" + private const val MIN_FIELD_SIZE = 1 } } diff --git a/bindables/src/main/java/com/skydoves/bindables/BindingManager.kt b/bindables/src/main/java/com/skydoves/bindables/BindingManager.kt index fcc7277..d2e2c69 100644 --- a/bindables/src/main/java/com/skydoves/bindables/BindingManager.kt +++ b/bindables/src/main/java/com/skydoves/bindables/BindingManager.kt @@ -49,6 +49,7 @@ object BindingManager { * for finding the proper binding ID of properties. * * @param bindingClass The `BR` class that generated by the DataBinding processor. + * @return The size of the stored fields. * @throws IllegalArgumentException If we bind non `BR` class into the manager. */ fun bind(bindingClass: KClass<*>): Int { @@ -71,6 +72,7 @@ object BindingManager { * Disassembles and stores declared binding fields in the `BR` class. * * @param bindingClass The `BR` class that generated by the DataBinding processor. + * @return The size of the stored fields. */ private fun storeDeclaredBindingFieldsIntoMap(bindingClass: KClass<*>): Int { for (field in bindingClass.java.declaredFields) {