Skip to content

Commit 198b41f

Browse files
Sumit Kumarmeta-codesync[bot]
authored andcommitted
Fix overlay for Flipper
Reviewed By: oprisnik Differential Revision: D91132445 fbshipit-source-id: 239680d5e49abc9230e822caabc22b2abd7b6133
1 parent 08374b6 commit 198b41f

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

vito/tools/liveeditor/src/main/java/com/facebook/fresco/vito/tools/liveeditor/LiveEditorOnScreenButtonController.kt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,28 @@ class LiveEditorOnScreenButtonController(
158158

159159
private fun showImageInfo(context: Context) {
160160
val windowContext = getWindowContext(context)
161-
addWindow(
162-
windowContext,
161+
val infoView =
163162
LiveEditorUiUtils(imageSelector?.currentEditor, debugDataProviders)
164163
.createImageInfoView(windowContext) { showImageToggleButtons(windowContext) }
165-
.apply { background = ColorDrawable(editorBackgroundColor) },
166-
)
164+
.apply { background = ColorDrawable(editorBackgroundColor) }
165+
166+
// Wrap in OverlayHandlerView so Flipper UI Debugger excludes it from inspection
167+
addWindow(windowContext, OverlayHandlerView(windowContext).apply { addView(infoView) })
167168
}
168169

169170
private fun showLiveEditor(context: Context) {
170171
val windowContext = getWindowContext(context)
171-
addWindow(
172-
windowContext,
172+
val editorView =
173173
LiveEditorUiUtils(imageSelector?.currentEditor, debugDataProviders)
174174
.createView(windowContext, customOptions.entries) {
175175
showImageToggleButtons(windowContext)
176176
}
177-
.apply { background = ColorDrawable(editorBackgroundColor) },
177+
.apply { background = ColorDrawable(editorBackgroundColor) }
178+
179+
// Wrap in OverlayHandlerView so Flipper UI Debugger excludes it from inspection
180+
addWindow(
181+
windowContext,
182+
OverlayHandlerView(windowContext).apply { addView(editorView) },
178183
DisplayMetrics()
179184
.apply { getWindowManager(context).defaultDisplay.getMetrics(this) }
180185
.heightPixels / 2,
@@ -234,8 +239,15 @@ class LiveEditorOnScreenButtonController(
234239
currentView = view
235240
}
236241

242+
/**
243+
* Custom ViewGroup class to wrap the live editor overlay buttons. Uses the "OverlayHandlerView"
244+
* naming pattern that Flipper's UI Debugger already recognizes and excludes from inspection,
245+
* preventing this overlay from blocking the main UI view hierarchy during debugging.
246+
*/
247+
private class OverlayHandlerView(context: Context) : LinearLayout(context)
248+
237249
private fun createOnScreenButtons(context: Context): View {
238-
return LinearLayout(context).apply {
250+
return OverlayHandlerView(context).apply {
239251
orientation = LinearLayout.VERTICAL
240252
val cornerRadius = 16.dpToPxF(context)
241253
val buttonLayoutParams: LinearLayout.LayoutParams =

0 commit comments

Comments
 (0)