Loading build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '3.17.19' propVersionName = '3.17.21' kotlin_version = '1.2.31' support_libs = '27.1.0' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Int.kt +15 −0 Original line number Diff line number Diff line package com.simplemobiletools.commons.extensions import android.graphics.Color import android.media.ExifInterface import java.util.* fun Int.getContrastColor(): Int { Loading Loading @@ -82,3 +83,17 @@ private fun hsv2hsl(hsv: FloatArray): FloatArray { return floatArrayOf(hue, newSat, newHue / 2f) } fun Int.orientationFromDegrees() = when (this) { 270 -> ExifInterface.ORIENTATION_ROTATE_270 180 -> ExifInterface.ORIENTATION_ROTATE_180 90 -> ExifInterface.ORIENTATION_ROTATE_90 else -> ExifInterface.ORIENTATION_NORMAL }.toString() fun Int.degreesFromOrientation() = when (this) { ExifInterface.ORIENTATION_ROTATE_270 -> 270 ExifInterface.ORIENTATION_ROTATE_180 -> 180 ExifInterface.ORIENTATION_ROTATE_90 -> 90 else -> 0 } Loading
build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '3.17.19' propVersionName = '3.17.21' kotlin_version = '1.2.31' support_libs = '27.1.0' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Int.kt +15 −0 Original line number Diff line number Diff line package com.simplemobiletools.commons.extensions import android.graphics.Color import android.media.ExifInterface import java.util.* fun Int.getContrastColor(): Int { Loading Loading @@ -82,3 +83,17 @@ private fun hsv2hsl(hsv: FloatArray): FloatArray { return floatArrayOf(hue, newSat, newHue / 2f) } fun Int.orientationFromDegrees() = when (this) { 270 -> ExifInterface.ORIENTATION_ROTATE_270 180 -> ExifInterface.ORIENTATION_ROTATE_180 90 -> ExifInterface.ORIENTATION_ROTATE_90 else -> ExifInterface.ORIENTATION_NORMAL }.toString() fun Int.degreesFromOrientation() = when (this) { ExifInterface.ORIENTATION_ROTATE_270 -> 270 ExifInterface.ORIENTATION_ROTATE_180 -> 180 ExifInterface.ORIENTATION_ROTATE_90 -> 90 else -> 0 }