Package-level declarations

Properties

Link copied to clipboard

Convert this receiver as DP to PX

Link copied to clipboard

Check if this receiver is small width screen

Link copied to clipboard

Check if this receiver is wide screen

Link copied to clipboard

Initializer function can be called several times on concurrent access to uninitialized Lazy instance value, but only the first returned value will be used as the value of Lazy instance.

Link copied to clipboard

Convert this receiver as PX to DP

Link copied to clipboard

Convert this receiver as SP to PX

Link copied to clipboard

Locks are used to ensure that only a single thread can initialize the Lazy instance.

Link copied to clipboard

No locks are used to synchronize an access to the Lazy instance value; if the instance is accessed from multiple threads, its behavior is undefined.

Functions

Link copied to clipboard
inline fun Menu.addItems(menu: Menu, group: Int = Menu.NONE, flagFor: (MenuItem) -> Int = { MenuItem.SHOW_AS_ACTION_IF_ROOM })

Add menu items to this menu

Link copied to clipboard
inline fun <T> Fragment.argument(key: String): Lazy<T?>
inline fun <T> Fragment.argument(crossinline default: () -> T, key: String): Lazy<T>

Lazy intent parameters for fragments

Link copied to clipboard

Adds an observer on the lifecycle owner. This must be registered earlier than the lifecycle events you intend on listening to, preferably FragmentActivity.onCreate

Link copied to clipboard
fun String?.capitalizeWords(exceptions: List<String>? = null): String

Returns a copy of this strings having its first letter uppercase, or the original string, if it's empty or already starts with an upper case letter.

fun Collection<String>.capitalizeWords(exceptions: List<String>? = null): List<String>

Capitalizes all the strings unless they are specified in the exceptions list

Link copied to clipboard
fun Context.copyToClipboard(label: String, content: String)

Sets the given content into clipboard.

Link copied to clipboard

Removes an observer on the lifecycle owner. This must be un-registered later than the lifecycle events you being listened to, preferably FragmentActivity.onDestroy

Link copied to clipboard

Disables toolbar title for an activity

Link copied to clipboard

Potentially useless but returns an empty string, the signature may change in future

Link copied to clipboard
inline fun <T> FragmentActivity.extra(key: String): Lazy<T?>
inline fun <T> FragmentActivity.extra(key: String, crossinline default: () -> T): Lazy<T>

Lazy intent parameters for fragment activities

fun <T> SavedStateHandle.extra(key: String, default: () -> T): Lazy<T>

Lazy intent parameters for saved state handle

Link copied to clipboard
fun Context.flowOfBroadcast(intentFilter: IntentFilter): Flow<Intent>

Creates a callback flow a BroadcastReceiver using the given IntentFilter

Link copied to clipboard
fun Context.getColorFromAttr(@AttrRes colorAttr: Int, defaultColor: Int = 0): Int

Creates a color from the given attribute, If the attribute references a color resource holding a complex android.content.res.ColorStateList, then the default color from the set is returned.

Link copied to clipboard

Starting in android Marshmallow, the returned color will be styled for the specified Context's theme.

Link copied to clipboard

Avoids resource not found when using vector drawables in API levels < Lollipop

fun Context.getCompatDrawable(@DrawableRes resource: Int, @ColorRes colorTint: Int): Drawable?

Avoids resource not found when using vector drawables in API levels < Lollipop Also images loaded from this method apply the Drawable.mutate to assure that the state of each drawable is not shared

Link copied to clipboard

Avoids resource not found when using vector drawables in API levels < Lollipop Also images loaded from this method apply the Drawable.mutate to assure that the state of each drawable is not shared

Link copied to clipboard

Avoids resource not found when using vector drawables in API levels < Lollipop and tints the drawable depending on the current selected theme, images loaded from this method apply the Drawable.mutate to assure that the state of each drawable is not shared

Link copied to clipboard

Avoids resource not found when using vector drawables in API levels < Lollipop and tints the drawable depending on the current selected theme, images loaded from this method apply the Drawable.mutate to assure that the state of each drawable is not shared.

Link copied to clipboard
fun Context.getDrawableAttr(@AttrRes drawableAttr: Int): Drawable?

Creates a drawable from the given attribute resource which cannot be nullable type

Link copied to clipboard

Retrieves a LayoutInflater from Context by querying system services

Retrieves a LayoutInflater from View.Context by querying system services

Link copied to clipboard

Gets the size of the display, in pixels. Value returned by this method does not necessarily represent the actual raw size (native resolution) of the display.

Link copied to clipboard

Creates a list of the array resource given

Link copied to clipboard
fun View.gone()

Sets the current views visibility to GONE

Link copied to clipboard

Hides both status bar and navigation bar

Link copied to clipboard
Link copied to clipboard

Sets the current views visibility to INVISIBLE

Link copied to clipboard
Link copied to clipboard

Exactly whether a device is low-RAM is ultimately up to the device configuration, but currently it generally means something in the class of a 512MB device with about a 800x480 or less screen. This is mostly intended to be used by apps to determine whether they should turn off certain features that require more RAM.

Link copied to clipboard

Makes status bar transparent

Link copied to clipboard
inline fun Drawable.mutate(action: Drawable.() -> Unit)

Drawable mutation helper

Link copied to clipboard
Link copied to clipboard
fun Menu.removeItems(menu: Menu, group: Int = Menu.NONE)

Remove menu items from this menu

Link copied to clipboard
fun <C> MutableList<C>.replaceWith(collection: Collection<C>)

Clears the current list and adds the new items into the collection replacing all items

Link copied to clipboard

Extension helper for context that helps us restart the application

Link copied to clipboard
fun Context.restartWithIntent(intent: Intent, intentId: Int = 1510, delayDuration: Int = 100)

Extension helper for context that helps us restart the application

Link copied to clipboard
inline fun <T> Context.scheduleWithAlarm(enabled: Boolean, interval: Long)

Schedule a repeating alarm that has inexact trigger time requirements.

Link copied to clipboard
fun Menu.setVisibilityForAllItems(shouldShow: Boolean, filter: (MenuItem) -> Boolean)

Change visibility of all items for this menu

Link copied to clipboard
fun Collection<*>?.sizeOf(): Int

Gives the size of the collection by doing a null check first

Link copied to clipboard
fun View.snackBar(@StringRes text: Int, duration: Int = Snackbar.LENGTH_SHORT): Snackbar
inline fun View.snackBar(@StringRes text: Int, @StringRes actionText: Int, duration: Int, crossinline action: (Snackbar) -> Unit): Snackbar

Creates a snack bar and returns it

Link copied to clipboard
inline fun <T> Context.startNewActivity(params: Bundle = Bundle.EMPTY, options: Bundle = Bundle.EMPTY)

Start a new activity from context and avoid potential crashes from early API levels

Link copied to clipboard
inline fun <T> Context.startServiceInBackground(intentAction: String): ComponentName?

Starts a background service using the specified type and action

Link copied to clipboard
inline fun <T> Context.startServiceInForeground(intentAction: String)

Starts a foreground service using the specified type and action

Link copied to clipboard

Starts a shared transition of activities connected by views

Link copied to clipboard
Link copied to clipboard
inline fun <T> Context.stopServiceMatching(intentAction: String): Boolean

Request that a given application service be stopped. If the service is not running, nothing happens.

Link copied to clipboard
inline fun <T> Context.systemServiceOf(): T?

Extension for getting system services from Context

Link copied to clipboard
fun Context.themeInterpolator(@AttrRes attributeResource: Int, @InterpolatorRes interpolator: Int): Interpolator
Link copied to clipboard
fun Context.themeStyle(@AttrRes attributeResource: Int): Int

Retrieve a style from the current android.content.res.Resources.Theme.

Link copied to clipboard

Request to show or hide the soft input window

Link copied to clipboard
fun View.updateMargins(margin: Int)
fun View.updateMargins(start: Int = 0, top: Int = 0, end: Int = 0, bottom: Int = 0)

Updates layout margins with the given values

Link copied to clipboard

Sets the current views visibility to VISIBLE