Skip to content

Commit 7f8942b

Browse files
committed
fix: 修复一些编码错误
1 parent a3744c8 commit 7f8942b

File tree

3 files changed

+14
-20
lines changed
  • layer-core-ktx/src/main/java/per/goweii/layer/core/ktx
  • layer-notification-ktx/src/main/java/per/goweii/layer/notification/ktx
  • layer-overlay-ktx/src/main/java/per/goweii/layer/overlay/ktx

3 files changed

+14
-20
lines changed

layer-core-ktx/src/main/java/per/goweii/layer/core/ktx/Layer.kt

+6-12
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,29 @@ import per.goweii.layer.core.listener.DefaultOnVisibleChangedListener
1010

1111
fun <T : Layer> T.onClick(@IdRes viewId: Int, onClickListener: T.(view: View) -> Unit) =
1212
this.apply {
13-
this.addOnClickListener(Layer.OnClickListener { _, v -> this.onClickListener(v) }, viewId)
13+
this.addOnClickListener({ _, v -> this.onClickListener(v) }, viewId)
1414
}
1515

1616
fun <T : Layer> T.onClickToDismiss(
1717
@IdRes viewId: Int,
1818
onClickListener: (T.(view: View) -> Unit)? = null
1919
) = this.apply {
2020
onClickListener?.let {
21-
this.addOnClickToDismissListener(Layer.OnClickListener { _, v -> this.it(v) }, viewId)
21+
this.addOnClickToDismissListener({ _, v -> this.it(v) }, viewId)
2222
} ?: addOnClickToDismissListener(null, viewId)
2323
}
2424

2525
fun <T : Layer> T.onLongClick(@IdRes viewId: Int, onLongClickListener: T.(view: View) -> Boolean) =
2626
this.apply {
27-
this.addOnLongClickListener(
28-
Layer.OnLongClickListener { _, v -> this.onLongClickListener(v) },
29-
viewId
30-
)
27+
this.addOnLongClickListener({ _, v -> this.onLongClickListener(v) }, viewId)
3128
}
3229

3330
fun <T : Layer> T.onLongClickToDismiss(
3431
@IdRes viewId: Int,
3532
onLongClickListener: (T.(view: View) -> Boolean)? = null
3633
) = this.apply {
3734
onLongClickListener?.let {
38-
this.addOnLongClickToDismissListener(
39-
Layer.OnLongClickListener { _, v -> this.it(v) },
40-
viewId
41-
)
35+
this.addOnLongClickToDismissListener({ _, v -> this.it(v) }, viewId)
4236
} ?: addOnLongClickToDismissListener(null, viewId)
4337
}
4438

@@ -118,9 +112,9 @@ fun <T : Layer> T.animator(creator: Layer.AnimatorCreator) = this.apply {
118112
}
119113

120114
fun <T : Layer> T.interceptKeyEvent(enable: Boolean) = this.apply {
121-
this.setInterceptKeyEvent(enable)
115+
this.isInterceptKeyEvent = enable
122116
}
123117

124118
fun <T : Layer> T.cancelableOnClickKeyBack(enable: Boolean) = this.apply {
125-
this.setCancelableOnKeyBack(enable)
119+
this.isCancelableOnKeyBack = enable
126120
}

layer-notification-ktx/src/main/java/per/goweii/layer/notification/ktx/NotificationLayer.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ fun <T : NotificationLayer> T.duration(duration: Long) = this.apply {
2727
this.setDuration(duration)
2828
}
2929

30-
fun <T : NotificationLayer> T.onNotificationClick(onNotificationClick: T.(view: View) -> Unit) =
30+
fun <T : NotificationLayer> T.onNotificationClick(onClick: T.(view: View) -> Unit) =
3131
this.apply {
32-
this.setOnNotificationClickListener { _, view -> this.onNotificationClick(view) }
32+
this.setOnNotificationClickListener { _, view -> this.onClick(view) }
3333
}
3434

35-
fun <T : NotificationLayer> T.onNotificationLongClick(onNotificationClick: T.(view: View) -> Boolean) =
35+
fun <T : NotificationLayer> T.onNotificationLongClick(onLongClick: T.(view: View) -> Boolean) =
3636
this.apply {
37-
this.setOnNotificationLongClickListener { _, view -> this.onNotificationClick(view) }
37+
this.setOnNotificationLongClickListener { _, view -> this.onLongClick(view) }
3838
}
3939

4040
fun <T : NotificationLayer> T.autoDismiss(autoDismiss: Boolean) = this.apply {

layer-overlay-ktx/src/main/java/per/goweii/layer/overlay/ktx/OverlayLayer.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ fun <T : OverlayLayer> T.paddingBottom(padding: Int) = this.apply {
103103
this.setPaddingBottom(padding)
104104
}
105105

106-
fun <T : OverlayLayer> T.doOnFloatClick(onFloatClick: T.(view: View) -> Unit) = this.apply {
107-
this.addOnOverlayClickListener { _, view -> this.onFloatClick(view) }
106+
fun <T : OverlayLayer> T.onOverlayClick(onClick: T.(view: View) -> Unit) = this.apply {
107+
this.addOnOverlayClickListener { _, view -> this.onClick(view) }
108108
}
109109

110-
fun <T : OverlayLayer> T.onFloatLongClick(onFloatClick: T.(view: View) -> Boolean) = this.apply {
111-
this.setOnOverlayLongClickListener { _, view -> this.onFloatClick(view) }
110+
fun <T : OverlayLayer> T.onOverlayLongClick(onLongClick: T.(view: View) -> Boolean) = this.apply {
111+
this.setOnOverlayLongClickListener { _, view -> this.onLongClick(view) }
112112
}

0 commit comments

Comments
 (0)