23 lines
600 B
Kotlin
23 lines
600 B
Kotlin
package com.gh.common.view
|
|
|
|
import android.graphics.Color
|
|
import android.graphics.drawable.Drawable
|
|
import android.graphics.drawable.GradientDrawable
|
|
import com.gh.common.util.DisplayUtils
|
|
|
|
|
|
object DrawableView {
|
|
|
|
@JvmStatic
|
|
fun getServerDrawable(colorCode: String): Drawable {
|
|
return getServerDrawable(Color.parseColor(colorCode))
|
|
}
|
|
|
|
@JvmStatic
|
|
fun getServerDrawable(colorCode: Int): Drawable {
|
|
val drawable = GradientDrawable()
|
|
drawable.setColor(colorCode)
|
|
drawable.cornerRadius = DisplayUtils.dip2px(2F).toFloat()
|
|
return drawable
|
|
}
|
|
} |