Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit ece8257

Browse files
committed
fix(uidesigner): dismiss view info sheet before it is shown (fixes #1169)
1 parent 800600e commit ece8257

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ class DesignerWorkspaceFragment : BaseFragment() {
178178

179179
internal fun showViewInfo(view: IView) {
180180
viewModel.view = view
181-
viewInfo.show(childFragmentManager, ViewInfoSheet.TAG)
181+
182+
val existing = childFragmentManager.findFragmentByTag(ViewInfoSheet.TAG)
183+
if (existing == null) {
184+
viewInfo.show(childFragmentManager, ViewInfoSheet.TAG)
185+
}
182186
}
183187

184188
private fun setupViewGroup(viewGroup: UiViewGroup) {

uidesigner/src/main/java/com/itsaky/androidide/uidesigner/views/LayoutHierarchyView.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ constructor(
5050
defStyleRes: Int = 0
5151
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) {
5252

53-
private val textToIView = mutableMapOf<HierarchyText, com.itsaky.androidide.inflater.IView>()
54-
private var onClick: ((com.itsaky.androidide.inflater.IView) -> Unit)? = null
53+
private val textToIView = mutableMapOf<HierarchyText, IView>()
54+
private var onClick: ((IView) -> Unit)? = null
5555

5656
private val clickListener = OnClickListener { view ->
5757
onClick?.let { click -> textToIView[view]?.let(click) }
@@ -70,15 +70,15 @@ constructor(
7070
paint.isAntiAlias = true
7171
}
7272

73-
fun setupWithView(view: com.itsaky.androidide.inflater.IView, onClick: ((com.itsaky.androidide.inflater.IView) -> Unit)? = null) {
73+
fun setupWithView(view: IView, onClick: ((IView) -> Unit)? = null) {
7474
removeAllViews()
7575
textToIView.clear()
7676

7777
this.onClick = onClick
7878
addViews(view, 1)
7979
}
8080

81-
private fun addViews(view: com.itsaky.androidide.inflater.IView, depth: Int) {
81+
private fun addViews(view: IView, depth: Int) {
8282
val text =
8383
HierarchyText(context, depth, dp16).apply {
8484
this.text = view.tag

0 commit comments

Comments
 (0)