Util

object Util

Utility class

Functions

Link copied to clipboard
fun exportVideoForExplorers(context: Context, videoFile: File?, albumName: String?): Boolean

Makes the file visible to file explorers as video file.

Link copied to clipboard
fun getAppDirInternal(context: Context?): File?

Gets internal app directory

Link copied to clipboard

Gets internal app path

Link copied to clipboard

Gets external/sdcard app directory

Link copied to clipboard

Gets external/sdcard app path

Link copied to clipboard

Gets the application name

Link copied to clipboard
fun getColor(gemSdkColor: Int): Int
Link copied to clipboard

Returns main Display.

Link copied to clipboard

Executor based on main thread.

Link copied to clipboard
fun hasPermission(context: Context, permission: String): Boolean

Tests if the provided permission is already granted.

Link copied to clipboard
fun hasPermissions(context: Context, permissions: Array<String>, mustHaveAll: Boolean = true): Boolean

Tests if the provided permissions are already granted.

Link copied to clipboard
fun hexaToString(hexaText: String): String

Converts a hex string to dec string

Link copied to clipboard

Check if network is available.

Link copied to clipboard

Returns true if this app is running on emulator.

Link copied to clipboard

Calculates levenshtein distance between 2 strings.

Link copied to clipboard
fun moveByRenaming(file: File, dir: File): File?

Moves a file to specified directory, renaming method is used. See File.renameTo.

Link copied to clipboard
fun moveFilePhysically(file: File, dir: File): File?

Moves a file to specified directory, physically method is used. See FileChannel.transferTo.

Link copied to clipboard
fun moveToPublicMovies(context: Context, videoFile: File): String?

Moves a file to Environment.DIRECTORY_MOVIES directory. Makes the file visible to file explorers as video file. Uses moveByRenaming.

Link copied to clipboard
fun postOnMain(task: Runnable)
fun postOnMain(task: () -> Unit)

Post a task on main thread.

Link copied to clipboard
fun postOnMainDelayed(task: Runnable, delay: Long = 0)

Post a runnable object on main thread.

Link copied to clipboard
fun requestPermissions(requestCode: Int, activity: Activity, permissions: Array<String>): Boolean

Requests to user the provided permissions.

Link copied to clipboard
fun streamToFile(input: InputStream, dest: File)

Writes input stream bytes to file.

Link copied to clipboard

Converts a dec string to hex string