-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
can you added
fun getWindowManagerLayoutParams(): WindowManager.LayoutParams
in IFxControl class
beacuse i wanna do foucs to window but i can do it without get Layout Params, like:
fun requestFocusFloatingView(fxControl: IFxControl, context: Context) {
try {
val managerView = fxControl.getManagerView()
val layoutParams = fxControl.getWindowManagerLayoutParams() // custom method
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
managerView?.post {
val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
wm.updateViewLayout(managerView, layoutParams)
}
} catch (e: Exception) {
Log.e("FloatingPro", "Error requesting focus: ${e.message}")
}
}
fun loseFocusFloatingView(fxControl: IFxControl, context: Context) {
try {
val managerView = fxControl.getManagerView()
val layoutParams = fxControl.getWindowManagerLayoutParams() // custom method
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
managerView?.post {
val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
wm.updateViewLayout(managerView, layoutParams)
}
} catch (e: Exception) {
Log.e("FloatingPro", "Error losing focus: ${e.message}")
}
}
Reactions are currently unavailable