This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ImageView.loadImageOrInitial( | |
url: String?, | |
text: String?, | |
textSize: Float = 16F, | |
textColor: Int = Color.BLACK, | |
backgroundColor: Int = Color.WHITE, | |
maxChar: Int = 2, | |
allCaps: Boolean = true, | |
progressStroke: Float = 5F, | |
progressRadius: Float = 30F, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val imageGetter = Html.ImageGetter { | |
val levelListDrawable = LevelListDrawable() | |
val drawable = context.resources.getDrawable(R.drawable.ic_book) | |
levelListDrawable.addLevel(1, 1, drawable) | |
val displayMetrics = DisplayMetrics() | |
(context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics) | |
val widthImg = displayMetrics.widthPixels | |
val heightImg = widthImg/3*2 |