All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.sceyt.chatuikit.styles.StyleConstants.kt Maven / Gradle / Ivy

There is a newer version: 1.7.2
Show newest version
package com.sceyt.chatuikit.styles

import androidx.annotation.ColorInt

object StyleConstants {
    const val UNSET_SIZE = -1
    const val UNSET_COLOR = Integer.MIN_VALUE
    const val UNSET_FONT_RESOURCE = -1
    const val UNSET_CORNER_RADIUS = -1f
    const val UNSET_TEXT = ""
    const val UNSET_STYLE = -1


    fun Int.colorOrDefault(@ColorInt default: Int): Int {
        return if (this == UNSET_COLOR) default else this
    }

    fun Int.sizeOrDefault(default: Int): Int {
        return if (this == UNSET_SIZE) default else this
    }

    fun Int.fontOrDefault(default: Int): Int {
        return if (this == UNSET_FONT_RESOURCE) default else this
    }

    fun Int.styleOrDefault(default: Int): Int {
        return if (this == UNSET_STYLE) default else this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy