Util

class Util

A collection of assorted utility classes.

Functions

Link copied to clipboard
open fun assertBackgroundThread()
Throws an java.lang.IllegalArgumentException if called on the main thread.
Link copied to clipboard
open fun assertMainThread()
Throws an java.lang.IllegalArgumentException if called on a thread other than the main thread.
Link copied to clipboard
open fun bothModelsNullEquivalentOrEquals(a: Any, b: Any): Boolean
Link copied to clipboard
open fun bothNullOrEqual(a: Any, b: Any): Boolean
Null-safe equivalent of a.equals(b).
Link copied to clipboard
open fun <T> createQueue(size: Int): Queue<T>
Creates a java.util.Queue of the given size using Glide's preferred implementation.
Link copied to clipboard
open fun getBitmapByteSize(bitmap: Bitmap): Int
Returns the in memory size of the given Bitmap in bytes.
open fun getBitmapByteSize(    width: Int,     height: Int,     config: Config): Int
Returns the in memory size of android.graphics.
Link copied to clipboard
open fun getBytesPerPixel(config: Config): Int
Returns the number of bytes required to store each pixel of a Bitmap with the given config.
Link copied to clipboard
open fun getSize(bitmap: Bitmap): Int
Returns the allocated byte size of the given bitmap.
Link copied to clipboard
open fun <T> getSnapshot(other: Collection<T>): List<T>
Returns a copy of the given list that is safe to iterate over and perform actions that may modify the original list.
Link copied to clipboard
open fun hashCode(value: Boolean): Int
open fun hashCode(value: Float): Int
open fun hashCode(value: Int): Int
open fun hashCode(value: Boolean, accumulator: Int): Int
open fun hashCode(value: Float, accumulator: Int): Int
open fun hashCode(value: Int, accumulator: Int): Int
open fun hashCode(object: Any, accumulator: Int): Int
Link copied to clipboard
open fun isOnBackgroundThread(): Boolean
Returns true if called on a background thread, false otherwise.
Link copied to clipboard
open fun isOnMainThread(): Boolean
Returns true if called on the main thread, false otherwise.
Link copied to clipboard
open fun isValidDimension(dimen: Int): Boolean
Link copied to clipboard
open fun isValidDimensions(width: Int, height: Int): Boolean
Returns true if width and height are both > 0 and/or equal to SIZE_ORIGINAL.
Link copied to clipboard
open fun postOnUiThread(runnable: Runnable)
Posts the given runnable to the UI thread using a shared Handler.
Link copied to clipboard
open fun removeCallbacksOnUiThread(runnable: Runnable)
Removes the given runnable from the UI threads queue if it is still queued.
Link copied to clipboard
open fun sha256BytesToHex(bytes: Array<Byte>): String
Returns the hex string of the given byte array representing a SHA256 hash.