Remove UI prefix
This commit is contained in:
parent
215949eabe
commit
12b6886da8
|
@ -8,23 +8,18 @@ import net.shadowfacts.shadowui.util.Color
|
|||
class UITest: UIScreen() {
|
||||
|
||||
init {
|
||||
val red = UIView().apply {
|
||||
val red = addView(UIView().apply {
|
||||
backgroundColor = Color(0xff0000)
|
||||
addView(this)
|
||||
}
|
||||
val green = UIView().apply {
|
||||
})
|
||||
val green = addView(UIView().apply {
|
||||
backgroundColor = Color(0x00ff00)
|
||||
addView(this)
|
||||
}
|
||||
val blue = UIView().apply {
|
||||
})
|
||||
val blue = addView(UIView().apply {
|
||||
backgroundColor = Color(0x0000ff)
|
||||
addView(this)
|
||||
}
|
||||
|
||||
val purple = UIView().apply {
|
||||
})
|
||||
val purple = green.addSubview(UIView().apply {
|
||||
backgroundColor = Color(0x800080)
|
||||
green.addSubview(this)
|
||||
}
|
||||
})
|
||||
|
||||
solver.dsl {
|
||||
red.leftAnchor equalTo 0
|
|
@ -10,10 +10,13 @@ open class UIScreen: Screen(TextComponent("UIScreen")) {
|
|||
|
||||
val views = mutableListOf<UIView>()
|
||||
|
||||
fun addView(view: UIView) {
|
||||
fun addView(view: UIView): UIView {
|
||||
views.add(view)
|
||||
view.solver = solver
|
||||
|
||||
view.wasAdded()
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
fun layout() {
|
|
@ -31,12 +31,14 @@ class UIView {
|
|||
var parent: UIView? = null
|
||||
val subviews = mutableListOf<UIView>()
|
||||
|
||||
fun addSubview(view: UIView) {
|
||||
fun addSubview(view: UIView): UIView {
|
||||
subviews.add(view)
|
||||
view.parent = this
|
||||
view.solver = solver
|
||||
|
||||
view.wasAdded()
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
fun wasAdded() {
|
Loading…
Reference in New Issue