Skip to content

Commit 3eee77f

Browse files
committed
fix the issue
1 parent 72e6174 commit 3eee77f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

subs/compose/src/main/java/com/engineer/compose/ui/ComposeDemo.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ fun DemoCard() {
3232
var list by remember { mutableStateOf(ArrayList<String>()) }
3333
val list2 = remember { mutableStateListOf<String>() }
3434
val list3 = remember { mutableStateListOf("") }
35+
val count1 = { mutableIntStateOf(0) }
36+
val count2 = { mutableStateOf(0) }
3537
var list4 = remember { mutableStateOf(ArrayList<String>())}
3638

39+
40+
41+
3742
Log.i(TAG,"count -> ${count::class}")
3843
Log.i(TAG,"list -> ${list::class}")
3944
Log.i(TAG,"list2 -> ${list2::class}")

subs/compose/src/main/java/com/engineer/compose/uitls/DelegateExample.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ class Delegate {
66
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
77
return "$thisRef, thank you for delegating '${property.name}' to me!"
88
}
9+
910
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
1011
println("$value has been assigned to '${property.name}' in $thisRef.")
1112
}
1213
}
1314

15+
class People {
16+
var name by Delegate()
17+
}
18+
1419
fun main() {
15-
var p by Delegate()
16-
println(p)
17-
p = "hello"
18-
println(p)
20+
val people = People()
21+
println(people.name)
22+
people.name = "mike"
23+
println(people.name)
1924
}

0 commit comments

Comments
 (0)