This commit is contained in:
Tommaso Berlose
2020-05-05 14:29:30 +02:00
parent 4feb72381d
commit f5c4ee7eb0
32 changed files with 394 additions and 228 deletions

View File

@ -39,4 +39,13 @@ object WidgetHelper {
private fun Context.dip(value: Int): Int = (value * resources.displayMetrics.density).toInt()
}
fun Pair<Int, Int>.reduceDimensionWithMaxWidth(width: Int): Pair<Int, Int> {
return if (first < width) {
this
} else {
val factor = width / first
width to second * factor
}
}
}