Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Updated libs Added try catch for parsing colours

Michael Rademakerda427f24743f
diff --git a/console/android/GenericApp/app/build.gradle b/console/android/GenericApp/app/build.gradle
index e9e0c60d8..c5d01c06c 100644
--- a/console/android/GenericApp/app/build.gradle
+++ b/console/android/GenericApp/app/build.gradle
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
- compileSdkVersion 30
+ compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "io.openremote.app"
minSdkVersion 25
- targetSdkVersion 30
+ targetSdkVersion 31
versionCode 24
versionName "1.0.4"
@@ -38,15 +38,14 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
- implementation 'androidx.core:core-ktx:1.6.0'
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.preference:preference-ktx:1.1.1'
- implementation "com.google.android.gms:play-services-location:18.0.0"
+ implementation "com.google.android.gms:play-services-location:19.0.1"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-messaging-ktx'
- implementation 'com.google.android.material:material:1.4.0'
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ implementation 'com.google.android.material:material:1.5.0'
implementation project(':ORLib')
}
\ No newline at end of file
diff --git a/console/android/GenericApp/app/src/main/AndroidManifest.xml b/console/android/GenericApp/app/src/main/AndroidManifest.xml
index 803441bec..79a85e9f6 100644
--- a/console/android/GenericApp/app/src/main/AndroidManifest.xml
+++ b/console/android/GenericApp/app/src/main/AndroidManifest.xml
@@ -51,14 +51,16 @@
<activity android:name="io.openremote.orlib.ui.OrMainActivity" />
<activity android:name="io.openremote.orlib.ui.OrPrivacyPolicyActivity" />
- <service android:name="io.openremote.orlib.service.ORFirebaseMessagingService">
+ <service android:name="io.openremote.orlib.service.ORFirebaseMessagingService"
+ android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
- <service android:name="io.openremote.orlib.service.ORMessagingActionService"></service>
+ <service android:name="io.openremote.orlib.service.ORMessagingActionService" />
- <receiver android:name="io.openremote.orlib.service.GeofenceBootCompleteReceiver">
+ <receiver android:name="io.openremote.orlib.service.GeofenceBootCompleteReceiver"
+ android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
diff --git a/console/android/GenericApp/build.gradle b/console/android/GenericApp/build.gradle
index cfd289e40..92e850c78 100644
--- a/console/android/GenericApp/build.gradle
+++ b/console/android/GenericApp/build.gradle
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.5.20"
+ ext.kotlin_version = "1.6.10"
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.2.2'
+ classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/console/android/GenericApp/gradle/wrapper/gradle-wrapper.properties b/console/android/GenericApp/gradle/wrapper/gradle-wrapper.properties
index 8ab921d54..832fecd87 100644
--- a/console/android/GenericApp/gradle/wrapper/gradle-wrapper.properties
+++ b/console/android/GenericApp/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Nov 03 11:24:38 CET 2020
+#Mon Jan 24 13:58:21 CET 2022
distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
diff --git a/console/android/ORLib/build.gradle b/console/android/ORLib/build.gradle
index da3b978b1..5cb696fa6 100644
--- a/console/android/ORLib/build.gradle
+++ b/console/android/ORLib/build.gradle
@@ -4,12 +4,12 @@ plugins {
}
android {
- compileSdkVersion 30
+ compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 25
- targetSdkVersion 30
+ targetSdkVersion 31
versionCode 1
versionName "1.0"
@@ -37,12 +37,11 @@ android {
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'androidx.core:core-ktx:1.6.0'
- implementation 'androidx.appcompat:appcompat:1.3.1'
- implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
- implementation "com.google.android.gms:play-services-location:18.0.0"
+ implementation "com.google.android.gms:play-services-location:19.0.1"
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
implementation platform('com.google.firebase:firebase-bom:26.0.0')
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
index bbe4b3a7e..b3cbf5ffc 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
@@ -7,6 +7,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
+import android.os.Looper
import androidx.appcompat.app.AlertDialog
import androidx.core.app.ActivityCompat
import com.fasterxml.jackson.databind.ObjectMapper
@@ -163,8 +164,8 @@ class GeofenceProvider(val context: Context) {
private val locationUpdateCallback: LocationCallback by lazy {
object : LocationCallback() {
- override fun onLocationResult(locationResult: LocationResult?) {
- locationResult?.lastLocation?.let {
+ override fun onLocationResult(locationResult: LocationResult) {
+ locationResult.lastLocation.let {
locationClient.removeLocationUpdates(this)
locationCallback?.accept(
hashMapOf(
@@ -273,7 +274,7 @@ class GeofenceProvider(val context: Context) {
locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY
locationRequest.numUpdates = 1
- locationClient.requestLocationUpdates(locationRequest, locationUpdateCallback, null)
+ locationClient.requestLocationUpdates(locationRequest, locationUpdateCallback, Looper.getMainLooper())
} else {
registerPermissions(activity)
locationCallback?.accept(
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
index a233f5269..e1471f8f0 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
@@ -24,7 +24,7 @@ class GeofenceTransitionsIntentService : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
- val geofencingEvent = GeofencingEvent.fromIntent(intent)
+ val geofencingEvent = GeofencingEvent.fromIntent(intent!!)
if (geofencingEvent.hasError()) {
LOG.warning("Geofence event error : ${geofencingEvent.errorCode}")
@@ -38,7 +38,7 @@ class GeofenceTransitionsIntentService : BroadcastReceiver() {
return
}
- val baseUrl = intent!!.getStringExtra(GeofenceProvider.baseUrlKey)
+ val baseUrl = intent.getStringExtra(GeofenceProvider.baseUrlKey)
val geofenceTransition = geofencingEvent.geofenceTransition
val trans = if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER) "ENTER" else "EXIT"
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
index 36773cf21..361769e18 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
@@ -195,12 +195,21 @@ open class OrMainActivity : Activity() {
floatingActionButton.layoutParams = layoutParams
floatingActionButton.setImageResource(R.drawable.ic_menu)
if (!appConfig!!.primaryColor.isNullOrBlank()) {
- floatingActionButton.backgroundTintList =
- ColorStateList.valueOf(Color.parseColor(appConfig!!.primaryColor!!))
+ try {
+ floatingActionButton.backgroundTintList =
+ ColorStateList.valueOf(Color.parseColor(appConfig!!.primaryColor!!))
+ } catch (ex: java.lang.Exception) {
+ ex.printStackTrace()
+ }
}
if (!appConfig!!.secondaryColor.isNullOrBlank()) {
- floatingActionButton.imageTintList =
- ColorStateList.valueOf(Color.parseColor(appConfig!!.secondaryColor!!))
+ try {
+ floatingActionButton.imageTintList =
+ ColorStateList.valueOf(Color.parseColor(appConfig!!.secondaryColor!!))
+ } catch (ex: Exception) {
+ floatingActionButton.imageTintList = ColorStateList.valueOf(Color.DKGRAY)
+ ex.printStackTrace()
+ }
} else {
floatingActionButton.imageTintList = ColorStateList.valueOf(Color.DKGRAY)
}