Last active
May 21, 2019 09:35
-
-
Save hwd6190128/8c97c271479b9c801f00ca4193fd6d27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
dialog?.window?.setFlags( | |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, | |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | |
) | |
activity?.run { | |
dialog?.window?.decorView?.systemUiVisibility = this.window.decorView.systemUiVisibility | |
} | |
dialog?.setOnShowListener { | |
try { | |
//Clear the not focusable flag from the window | |
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) | |
//Update the WindowManager with the new attributes (no nicer way I know of to do this).. | |
val wm = activity?.getSystemService(Context.WINDOW_SERVICE) as WindowManager | |
wm.updateViewLayout(dialog?.window?.decorView, dialog?.window?.attributes) | |
} catch (e: Exception) { | |
e.printStackTrace() | |
} | |
} | |
return super.onCreateView(inflater, container, savedInstanceState) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment