Skip to content

Commit

Permalink
Update to Kotlin 2 (openhab#3711)
Browse files Browse the repository at this point in the history
Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Jun 27, 2024
1 parent 36736ef commit 9cb20ff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ captures/
.idea/navEditor.xml
.idea/workspace.xml
.idea/deploymentTargetSelector.xml
.idea/other.xml

.kotlin

# Keystore files
*.jks
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.24" />
<option name="version" value="2.0.0" />
</component>
</project>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
ext.kotlin_version = '1.9.24'
ext.kotlin_version = '2.0.0'
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.4.1'
classpath 'com.android.tools.build:gradle:8.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# SPDX-License-Identifier: EPL-2.0
#

android.enableJetifier=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.configuration-cache=true
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import android.os.Parcelable
import android.speech.RecognizerIntent
import android.telephony.TelephonyManager
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.annotation.StringRes
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -810,17 +809,20 @@ class BackgroundTasksManager : BroadcastReceiver() {
}
ItemUpdateWorker.ValueWithInfo(ssidToSend)
}
@RequiresApi(Build.VERSION_CODES.M)
VALUE_GETTER_MAP[PrefKeys.SEND_DND_MODE] = { context, _ ->
val nm = context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
val mode = when (nm.currentInterruptionFilter) {
NotificationManager.INTERRUPTION_FILTER_NONE -> "TOTAL_SILENCE"
NotificationManager.INTERRUPTION_FILTER_PRIORITY -> "PRIORITY"
NotificationManager.INTERRUPTION_FILTER_ALARMS -> "ALARMS"
NotificationManager.INTERRUPTION_FILTER_ALL -> "OFF"
else -> "UNDEF"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val nm = context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
val mode = when (nm.currentInterruptionFilter) {
NotificationManager.INTERRUPTION_FILTER_NONE -> "TOTAL_SILENCE"
NotificationManager.INTERRUPTION_FILTER_PRIORITY -> "PRIORITY"
NotificationManager.INTERRUPTION_FILTER_ALARMS -> "ALARMS"
NotificationManager.INTERRUPTION_FILTER_ALL -> "OFF"
else -> "UNDEF"
}
ItemUpdateWorker.ValueWithInfo(mode)
} else {
ItemUpdateWorker.ValueWithInfo("UNDEF")
}
ItemUpdateWorker.ValueWithInfo(mode)
}
VALUE_GETTER_MAP[PrefKeys.SEND_BLUETOOTH_DEVICES] = { context, _ ->
fun BluetoothDevice.isConnected(): Boolean {
Expand Down

0 comments on commit 9cb20ff

Please sign in to comment.