Skip to content

Instantly share code, notes, and snippets.

@ercnksgl
Last active September 14, 2022 11:55
Show Gist options
  • Save ercnksgl/52520292d074e96d4239153141d382eb to your computer and use it in GitHub Desktop.
Save ercnksgl/52520292d074e96d4239153141d382eb to your computer and use it in GitHub Desktop.
Customize Object
import android.content.Context
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
/**
* Set font types and color to customize text.
*/
data class Customize(
var hexColor: Int? = null,
val isItalic: Boolean = false,
val isBold: Boolean = false,
val isUnderline: Boolean = false
) {
fun setColor(context: Context, @ColorRes colorResId: Int): Customize {
this.hexColor = ContextCompat.getColor(context, colorResId)
return this
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment