Package com. devbase. utils. ext

Defines global extension function

Types

Link copied to clipboard
class ImageViewLoadConfiguration(    var source: Any? = null,     var scaleType: ImageView.ScaleType = CENTER_CROP,     var progressBar: ProgressBar? = null,     var onImageLoaded: () -> Unit? = null,     var onImageNotLoaded: () -> Unit? = null)
Link copied to clipboard
typealias loadConfiguration = ImageViewLoadConfiguration.() -> Unit

Functions

Link copied to clipboard
fun View.disable()

Method to disable view

Link copied to clipboard
fun View.enable()

Method to enable view

Link copied to clipboard
fun View.gone()

Method to remove view

Link copied to clipboard
fun View.invisible()

Method to hide view

Link copied to clipboard
fun Any?.isNotNull(): Boolean

Method to check if Any has a value

Link copied to clipboard
fun Any?.isNull(): Boolean

Method to check if Any's value is null

Link copied to clipboard
fun isValidContext(context: Context): Boolean

Method to check if context is valid or not

Link copied to clipboard
fun ImageView.loadImage(configuration: loadConfiguration)

fun ImageView.loadImage(    imageDrawable: Drawable? = null,     imageUrl: String? = null,     imageRes: Int? = null,     placeHolderDrawable: Drawable? = null,     placeHolderResourceId: Int? = null,     progressBar: ProgressBar? = null,     errorResourceId: Int? = null,     errorDrawable: Drawable? = null,     onImageLoaded: () -> Unit? = null,     onImageNotLoaded: () -> Unit? = null,     scaleType: ImageView.ScaleType = CENTER_CROP)

Method to load image to ImageView, please read carefully what param you can use

Link copied to clipboard
fun EditText.onTextChanged(doWhenChange: (text: String) -> Unit)

Method to define action when text changed on EditText

Link copied to clipboard
fun String.toCurrency(locale: Locale = Locale.getDefault()): String

method to convert string to currency

Link copied to clipboard
fun Long.toDate(toFormat: String, locale: Locale = Locale.getDefault()): String?

Extension method from Long to format date to String

fun String.toDate(fromFormat: String, locale: Locale = Locale.getDefault()): Date?

Extension method from String to parse to Date

Link copied to clipboard
fun Date.toString(toFormat: String, locale: Locale = Locale.getDefault()): String?

Extension method from date to format Date to String

Link copied to clipboard
fun View.visible()

Method to display View

Properties

Link copied to clipboard
val Context.isDebuggable: Boolean

To check does the current application is debuggable

Link copied to clipboard
val Int.toDp: Int

Method to convert int to Dp

Link copied to clipboard
val Int.toPx: Int

Method to convert int to Px