diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index d9fbdb5..1ff6944 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -5,13 +5,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
- compileSdkVersion 28
+ compileSdkVersion 31
defaultConfig {
applicationId "nl.rogro82.pipup"
minSdkVersion 24
- targetSdkVersion 28
- versionCode 6
- versionName "0.1.5-beta"
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1"
}
buildTypes {
release {
@@ -24,13 +24,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'com.android.support:leanback-v17:28.0.0'
- implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'androidx.leanback:leanback:1.0.0'
+ implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.+'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2b1e445..ae76f0a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -43,6 +43,7 @@
= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {
+ askPermission();
+ }
// start service in foreground
val textViewConnection = findViewById(R.id.textViewServerAddress)
@@ -59,4 +67,23 @@ class MainActivity : Activity() {
startService(serviceIntent)
}
}
+
+ private fun askPermission() {
+
+ val intent =
+ Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:$packageName"))
+ startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE)
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.M)
+ override fun onActivityResult(requestCode: Int, resultCode: Int, @Nullable data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ if (resultCode == ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE) {
+ if (!Settings.canDrawOverlays(this)) {
+ askPermission()
+ }
+ }
+ }
+
+
}
diff --git a/app/src/main/java/nl/rogro82/pipup/PiPupService.kt b/app/src/main/java/nl/rogro82/pipup/PiPupService.kt
index 4a0ae48..bd40036 100644
--- a/app/src/main/java/nl/rogro82/pipup/PiPupService.kt
+++ b/app/src/main/java/nl/rogro82/pipup/PiPupService.kt
@@ -8,7 +8,7 @@ import android.graphics.PixelFormat
import android.os.Build
import android.os.Handler
import android.os.IBinder
-import android.support.v4.app.NotificationCompat
+import androidx.core.app.NotificationCompat
import android.util.Log
import android.view.Gravity
import android.view.View
@@ -33,7 +33,7 @@ class PiPupService : Service(), WebServer.Handler {
val pendingIntent = PendingIntent.getActivity(
this, 0,
- Intent(this, MainActivity::class.java), 0
+ Intent(this, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE
)
val mBuilder = NotificationCompat.Builder(this, "service_channel")
@@ -269,7 +269,7 @@ class PiPupService : Service(), WebServer.Handler {
} catch (ex: Throwable) {
- Log.e(LOG_TAG, ex.message)
+ Log.e(LOG_TAG, ex.message.toString())
InvalidRequest(ex.message)
}
}
diff --git a/app/src/main/java/nl/rogro82/pipup/Receiver.kt b/app/src/main/java/nl/rogro82/pipup/Receiver.kt
index 28c7ac0..647a72b 100644
--- a/app/src/main/java/nl/rogro82/pipup/Receiver.kt
+++ b/app/src/main/java/nl/rogro82/pipup/Receiver.kt
@@ -4,7 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
-import android.support.v4.content.ContextCompat.startForegroundService
+import androidx.core.content.ContextCompat.startForegroundService
class Receiver : BroadcastReceiver() {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 8ab5b50..7981d5f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,5 +1,5 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index b39ac10..c832cb8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.3.31'
+ ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
-
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
@@ -19,7 +18,6 @@ allprojects {
repositories {
google()
jcenter()
-
}
}
diff --git a/gradle.properties b/gradle.properties
index 85be9ea..3d8ce0c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -13,3 +13,5 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/readme.md b/readme.md
index a0fec8e..0a18940 100644
--- a/readme.md
+++ b/readme.md
@@ -105,4 +105,8 @@ Form-fields:
| 3 | BottomLeft |
| 4 | Center |
-Color-properties are in `[AA]RRGGBB` where the alpha channel is optional e.g. #FFFFFF or #CCFFFFFF
\ No newline at end of file
+Color-properties are in `[AA]RRGGBB` where the alpha channel is optional e.g. #FFFFFF or #CCFFFFFF
+
+
+### Contributors:
+ - Zaheer
\ No newline at end of file