@@ -4,18 +4,52 @@ import com.codename1.components.Accordion
44import com.codename1.components.MultiButton
55import com.codename1.components.Switch
66import com.codename1.ui.Button
7+ import com.codename1.ui.CheckBox
8+ import com.codename1.ui.Container
9+ import com.codename1.ui.Label
10+ import com.codename1.ui.Slider
11+ import com.codename1.ui.TextArea
12+ import com.codename1.ui.TextField
713import com.codename1.ui.layouts.BoxLayout
814
915class KotlinUiTest : BaseTest () {
1016 override fun runTest (): Boolean {
11- var kotlinForm = createForm(" Kotlin" , BoxLayout .y(), " kotlin" )
12- kotlinForm.add(Button (" Kotlin Button" ))
13- var on = Switch ()
14- on.setOn()
15- kotlinForm.add(BoxLayout .encloseX(Switch (), on))
16- var acc = Accordion ()
17- acc.add(MultiButton (" MultiButton Line 1" ))
18- kotlinForm.add(acc);
17+ val kotlinForm = createForm(" Kotlin" , BoxLayout .y(), " kotlin" )
18+ kotlinForm.addAll(
19+ Label (" Kotlin UI Test Components" ),
20+ Button (" Kotlin Button" ),
21+ BoxLayout .encloseX(Switch (), Switch ().apply { setOn() }),
22+ TextField (" " , " Enter name" ),
23+ Slider ().apply {
24+ isEditable = true
25+ progress = 50
26+ }
27+ )
28+
29+ val accordion = Accordion ()
30+ accordion.addContent(" Details" , BoxLayout .encloseY(
31+ MultiButton (" MultiButton Line 1" ).apply {
32+ setTextLine2(" Additional detail line" )
33+ },
34+ MultiButton (" MultiButton Line 2" ).apply {
35+ setTextLine2(" More detail for Kotlin UI" )
36+ }
37+ ))
38+
39+ val preferences = Container (BoxLayout .y())
40+ preferences.addAll(
41+ CheckBox (" Enable notifications" ),
42+ Switch ().apply { setOn() },
43+ TextArea (3 , 20 ).apply { hint = " Add a short note" }
44+ )
45+ accordion.addContent(" Preferences" , preferences)
46+
47+ accordion.addContent(" Summary" , BoxLayout .encloseY(
48+ Label (" Accordion showcases grouped UI" ),
49+ Button (" Confirm Settings" )
50+ ))
51+
52+ kotlinForm.add(accordion)
1953 kotlinForm.show()
2054 return true
2155 }
0 commit comments