From dea981e75f90453f9df7989e5ed2a55cb6e94ca9 Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 10:37:38 +0100 Subject: [PATCH 1/6] Upgrade to gradle 8 --- build.gradle | 2 +- gradle.properties | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c7bc4e9..9fc2344 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" diff --git a/gradle.properties b/gradle.properties index d546dea..16a11ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,10 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.defaults.buildfeatures.buildconfig=true android.enableJetifier=true +android.nonFinalResIds=false +android.nonTransitiveRClass=false android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8002f78..3d681e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip From ac155b3f15758a9bea1a42cc30b50e8b81bf824f Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 10:37:55 +0100 Subject: [PATCH 2/6] Increase sdk version to 34 (Android 14) --- app/build.gradle | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1c63283..92a108a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,11 +2,23 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 32 + + /** + * compileSdk specifies the Android API level Gradle should use to + * compile your app. This means your app can use the API features included in + * this API level and lower. + */ + compileSdk = 34 + defaultConfig { applicationId "de.synyx.android.meetingroom" + + // Defines the minimum API level required to run the app. minSdkVersion 23 - targetSdkVersion 32 + + // Specifies the API level used to test the app. + targetSdkVersion 34 + versionCode 7 versionName "1.3.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" From 661d02e4e5a4543c0c6ea651cab81456671f2038 Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 10:57:55 +0100 Subject: [PATCH 3/6] Setup Java 17 in Pipeline --- .github/workflows/android.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e13abaa..728a117 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -8,10 +8,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Build with Gradle - run: ./gradlew build + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + - name: Build with Gradle + run: ./gradlew build From 1888ab4d074d8b6998de2524ddff135643f3db6f Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 11:15:08 +0100 Subject: [PATCH 4/6] Avoid deprecated android feature To restart the app, use FLAG_MUTABLE instead of FLAG_CANCEL_CURRENT for the pending intent. --- .../android/meeroo/screen/settings/SettingsActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java index 2f595f5..2a48093 100644 --- a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java +++ b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java @@ -1,5 +1,8 @@ package de.synyx.android.meeroo.screen.settings; +import static android.app.PendingIntent.FLAG_MUTABLE; +import static android.content.Context.ALARM_SERVICE; + import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; @@ -126,8 +129,8 @@ private void restartApplication() { Intent loginActivityIntent = new Intent(getContext(), LoginActivity.class); int pendingIntentId = 123; // id not needed - PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), pendingIntentId, loginActivityIntent, PendingIntent.FLAG_CANCEL_CURRENT); - AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE); + PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), pendingIntentId, loginActivityIntent, FLAG_MUTABLE); + AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(ALARM_SERVICE); final int delay = 150; alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, pendingIntent); System.exit(0); From 1c8c84147254373f544886e8e85befe06d9afb41 Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 11:18:57 +0100 Subject: [PATCH 5/6] Remove unused imports --- .../screen/settings/SettingsActivity.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java index 2a48093..1909fc6 100644 --- a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java +++ b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java @@ -1,39 +1,32 @@ package de.synyx.android.meeroo.screen.settings; import static android.app.PendingIntent.FLAG_MUTABLE; -import static android.content.Context.ALARM_SERVICE; +import static de.synyx.android.meeroo.util.functional.FunctionUtils.mapToArray; +import static de.synyx.android.meeroo.util.functional.FunctionUtils.toArray; +import static de.synyx.android.meeroo.util.functional.FunctionUtils.toMap; import android.app.AlarmManager; import android.app.PendingIntent; -import android.content.Context; import android.content.Intent; import android.os.Bundle; - import android.preference.ListPreference; import android.preference.MultiSelectListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; - import android.view.MenuItem; import androidx.annotation.NonNull; - import androidx.appcompat.app.ActionBar; +import java.util.Map; + import de.synyx.android.meeroo.R; import de.synyx.android.meeroo.config.Registry; import de.synyx.android.meeroo.domain.MeetingRoom; import de.synyx.android.meeroo.preferences.PreferencesService; -import de.synyx.android.meeroo.preferences.PreferencesServiceImpl; import de.synyx.android.meeroo.screen.login.LoginActivity; -import java.util.Map; - -import static de.synyx.android.meeroo.util.functional.FunctionUtils.mapToArray; -import static de.synyx.android.meeroo.util.functional.FunctionUtils.toArray; -import static de.synyx.android.meeroo.util.functional.FunctionUtils.toMap; - public class SettingsActivity extends AppCompatPreferenceActivity { From 8541b01c63984489d429685f6734c682501a2379 Mon Sep 17 00:00:00 2001 From: Julian Heetel Date: Fri, 15 Dec 2023 11:31:52 +0100 Subject: [PATCH 6/6] Navigate to login without restarting the app --- .../screen/settings/SettingsActivity.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java index 1909fc6..fbcb035 100644 --- a/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java +++ b/app/src/main/java/de/synyx/android/meeroo/screen/settings/SettingsActivity.java @@ -1,12 +1,9 @@ package de.synyx.android.meeroo.screen.settings; -import static android.app.PendingIntent.FLAG_MUTABLE; import static de.synyx.android.meeroo.util.functional.FunctionUtils.mapToArray; import static de.synyx.android.meeroo.util.functional.FunctionUtils.toArray; import static de.synyx.android.meeroo.util.functional.FunctionUtils.toMap; -import android.app.AlarmManager; -import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.preference.ListPreference; @@ -114,19 +111,14 @@ public void onCreate(Bundle savedInstanceState) { private boolean logout(Preference preference) { Registry.get(PreferencesService.class).logout(); - restartApplication(); + navigateToLogin(); return true; } - private void restartApplication() { - - Intent loginActivityIntent = new Intent(getContext(), LoginActivity.class); - int pendingIntentId = 123; // id not needed - PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), pendingIntentId, loginActivityIntent, FLAG_MUTABLE); - AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(ALARM_SERVICE); - final int delay = 150; - alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, pendingIntent); - System.exit(0); + private void navigateToLogin() { + Intent intent = new Intent(getContext(), LoginActivity.class); + getContext().startActivity(intent); + getActivity().finish(); }