ContextExtensions

Context extensions

Functions

Link copied to clipboard

Check if can draw over apps

Link copied to clipboard

Check whether the fullscreen intent permission is granted or not

Link copied to clipboard

Checks whether the input uri represents a file that exists on the file system

Link copied to clipboard

Convert dp value in pixels

Link copied to clipboard

Get the activity related to the context

Link copied to clipboard
Link copied to clipboard

Calculates the screen aspect ratio

Link copied to clipboard

Calculates screen's size

Link copied to clipboard
fun Context.getThemeAttribute(@StyleRes theme: Int, @StyleableRes styleable: IntArray, @StyleableRes styleAttribute: Int): Int

Retrieve a theme attribute's style

Link copied to clipboard

Used to restart the app.

Link copied to clipboard
fun Context.goToPreviousOrMainActivity(currentActivityName: String, navBackComponent: NavBackComponent? = null)

Go back to launcher activity if this function's caller is the solely task for the app

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Context.isActivityRunning(activityClazz: Class<*>): Boolean

Check if an activity is running

Link copied to clipboard

Check if the device is in the dnd mode

Link copied to clipboard

Check if the current layout configuration is RTL

Link copied to clipboard

Check if the device is in silent mode

Link copied to clipboard

Convert px value in dp

Link copied to clipboard

Finds the fragment activity associated to the context if any.

Link copied to clipboard
fun Context.startAppOpsWatch(operation: String, callback: (String, String) -> Unit)

Starts watch permission change with app ops manager

Link copied to clipboard

Interrupts watching permission change with app ops manager

Link copied to clipboard
fun Context.tryToOpenFile(uri: Uri, onFailure: (doesFileExists: Boolean) -> Unit)

Open the file or call the input callback if an error occurs