Package-level declarations

Types

Link copied to clipboard
data class BatteryStatusModel(val isCharging: Boolean, val isUsbCharging: Boolean, val wirelessCharge: Boolean, val isACCharging: Boolean, val batteryCapacity: Float, val batteryScale: Float)
Link copied to clipboard

Class for an InMemory Cache to keep your variables globally in heap and get them wherever you want.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

get CurrentTimeInMillis from System.currentTimeMillis

Link copied to clipboard
val <T> T.exhaustive: T
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Check if is Main Thread.

Link copied to clipboard
Link copied to clipboard
val <T> T.isNull: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val <T : Any> T.TAG: String

Functions

Link copied to clipboard
inline fun aboveApi(api: Int, included: Boolean = false, block: () -> Unit)

Method to check is aboveApi.

Link copied to clipboard
fun <T> allIsEqual(vararg values: T): Boolean

Checking that all elements is equals

Link copied to clipboard
fun <T, R> allIsNotNull(vararg values: T, out: () -> R?): R?

Executing out callback if all vararg values is not null

Link copied to clipboard
Link copied to clipboard
inline fun <T> T.alsoIf(condition: Boolean, block: (T) -> T): T
Link copied to clipboard
inline fun <T> T.alsoIfFalse(boolean: Boolean, block: (T) -> Unit): T
Link copied to clipboard
inline fun <T> T.alsoIfTrue(boolean: Boolean, block: (T) -> Unit): T
Link copied to clipboard
inline fun <T> T.applyIf(condition: Boolean, block: T.() -> T): T
Link copied to clipboard
fun <T> T.asNullable(): T?
Link copied to clipboard
inline fun belowApi(api: Int, included: Boolean = false, block: () -> Unit)

Method to check is belowApi.

Link copied to clipboard
inline fun benchmarkAction(actionName: String, action: () -> Unit)

Simple way to calculate approximated function execution time

Link copied to clipboard
inline fun <T> Any?.cast(): T?
Link copied to clipboard
Link copied to clipboard

Creates a ContentValues by reading pairs - similarly to how mapOf and similar methods work.

Link copied to clipboard
Link copied to clipboard
inline fun <T> Boolean.either(t: T): Pair<Boolean, T>
Link copied to clipboard
inline fun <T> Any.force(): T
Link copied to clipboard

Return the android id of device.

Link copied to clipboard

Use batteryStatusIntent for the param

Link copied to clipboard
fun getBatteryLevel(batteryIntent: Intent): Float

Use batteryStatusIntent for the param

Link copied to clipboard
fun getBuildConfigValue(packageName: String?, fieldName: String): Any?

Gets a field from the project's BuildConfig. This is useful when, for example, flavors are used at the project level to set custom fields.

Link copied to clipboard

Return the model of device.

Link copied to clipboard
fun <T> getFromMemory(key: String): T?

get Saved Data from memory, null if it os not exists

Link copied to clipboard
@RequiresPermission(allOf = ["android.permission.ACCESS_WIFI_STATE", "android.permission.INTERNET"])
fun getMacAddress(context: Context): String
@RequiresPermission(allOf = ["android.permission.ACCESS_WIFI_STATE", "android.permission.INTERNET"])
fun getMacAddress(context: Context, vararg excepts: String): String

Return the MAC address.

Link copied to clipboard

Return the manufacturer of the product/hardware.

Link copied to clipboard
inline fun <K : Any, V : Any> LruCache<K, V>.getOrPut(key: K, defaultValue: () -> V): V

Gets value with specific key from the cache. If the value is not present, calls defaultValue to obtain a non-null value which is placed into the cache, then returned.

Link copied to clipboard
inline fun <K : Any, V> LruCache<K, V>.getOrPutNotNull(key: K, defaultValue: () -> V?): V?

Gets value with specific key from the cache. If the value is not present, calls defaultValue to obtain a value which is placed into the cache if not null, then returned.

Link copied to clipboard

Return an ordered list of ABIs supported by this device. The most preferred ABI is the first element in the list.

Link copied to clipboard

Gets current wallpaper

Link copied to clipboard
inline fun Boolean.ifFalse(function: () -> Unit): Boolean
inline fun Boolean.ifFalse(trueFunction: () -> Unit = {}, falseFunction: () -> Unit): Boolean
Link copied to clipboard
inline fun <T> T?.ifNotNull(toBoolean: T.() -> Boolean): Boolean
Link copied to clipboard
fun Any?.ifNull(block: () -> Unit)
Link copied to clipboard
inline fun Boolean.ifTrue(function: () -> Unit): Boolean
inline fun Boolean.ifTrue(falseFunction: () -> Unit = {}, trueFunction: () -> Unit): Boolean
Link copied to clipboard
inline fun infiniteLoop(action: () -> Unit)
Link copied to clipboard
fun isKeyboardSubmit(actionId: Int, event: KeyEvent?): Boolean
Link copied to clipboard

