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
fun Activity.hasOverlayPermission(): Boolean = | |
if (Build.VERSION.SDK_INT >= 23) Settings.canDrawOverlays(this) else true | |
fun Activity.requestOverlayPermission(requestCode: Int) { | |
if (Build.VERSION.SDK_INT >= 23) { | |
val intent = Intent( | |
Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:$packageName")) | |
startActivityForResult(intent, requestCode) | |
} | |
} |
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 { |
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
// prefer one | |
private val immersiveRunnable = Runnable { | |
immersiveMode(this@BaseActivity) | |
} | |
companion object { | |
private const val INITIAL_HIDE_DELAY = 300L | |
} |
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
/** | |
* Used as a wrapper for data that is exposed via a LiveData that represents an event. | |
*/ | |
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. |
OlderNewer