Skip to content

Commit ad849f7

Browse files
author
fengpeng
committed
kotlinOptions remove
1 parent b6f3e7b commit ad849f7

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ android {
2727
sourceCompatibility JavaVersion.VERSION_1_8
2828
targetCompatibility JavaVersion.VERSION_1_8
2929
}
30-
kotlinOptions {
31-
jvmTarget = '1.8'
32-
}
3330
}
3431

3532
dependencies {
@@ -38,7 +35,7 @@ dependencies {
3835
implementation 'androidx.appcompat:appcompat:1.2.0'
3936
implementation 'com.google.android.material:material:1.2.1'
4037
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
41-
testImplementation 'junit:junit:4.+'
38+
testImplementation 'junit:junit:4.13.1'
4239
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
4340
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
4441
implementation project(":lib")

lib/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@ android {
2727
sourceCompatibility JavaVersion.VERSION_1_8
2828
targetCompatibility JavaVersion.VERSION_1_8
2929
}
30-
kotlinOptions {
31-
jvmTarget = '1.8'
32-
}
3330
}
3431

3532
dependencies {
3633
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3734
implementation 'androidx.core:core-ktx:1.3.2'
3835
implementation 'androidx.appcompat:appcompat:1.2.0'
3936
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
40-
testImplementation 'junit:junit:4.+'
37+
testImplementation 'junit:junit:4.13.1'
4138
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
4239
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
4340
}

lib/src/main/java/com/pizzk/overlay/OverlayLayout.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class OverlayLayout : ConstraintLayout {
6868
val vXY = IntArray(2)
6969
getLocationOnScreen(vXY)
7070
val vAnchorXY = IntArray(2)
71-
//
7271
overlay.anchors.forEach { e: Anchor ->
7372
val vAnchor: View = e.find.onFind(viewGroup, e) ?: return@forEach
7473
//计算宽度及位置
@@ -82,23 +81,24 @@ class OverlayLayout : ConstraintLayout {
8281
rect.inset(-outset, -outset)
8382
//锚点生产及绘制
8483
e.draw.onDraw(canvas, paint, e, rect)
85-
val anchor = onFakeAnchor(e.id, rect.toRect())
84+
val anchor = onFakeAnchor(e.id, rect)
8685
//标记层布局
8786
val markers = overlay.markers.filter { it.anchor == e.id }
8887
markers.forEach { onLayoutMarker(viewGroup.context, it, anchor) }
8988
}
9089
}
9190

92-
private fun onFakeAnchor(id: Int, rc: Rect): View {
91+
private fun onFakeAnchor(id: Int, rc: RectF): View {
9392
val v: View? = getViewById(id)
9493
if (null != v) return v
9594
val view = View(context)
9695
view.id = id
97-
addView(view, rc.width(), rc.height())
96+
addView(view, rc.width().toInt(), rc.height().toInt())
9897
val cs = ConstraintSet()
9998
cs.clone(this)
100-
cs.connect(id, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, rc.left)
101-
cs.connect(id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP, rc.top)
99+
val iid = ConstraintSet.PARENT_ID
100+
cs.connect(id, ConstraintSet.START, iid, ConstraintSet.START, rc.left.toInt())
101+
cs.connect(id, ConstraintSet.TOP, iid, ConstraintSet.TOP, rc.top.toInt())
102102
cs.applyTo(this)
103103
return view
104104
}

0 commit comments

Comments
 (0)