Returns true if the current layout direction is View.LAYOUT_DIRECTION_RTL.

Link copied to clipboard
inline fun <K, V> LruCache<K, V>.keys(): Array<K>

Returns an array containing the keys in the cache.

Link copied to clipboard
inline fun killProcess(cleanUps: () -> Unit = {})
Link copied to clipboard
fun <T> lazyFast(operation: () -> T): Lazy<T>

Implementation of lazy that is not thread safe. Useful when you know what thread you will be executing on and are not worried about synchronization.

Link copied to clipboard
inline fun <T, R> T.letIf(condition: Boolean, block: (T) -> R): R?
Link copied to clipboard
inline fun needPermissionsFor(action: () -> Unit): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : Any> T?.or(item: T?): T?
fun <T : CharSequence> T?.or(item: T?): T?
fun <T : Number> T?.or(number: T?): T?
infix inline fun <T> Pair<Boolean, T>.or(t: T): T
fun <T> List<T>?.or(list: List<T>?): List<T>?
fun <K, V> Map<K, V>?.or(map: Map<K, V>?): Map<K, V>?
Link copied to clipboard
fun <T : Any> T?.orElse(item: T): T
fun <T : CharSequence> T?.orElse(item: T): T
fun <T : Number> T?.orElse(number: T): T
fun <T> List<T>?.orElse(list: List<T>): List<T>
fun <K, V> Map<K, V>?.orElse(map: Map<K, V>): Map<K, V>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

put Something In Memory to use it later

Link copied to clipboard
fun Context.resolveColor(@AttrRes attr: Int, @ColorInt fallback: Int = 0): Int
Link copied to clipboard
fun runDelayed(delay: Long, timeUnit: TimeUnit = TimeUnit.MILLISECONDS, action: () -> Unit)

Extension method to run block of code after specific Delay.

Link copied to clipboard
fun runDelayedOnUiThread(delay: Long, timeUnit: TimeUnit = TimeUnit.MILLISECONDS, action: () -> Unit)

Extension method to run block of code on UI Thread after specific Delay.

Link copied to clipboard
inline fun <T, R> T.runIf(condition: Boolean, block: T.() -> R): R?
Link copied to clipboard
fun runOnUiThread(action: () -> Unit)
Link copied to clipboard
operator fun ContentValues.set(key: String, value: Boolean?)
operator fun ContentValues.set(key: String, value: Byte?)
operator fun ContentValues.set(key: String, value: ByteArray?)
operator fun ContentValues.set(key: String, value: Double?)
operator fun ContentValues.set(key: String, value: Float?)
operator fun ContentValues.set(key: String, value: Int?)
operator fun ContentValues.set(key: String, value: Long?)
operator fun ContentValues.set(key: String, value: Short?)
operator fun ContentValues.set(key: String, value: String?)

Shorthand for ContentValues.set.

Link copied to clipboard
fun <T : Any> T.TAG(): String?

Extension method to get the TAG name for all object

Link copied to clipboard
inline fun <T> tag(): String
Link copied to clipboard

Toggle the Boolean Value, if it's true then it will become false ....

Link copied to clipboard

Converts Boolean to Int, if true then 1 else 0

Link copied to clipboard
Link copied to clipboard
inline fun <T> tryOrElse(defaultValue: T, block: () -> T): T
inline fun tryOrElse(defaultBlock: () -> Unit = {}, block: () -> Unit)
Link copied to clipboard
inline fun tryOrIgnore(runnable: () -> Unit)

try the code in runnable, If it runs then its perfect if its not, It won't crash your app.

Link copied to clipboard
inline fun <T> tryOrNull(block: () -> T): T?
Link copied to clipboard
inline fun <T> tryOrNullPrint(block: () -> T): T?
Link copied to clipboard
inline fun tryOrPrint(block: () -> Unit)
Link copied to clipboard
inline fun trySilently(block: () -> Unit)
Link copied to clipboard
fun <T> TypedArray.use(block: (TypedArray) -> T): T

Invokes block, passing it the receiver and returning the value it returns. Recycles the receiver after block completes.

Link copied to clipboard
inline fun <T> Boolean.whether(yes: () -> T, no: () -> T): T
Link copied to clipboard
inline fun <T, R> withIf(receiver: T, condition: Boolean, block: T.() -> R): R?
Link copied to clipboard
fun Int.withOpacity(@IntRange(from = 0, to = 100) opacity: Int): Int

Assume that this Int is a color and apply opacity to it.