diff --git a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt index 817432abbf..c989b87f06 100644 --- a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt +++ b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt @@ -178,7 +178,11 @@ class DesignerWorkspaceFragment : BaseFragment() { internal fun showViewInfo(view: IView) { viewModel.view = view - viewInfo.show(childFragmentManager, ViewInfoSheet.TAG) + + val existing = childFragmentManager.findFragmentByTag(ViewInfoSheet.TAG) + if (existing == null) { + viewInfo.show(childFragmentManager, ViewInfoSheet.TAG) + } } private fun setupViewGroup(viewGroup: UiViewGroup) { diff --git a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/views/LayoutHierarchyView.kt b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/views/LayoutHierarchyView.kt index 6ee1c51a9e..612fa64265 100644 --- a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/views/LayoutHierarchyView.kt +++ b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/views/LayoutHierarchyView.kt @@ -50,8 +50,8 @@ constructor( defStyleRes: Int = 0 ) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) { - private val textToIView = mutableMapOf() - private var onClick: ((com.itsaky.androidide.inflater.IView) -> Unit)? = null + private val textToIView = mutableMapOf() + private var onClick: ((IView) -> Unit)? = null private val clickListener = OnClickListener { view -> onClick?.let { click -> textToIView[view]?.let(click) } @@ -70,7 +70,7 @@ constructor( paint.isAntiAlias = true } - fun setupWithView(view: com.itsaky.androidide.inflater.IView, onClick: ((com.itsaky.androidide.inflater.IView) -> Unit)? = null) { + fun setupWithView(view: IView, onClick: ((IView) -> Unit)? = null) { removeAllViews() textToIView.clear() @@ -78,7 +78,7 @@ constructor( addViews(view, 1) } - private fun addViews(view: com.itsaky.androidide.inflater.IView, depth: Int) { + private fun addViews(view: IView, depth: Int) { val text = HierarchyText(context, depth, dp16).apply { this.text = view.tag