fix(xml-inflater): fix typo in IViewGroup.canAcceptChild()

This commit is contained in:
Akash Yadav
2022-12-20 14:28:30 +05:30
parent 369a0ad904
commit 42b3d463c7
5 changed files with 14 additions and 12 deletions
@@ -496,6 +496,8 @@
<string name="widget_linear_layout_horz" translatable="false">LinearLayout (H)</string>
<string name="widget_linear_layout_vert" translatable="false">LinearLayout (V)</string>
<string name="widget_relative_layout" translatable="false">RelativeLayout</string>
<string name="widget_scrollview" translatable="false">ScrollView</string>
<string name="widget_horizontal_scrollview" translatable="false">HorizontalScrollView</string>
<!-- GIT -->
<string name="git_clone">Clone</string>
Binary file not shown.
@@ -44,7 +44,7 @@ internal class WidgetDragListener(
private var lastY = 0f
override fun onDrag(v: View, event: DragEvent): Boolean {
return when (event.action) {
when (event.action) {
DragEvent.ACTION_DRAG_STARTED -> {
val name =
@@ -53,10 +53,10 @@ internal class WidgetDragListener(
is UiWidget -> data.name
else -> throw IllegalArgumentException("A local state of UiWidget or IView is expected")
}
event.clipDescription.hasMimeType(DRAGGING_WIDGET_MIME) &&
event.localState != this.view &&
this.view.canAcceptChild(name)
return event.clipDescription.hasMimeType(DRAGGING_WIDGET_MIME) &&
event.localState != view &&
view.canAcceptChild(name)
}
DragEvent.ACTION_DRAG_ENTERED,
DragEvent.ACTION_DRAG_LOCATION -> {
@@ -83,11 +83,11 @@ internal class WidgetDragListener(
lastX = event.x
lastY = event.y
true
return true
}
DragEvent.ACTION_DRAG_EXITED -> {
view.onHighlightStateUpdated(false)
true
return true
}
DragEvent.ACTION_DROP -> {
val child =
@@ -111,13 +111,13 @@ internal class WidgetDragListener(
child.includeInIndexComputation = true
}
true
return true
}
DragEvent.ACTION_DRAG_ENDED -> {
this.placeholder.removeFromParent()
true
return true
}
else -> false
else -> return false
}
}
}
@@ -74,7 +74,7 @@ abstract class IViewAdapter<T : View> : AbstractParser() {
* Called by the UI Designer to check if the given view group (which this adpater handles) can
* accept the child view with the given qualified name.
*/
fun canAcceptChild(view: IViewGroup, name: String): Boolean {
open fun canAcceptChild(view: IViewGroup, name: String): Boolean {
return true
}
@@ -54,7 +54,7 @@ interface IViewGroup : IView, Iterable<IView> {
*/
fun canAcceptChild(name: String): Boolean {
return canModifyChildViews() &&
ViewAdapterIndex.getAdapter(name)?.canAcceptChild(this, name) == true
ViewAdapterIndex.getAdapter(this.name)?.canAcceptChild(this, name) == true
}
/**