Package com.maxkeppeler.sheets.core.utils

Types

Link copied to clipboard
enum Theme : Enum<Theme>
Link copied to clipboard
data class TimeInfo(    val days: Long = 0,     val hours: Long = 0,     val minutes: Long = 0,     val seconds: Long = 0)

Helper class to store time units.

Link copied to clipboard
class ValueAnimationListener(    lifecycle: Lifecycle,     valueStart: Float = ANIM_ALPHA_MIN,     valueEnd: Float = ANIM_ALPHA_MAX,     duration: Long = ANIM_DURATION_300,     interpolator: TimeInterpolator = AccelerateDecelerateInterpolator(),     updateListener: (Float) -> Unit,     endListener: () -> Unit) : LifecycleObserver

Lifecycle aware ValueAnimator wrapper.

Functions

Link copied to clipboard
fun booleanOfAttrs(ctx: Context, @AttrRes vararg attrs: Int): Boolean

Get an Integer value by theme attributes.

Link copied to clipboard
fun AppCompatImageView.clipTopCorners(cornerFamily: Int, cornerRadius: Float)

Clip the top corners of a ImageView. Works with any CornerFamily. Replaces the current background drawable with a custom drawable with clipped corners. The previously set background color of the ImageView is automatically applied to the new background drawable.

Link copied to clipboard
fun colorOf(ctx: Context, @ColorRes colorRes: Int): Int

Get a color.

Link copied to clipboard
fun colorOfAttr(ctx: Context, @AttrRes attr: Int): Int

Get a color by a theme attribute.

Link copied to clipboard
fun colorOfAttrOrNull(ctx: Context, @AttrRes attr: Int): Int?

Get a color by a theme attribute.

Link copied to clipboard
fun colorOfAttrs(ctx: Context, @AttrRes vararg attrs: Int): Int

Get a color by a theme attribute.

Link copied to clipboard
fun colorOfAttrsOrNull(ctx: Context, @AttrRes vararg attrs: Int): Int?

Get a color by a theme attribute.

Link copied to clipboard
fun copyIntoClipboard(    ctx: Context,     label: String,     value: String)

Save a text into the clipboard.

Link copied to clipboard
fun dimensionOfAttrs(ctx: Context, @AttrRes vararg attrs: Int): Float?

Get an Integer value by theme attributes.

Link copied to clipboard
fun View.fadeIn(    alpha: Float = ANIM_ALPHA_MAX,     duration: Long = ANIM_DURATION_300,     listener: () -> Unit? = null)

Fade in a view.

Link copied to clipboard
fun View.fadeOut(    alpha: Float = ANIM_ALPHA_MIN,     duration: Long = ANIM_DURATION_300,     listener: () -> Unit? = null)

Fade out a view.

Link copied to clipboard
fun getBottomSheetBackgroundColor(ctx: Context, @StyleRes styleRes: Int): Int

Get background color.

Link copied to clipboard
fun getCornerFamily(ctx: Context): Int?
fun getCornerFamily(ctx: Context, @AttrRes attr: Int): Int?

Get corner family.

Link copied to clipboard
fun getCornerRadius(ctx: Context): Float?

Get corner radius.

Link copied to clipboard
fun Float.getDp(): Int

Converts px as Float to dp as Int.

fun Int.getDp(): Float

Converts px as Int to dp as Float.

Link copied to clipboard
fun getHighlightColor(ctx: Context): Int

Get highlight color.

Link copied to clipboard
fun getHighlightOfColor(@ColorInt color: Int): Int

Get the highlight color of any color.

Link copied to clipboard
fun getIconColor(ctx: Context): Int

Get color for icons.

Link copied to clipboard
fun getPrimaryColor(ctx: Context): Int

Get primary color.

Link copied to clipboard

Get navigation bar color.

Link copied to clipboard
fun getTextColor(ctx: Context): Int

Get text color.

Link copied to clipboard
fun getTextInverseColor(ctx: Context): Int

Get text inverse color.

Link copied to clipboard
fun intOfAttrs(ctx: Context, @AttrRes vararg attrs: Int): Int?

Get an Integer value by theme attributes.

Link copied to clipboard
fun isAmTime(time: Long): Boolean

Check if the time is am in the 12-hour clock format.

Link copied to clipboard
fun Int.isColorDark(threshold: Double = 0.5): Boolean

From https://github.com/afollestad/material-dialogs/blob/master/core/src/main/java/com/afollestad/materialdialogs/utils/MDUtil.kt

Link copied to clipboard
fun pasteFromClipboard(ctx: Context): String?

Receive the clipboard data.

Link copied to clipboard
fun splitTime(timeInSeconds: Long): TimeInfo

Splits seconds into days, hours, minutes and seconds.

Link copied to clipboard
fun Float.takeUnlessNotResolved(): Float?
fun Int.takeUnlessNotResolved(): Int?

Returns the same int value if

Link copied to clipboard
fun Drawable.toBitmap(    @Px width: Int = intrinsicWidth,     @Px height: Int = intrinsicHeight,     config: Bitmap.Config? = null): Bitmap

Taken from android ktx library [androidx.core.graphics.drawable|.

Link copied to clipboard
fun Float.toDp(): Float

Converts px as Float to dp as Float.

fun Int.toDp(): Int

Converts px as Int to dp as Int.

Properties

Link copied to clipboard
const val ANIM_ALPHA_MAX: Float = 1.0f
Link copied to clipboard
const val ANIM_ALPHA_MIN: Float = 0.0f
Link copied to clipboard
const val ANIM_DURATION_300: Long = 300