mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
chore: fix merge conflict
This commit is contained in:
+11
-6
@@ -60,12 +60,12 @@ class WidgetDragListener(val view: IViewGroup, private val placeholderView: View
|
||||
true
|
||||
}
|
||||
DragEvent.ACTION_DROP -> {
|
||||
val index = view.indexOfChild(this.placeholder)
|
||||
this.placeholder.removeFromParent()
|
||||
|
||||
val child =
|
||||
when (val data = event.localState) {
|
||||
is IView -> data
|
||||
is IView -> {
|
||||
data.removeFromParent()
|
||||
data
|
||||
}
|
||||
is UiWidget ->
|
||||
data.createView(view.viewGroup.context, (view as ViewImpl).file).apply {
|
||||
this.view.layoutParams =
|
||||
@@ -75,10 +75,15 @@ class WidgetDragListener(val view: IViewGroup, private val placeholderView: View
|
||||
}
|
||||
else -> throw IllegalArgumentException("A local state of UiWidget or IView is expected")
|
||||
}
|
||||
child.removeFromParent()
|
||||
|
||||
val index = view.indexOfChild(this.placeholder)
|
||||
this.placeholder.removeFromParent()
|
||||
|
||||
this.view.addChild(index, child)
|
||||
this.view.onHighlightStateUpdated(false)
|
||||
|
||||
child.onHighlightStateUpdated(false)
|
||||
view.onHighlightStateUpdated(false)
|
||||
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
|
||||
@@ -53,9 +53,8 @@ interface IViewGroup : IView {
|
||||
* Remove the child at the given index.
|
||||
*
|
||||
* @param index The index of the child to remove.
|
||||
* @return The removed child.
|
||||
*/
|
||||
fun removeChild(index: Int): IView
|
||||
fun removeChild(index: Int)
|
||||
|
||||
/**
|
||||
* Get the child at the given index.
|
||||
|
||||
+8
-15
@@ -51,13 +51,14 @@ open class ViewGroupImpl(file: LayoutFile, name: String, view: ViewGroup) :
|
||||
}
|
||||
|
||||
override fun removeChild(view: IView) {
|
||||
removeInternal(view)
|
||||
this.view.removeView(view.view)
|
||||
this.children.remove(view)
|
||||
view.parent = null
|
||||
notifyOnViewRemoved(view)
|
||||
}
|
||||
|
||||
override fun removeChild(index: Int): IView {
|
||||
val existing = this.children.removeAt(index)
|
||||
removeInternal(existing, false)
|
||||
return existing
|
||||
override fun removeChild(index: Int) {
|
||||
removeChild(this.children[index])
|
||||
}
|
||||
|
||||
override operator fun get(index: Int): IView {
|
||||
@@ -65,7 +66,8 @@ open class ViewGroupImpl(file: LayoutFile, name: String, view: ViewGroup) :
|
||||
}
|
||||
|
||||
override operator fun set(index: Int, view: IView): IView {
|
||||
val existing = removeChild(index)
|
||||
val existing = this.children[index]
|
||||
removeChild(existing)
|
||||
addChild(index, view)
|
||||
return existing
|
||||
}
|
||||
@@ -115,15 +117,6 @@ open class ViewGroupImpl(file: LayoutFile, name: String, view: ViewGroup) :
|
||||
it.onViewRemoved(this, child)
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeInternal(view: IView, removeFromList: Boolean = true) {
|
||||
if (removeFromList) {
|
||||
this.children.remove(view)
|
||||
}
|
||||
this.view.removeView(view.view)
|
||||
view.parent = null
|
||||
notifyOnViewRemoved(view)
|
||||
}
|
||||
|
||||
private fun getViewRect(view: IView): RectF {
|
||||
val v = view.view
|
||||
|
||||
Reference in New Issue
Block a user