diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130..fb7f4a8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index aac9829..6b49bdf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,7 +73,7 @@ dependencies { // Android dependencies implementation "androidx.fragment:fragment-ktx:$fragment_version" - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' // Lifecycle implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" diff --git a/boneslibrary/build.gradle b/boneslibrary/build.gradle index 6dcba96..c8b5739 100644 --- a/boneslibrary/build.gradle +++ b/boneslibrary/build.gradle @@ -33,9 +33,9 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } - - dataBinding { - enabled = true + + buildFeatures { + dataBinding true } testOptions { diff --git a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/extensions/ViewExtensions.kt b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/extensions/ViewExtensions.kt index dbfc130..b607814 100644 --- a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/extensions/ViewExtensions.kt +++ b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/extensions/ViewExtensions.kt @@ -96,7 +96,7 @@ internal fun View.hasValidBounds(): Boolean { } internal fun View.hasDrawableBounds(boneProps: BoneProperties): Boolean { - return (measuredWidth > 0 && measuredHeight > boneProps.minThickness) + return minimumWidth > 0 || (measuredWidth > 0 && measuredHeight > boneProps.minThickness) } internal fun View.getBackgroundColor(): MutableColor? { diff --git a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/Skeleton.kt b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/Skeleton.kt index 7052eb1..898f3f1 100644 --- a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/Skeleton.kt +++ b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/Skeleton.kt @@ -167,7 +167,7 @@ internal class Skeleton( } if (foundInvalid) { - viewGroup.doOnLayout { + viewGroup.post { applyAndBuild(viewGroup, descendants) onCompute() } diff --git a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonBuilder.kt b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonBuilder.kt index 9ac960b..bd838ec 100644 --- a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonBuilder.kt +++ b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonBuilder.kt @@ -1,7 +1,9 @@ package com.eudycontreras.boneslibrary.framework.skeletons import android.view.View +import android.view.ViewGroup import com.eudycontreras.boneslibrary.bindings.SkeletonBindings +import com.eudycontreras.boneslibrary.extensions.descendantViews import com.eudycontreras.boneslibrary.extensions.generateId import com.eudycontreras.boneslibrary.framework.bones.BoneBuilder import com.eudycontreras.boneslibrary.framework.bones.BoneProperties @@ -299,7 +301,7 @@ class SkeletonBuilder( * generation */ fun withIgnoredBones(vararg ids: Int): SkeletonBuilder { - builderQueue.add { this.skeletonProperties.addIgnored(*ids) } + builderQueue.add { this.skeletonProperties.ignoredIds.addAll(ids.toList()) } return this } @@ -316,7 +318,14 @@ class SkeletonBuilder( * generation */ fun withIgnoredBones(vararg views: View): SkeletonBuilder { - builderQueue.add { this.skeletonProperties.addIgnored(*views.map { it.generateId() }.toIntArray()) } + builderQueue.add { + val viewIds = views.flatMap { + if (it is ViewGroup) { + it.descendantViews().map { child -> child.generateId() } + } else listOf(it.generateId()) + } + this.skeletonProperties.ignoredIds.addAll(viewIds) + } return this } diff --git a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonProperties.kt b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonProperties.kt index 63e1501..29730c2 100644 --- a/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonProperties.kt +++ b/boneslibrary/src/main/java/com/eudycontreras/boneslibrary/framework/skeletons/SkeletonProperties.kt @@ -31,7 +31,7 @@ class SkeletonProperties : Cloneable, Reusable { private var boneProperties: MutableMap = mutableMapOf() - private var ignoredIds: HashSet = HashSet() + internal var ignoredIds: HashSet = HashSet() private var disposedIds: HashSet = HashSet() diff --git a/build.gradle b/build.gradle index c1ac576..11608a5 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong