Skip to content

Commit

Permalink
Merge pull request #20 from skydoves/cleanup/gradle
Browse files Browse the repository at this point in the history
Cleanup Gradle & dependencies
  • Loading branch information
skydoves authored Dec 29, 2021
2 parents c006f04 + 3c9ea79 commit 36e38ea
Show file tree
Hide file tree
Showing 36 changed files with 21 additions and 16 deletions.
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ android {

dependencies {
implementation "com.google.android.material:material:$versions.googleMaterial"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintVersion"
implementation "androidx.fragment:fragment-ktx:$versions.fragmentVersion"

implementation "com.github.bumptech.glide:glide:$versions.glideVersion"
Expand Down
1 change: 0 additions & 1 deletion bindables/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ dependencies {
implementation "androidx.appcompat:appcompat:$versions.androidxAppcompat"
api "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycleVersion"
api "androidx.lifecycle:lifecycle-viewmodel-savedstate:$versions.lifecycleVersion"
api "androidx.recyclerview:recyclerview:$versions.recyclerView"
}

apply plugin: "com.vanniktech.maven.publish"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public object BindingManager {
it.getter.hasAnnotation<Bindable>()
}
?: throw IllegalArgumentException("KProperty: ${property.name} must be annotated with the `@Bindable` annotation on the getter.")
val propertyName = bindingProperty.name.decapitalize(Locale.ENGLISH)
val propertyName = bindingProperty.name.replaceFirstChar { it.lowercase(Locale.ENGLISH) }
val bindingPropertyName = propertyName
.takeIf { it.startsWith(JAVA_BEANS_BOOLEAN) }
?.replaceFirst(JAVA_BEANS_BOOLEAN, String())
?.decapitalize(Locale.ENGLISH) ?: propertyName
?.replaceFirstChar { it.lowercase(Locale.ENGLISH) } ?: propertyName
return bindingFieldsMap[bindingPropertyName] ?: BR._all
}

Expand All @@ -91,13 +91,22 @@ public object BindingManager {
it.hasAnnotation<Bindable>()
}
?: throw IllegalArgumentException("KFunction: ${function.name} must be annotated with the `@Bindable` annotation.")
val functionName = bindingFunction.name.decapitalize(Locale.ENGLISH)
val functionName = bindingFunction.name.replaceFirstChar { it.lowercase(Locale.ENGLISH) }
val bindingFunctionName = when {
functionName.startsWith(JAVA_BEANS_GETTER) -> functionName.replaceFirst(JAVA_BEANS_GETTER, String())
functionName.startsWith(JAVA_BEANS_SETTER) -> functionName.replaceFirst(JAVA_BEANS_SETTER, String())
functionName.startsWith(JAVA_BEANS_BOOLEAN) -> functionName.replaceFirst(JAVA_BEANS_BOOLEAN, String())
functionName.startsWith(JAVA_BEANS_GETTER) -> functionName.replaceFirst(
JAVA_BEANS_GETTER,
String()
)
functionName.startsWith(JAVA_BEANS_SETTER) -> functionName.replaceFirst(
JAVA_BEANS_SETTER,
String()
)
functionName.startsWith(JAVA_BEANS_BOOLEAN) -> functionName.replaceFirst(
JAVA_BEANS_BOOLEAN,
String()
)
else -> throw IllegalArgumentException("@Bindable associated with method must follow JavaBeans convention $functionName")
}.decapitalize(Locale.ENGLISH)
}.replaceFirstChar { it.lowercase(Locale.ENGLISH) }
return bindingFieldsMap[bindingFunctionName] ?: BR._all
}
}
12 changes: 5 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@ ext.versions = [
versionName : '1.0.9',

gradleBuildTool : '7.0.2',
spotlessGradle : '5.15.0',
spotlessGradle : '6.1.0',
ktlintGradle : '0.41.0',
dokkaGradle : '1.4.32',
binaryValidator : '0.7.1',
mavenPublish : '0.15.1',

kotlin : '1.5.10',
androidxAppcompat: '1.4.0-alpha03',
kotlin : '1.5.32',
androidxAppcompat: '1.4.0',
googleMaterial : '1.4.0',
lifecycleVersion : '2.3.1',
recyclerView : '1.2.1',
lifecycleVersion : '2.4.0',

// for demo
constraintVersion: '2.0.4',
fragmentVersion : '1.2.5',
hiltCoreVersion : '2.38.1',
hiltCoreVersion : '2.40.5',
hiltVersion : '1.0.0',
glideVersion : '4.12.0',
whatIfVersion : '1.1.0',
Expand Down

0 comments on commit 36e38ea

Please sign in to comment.