@@ -10,35 +10,29 @@ import per.goweii.layer.core.listener.DefaultOnVisibleChangedListener
10
10
11
11
fun <T : Layer > T.onClick (@IdRes viewId : Int , onClickListener : T .(view: View ) -> Unit ) =
12
12
this .apply {
13
- this .addOnClickListener(Layer . OnClickListener { _, v -> this .onClickListener(v) }, viewId)
13
+ this .addOnClickListener({ _, v -> this .onClickListener(v) }, viewId)
14
14
}
15
15
16
16
fun <T : Layer > T.onClickToDismiss (
17
17
@IdRes viewId : Int ,
18
18
onClickListener : (T .(view: View ) -> Unit )? = null
19
19
) = this .apply {
20
20
onClickListener?.let {
21
- this .addOnClickToDismissListener(Layer . OnClickListener { _, v -> this .it(v) }, viewId)
21
+ this .addOnClickToDismissListener({ _, v -> this .it(v) }, viewId)
22
22
} ? : addOnClickToDismissListener(null , viewId)
23
23
}
24
24
25
25
fun <T : Layer > T.onLongClick (@IdRes viewId : Int , onLongClickListener : T .(view: View ) -> Boolean ) =
26
26
this .apply {
27
- this .addOnLongClickListener(
28
- Layer .OnLongClickListener { _, v -> this .onLongClickListener(v) },
29
- viewId
30
- )
27
+ this .addOnLongClickListener({ _, v -> this .onLongClickListener(v) }, viewId)
31
28
}
32
29
33
30
fun <T : Layer > T.onLongClickToDismiss (
34
31
@IdRes viewId : Int ,
35
32
onLongClickListener : (T .(view: View ) -> Boolean )? = null
36
33
) = this .apply {
37
34
onLongClickListener?.let {
38
- this .addOnLongClickToDismissListener(
39
- Layer .OnLongClickListener { _, v -> this .it(v) },
40
- viewId
41
- )
35
+ this .addOnLongClickToDismissListener({ _, v -> this .it(v) }, viewId)
42
36
} ? : addOnLongClickToDismissListener(null , viewId)
43
37
}
44
38
@@ -118,9 +112,9 @@ fun <T : Layer> T.animator(creator: Layer.AnimatorCreator) = this.apply {
118
112
}
119
113
120
114
fun <T : Layer > T.interceptKeyEvent (enable : Boolean ) = this .apply {
121
- this .setInterceptKeyEvent( enable)
115
+ this .isInterceptKeyEvent = enable
122
116
}
123
117
124
118
fun <T : Layer > T.cancelableOnClickKeyBack (enable : Boolean ) = this .apply {
125
- this .setCancelableOnKeyBack( enable)
119
+ this .isCancelableOnKeyBack = enable
126
120
}
0 commit comments