Skip to content

Commit 3a5757c

Browse files
committed
Extract core artifact
1 parent 599eb89 commit 3a5757c

File tree

10 files changed

+61
-14
lines changed

10 files changed

+61
-14
lines changed

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildscript {
1616

1717
plugins {
1818
id 'maven-publish'
19+
id 'org.jetbrains.kotlin.jvm' version '1.6.20' apply false
1920
}
2021

2122
allprojects {

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ include ':sample'
22
include ':vbpd:vbpd-full'
33
include ':vbpd:vbpd-noreflection'
44
rootProject.name = "View Binding Delegate"
5+
include ':vbpd:vbpd-core'

vbpd/vbpd-core/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

vbpd/vbpd-core/build.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'kotlin-android'
4+
}
5+
6+
ext {
7+
groupId = 'com.github.kirich1409'
8+
artifactId = "viewbindingpropertydelegate-core"
9+
}
10+
11+
apply from: rootProject.file('publishing.gradle')
12+
13+
android {
14+
compileSdkVersion rootProject.ext.compileSdkVersion
15+
buildToolsVersion rootProject.ext.buildToolsVersion
16+
17+
defaultConfig {
18+
minSdkVersion rootProject.ext.minSdkVersion
19+
targetSdkVersion rootProject.ext.targetSdkVersion
20+
}
21+
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_8
24+
targetCompatibility JavaVersion.VERSION_1_8
25+
}
26+
27+
// For Kotlin projects
28+
kotlinOptions {
29+
jvmTarget = "1.8"
30+
kotlinOptions.freeCompilerArgs +=
31+
['-module-name', "com.github.kirich1409.ViewBindingPropertyDelegate.core"]
32+
}
33+
}
34+
35+
dependencies {
36+
compileOnly rootProject.ext.dependencies.viewBinding
37+
implementation rootProject.ext.dependencies.lifecycleCommonJava8
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="by.kirich1409.viewbindingdelegate.core" />

vbpd/vbpd-noreflection/src/main/java/by/kirich1409/viewbindingdelegate/ViewBindingProperty.kt vbpd/vbpd-core/src/main/kotlin/by/kirich1409/viewbindingdelegate/ViewBindingProperty.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import androidx.lifecycle.DefaultLifecycleObserver
1313
import androidx.lifecycle.Lifecycle
1414
import androidx.lifecycle.LifecycleOwner
1515
import androidx.viewbinding.ViewBinding
16-
import by.kirich1409.viewbindingdelegate.internal.checkMainThread
16+
import by.kirich1409.viewbindingdelegate.internal.core.checkMainThread
1717
import kotlin.properties.ReadOnlyProperty
1818
import kotlin.reflect.KProperty
1919

@@ -133,7 +133,8 @@ public abstract class LifecycleViewBindingProperty<in R : Any, out T : ViewBindi
133133
}
134134
}
135135

136-
internal fun postClear() {
136+
@RestrictTo(LIBRARY_GROUP)
137+
protected fun postClear() {
137138
if (!mainHandler.post { clear() }) {
138139
clear()
139140
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package by.kirich1409.viewbindingdelegate.internal.core
2+
3+
import android.os.Looper
4+
5+
internal fun checkMainThread() {
6+
check(Looper.getMainLooper() === Looper.myLooper()) {
7+
"The method must be called on the main thread"
8+
}
9+
}
10+
11+
internal fun checkMainThread(reason: String) {
12+
check(Looper.getMainLooper() === Looper.myLooper()) {
13+
"The method must be called on the main thread. Reason: $reason."
14+
}
15+
}

vbpd/vbpd-noreflection/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ dependencies {
3838
compileOnly rootProject.ext.dependencies.viewBinding
3939
implementation rootProject.ext.dependencies.lifecycleCommonJava8
4040
implementation rootProject.ext.dependencies.recyclerview
41+
api project(':vbpd:vbpd-core')
4142
}

vbpd/vbpd-noreflection/src/main/java/by/kirich1409/viewbindingdelegate/internal/Utils.kt

-12
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,4 @@ internal val EMPTY_VB_CALLBACK: (ViewBinding) -> Unit = { _ -> }
5656
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
5757
fun <T : ViewBinding> emptyVbCallback():(T) -> Unit {
5858
return EMPTY_VB_CALLBACK
59-
}
60-
61-
internal fun checkMainThread() {
62-
check(Looper.getMainLooper() === Looper.myLooper()) {
63-
"The method must be called on the main thread"
64-
}
65-
}
66-
67-
internal fun checkMainThread(reason: String) {
68-
check(Looper.getMainLooper() === Looper.myLooper()) {
69-
"The method must be called on the main thread. Reason: $reason."
70-
}
7159
}

0 commit comments

Comments
 (0)