ref: d94a0971002b001a33f0c4a0a2ab559a891ce4af
app/src/main/java/xyz/apiote/bimba/czwek/utils.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// SPDX-FileCopyrightText: Adam Evyčędo // // SPDX-License-Identifier: GPL-3.0-or-later package xyz.apiote.bimba.czwek import android.content.res.Resources import android.util.DisplayMetrics import kotlin.math.roundToInt fun dpToPixel(dp: Float): Float { val metrics: DisplayMetrics = Resources.getSystem().displayMetrics return dp * (metrics.densityDpi / 160f) } fun dpToPixelI(dp: Float): Int = dpToPixel(dp).roundToInt() |