Skip to content

Commit

Permalink
actions: refactor Dimenutils to kotlin (fixes open-learning-exchang…
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 and dogi authored Jan 4, 2024
1 parent 8626fad commit d976d80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1261
versionName "0.12.61"
versionCode 1262
versionName "0.12.62"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down

This file was deleted.

13 changes: 13 additions & 0 deletions app/src/main/java/org/ole/planet/myplanet/utilities/DimenUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ole.planet.myplanet.utilities

import android.util.DisplayMetrics
import org.ole.planet.myplanet.MainApplication
import kotlin.math.roundToInt

object DimenUtils {
@JvmStatic
fun dpToPx(dp: Int): Int {
val displayMetrics = MainApplication.context.resources.displayMetrics
return (dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)).roundToInt()
}
}

0 comments on commit d976d80

Please sign in to comment.