fix(android): adjust for Kotlin and project warnings

This commit is contained in:
Lucas Nogueira
2024-05-30 14:52:47 -03:00
parent f1a60fcb6a
commit acd383af75
25 changed files with 238 additions and 172 deletions
@@ -91,22 +91,10 @@ class GraphicOverlay: View {
return
}
val zLowerBoundInScreenPixel: Float
val zUpperBoundInScreenPixel: Float
if (rescaleZForVisualization) {
zLowerBoundInScreenPixel = (-0.001f).coerceAtMost(scale(zMin))
zUpperBoundInScreenPixel = 0.001f.coerceAtLeast(scale(zMax))
} else {
val defaultRangeFactor = 1f
zLowerBoundInScreenPixel = -defaultRangeFactor * canvas.width
zUpperBoundInScreenPixel = defaultRangeFactor * canvas.width
}
val zInScreenPixel = scale(zInImagePixel)
if (zInScreenPixel < 0) {
val v = (zInScreenPixel / zLowerBoundInScreenPixel * 255).toInt()
paint.setARGB(0, 0, 255, 0)
} else {
val v = (zInScreenPixel / zUpperBoundInScreenPixel * 255).toInt()
paint.setARGB(0, 0, 255, 0)
}
}
@@ -180,7 +168,7 @@ class GraphicOverlay: View {
needUpdateTransformation = false
}
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
synchronized(lock) {
updateTransformationIfNeeded()
@@ -115,6 +115,7 @@ class BiometricPlugin(private val activity: Activity): Plugin(activity) {
val biometryResult = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
manager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK)
} else {
@Suppress("DEPRECATION")
manager.canAuthenticate()
}
val ret = JSObject()
@@ -59,7 +59,6 @@ internal class ReadClipDataSerializer @JvmOverloads constructor(t: Class<ReadCli
jgen.writeEndObject()
}
else -> {}
}
jgen.writeEndObject()
@@ -94,10 +93,6 @@ class ClipboardPlugin(private val activity: Activity) : Plugin(activity) {
is WriteOptions.PlainText -> {
ClipData.newPlainText(args.label, args.text)
}
else -> {
invoke.reject("unimplemented clip data")
return
}
}
manager.setPrimaryClip(clipData)
@@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0")
classpath("com.android.tools.build:gradle:8.3.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
}
}
@@ -18,6 +18,6 @@ repositories {
dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:8.0.0")
implementation("com.android.tools.build:gradle:8.3.2")
}
@@ -1,6 +1,6 @@
#Tue May 10 19:22:52 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
@@ -141,7 +141,6 @@ sealed class ScanKind {
addDataFilters(intentFilter, uri, mimeType)
arrayOf(intentFilter)
}
else -> null
}
}
@@ -163,7 +162,6 @@ sealed class ScanKind {
null
}
}
else -> null
}
}
}
@@ -135,7 +135,6 @@ internal class NotificationScheduleSerializer @JvmOverloads constructor(t: Class
jgen.writeEndObject()
}
else -> {}
}
jgen.writeEndObject()
+1 -1
View File
@@ -8,7 +8,7 @@ android {
compileSdk = 34
defaultConfig {
minSdk = 19
minSdk = 24
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -21,7 +21,7 @@ class ShellPlugin(private val activity: Activity) : Plugin(activity) {
val url = invoke.parseArgs(String::class.java)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity?.applicationContext?.startActivity(intent)
activity.applicationContext?.startActivity(intent)
invoke.resolve()
} catch (ex: Exception) {
invoke.reject(ex.message)
+1 -1
View File
@@ -8,7 +8,7 @@ android {
compileSdk = 34
defaultConfig {
minSdk = 19
minSdk = 24
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"