From 30cc6f81f266a2999ecccbe136568b68b0738fc9 Mon Sep 17 00:00:00 2001 From: mendhak Date: Tue, 26 Nov 2024 22:11:10 +0000 Subject: [PATCH 1/6] Set inset margin for the activity preferences to not overlap when on edge to edge mode --- .../java/com/mendhak/gpslogger/MainPreferenceActivity.java | 4 ++-- gpslogger/src/main/res/layout/activity_preferences.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gpslogger/src/main/java/com/mendhak/gpslogger/MainPreferenceActivity.java b/gpslogger/src/main/java/com/mendhak/gpslogger/MainPreferenceActivity.java index 498137e7b..4670caec1 100644 --- a/gpslogger/src/main/java/com/mendhak/gpslogger/MainPreferenceActivity.java +++ b/gpslogger/src/main/java/com/mendhak/gpslogger/MainPreferenceActivity.java @@ -51,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) { Systems.setLocale(PreferenceHelper.getInstance().getUserSpecifiedLocale(),getBaseContext(),getResources()); setContentView(R.layout.activity_preferences); - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.toolbar), (v, windowInsets) -> { + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.preference_activity_layout), (v, windowInsets) -> { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()); // Apply the insets as a margin to the view so it doesn't overlap with status bar @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { // Return CONSUMED if you don't want want the window insets to keep passing // down to descendant views. - return WindowInsetsCompat.CONSUMED; + return windowInsets; }); Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); diff --git a/gpslogger/src/main/res/layout/activity_preferences.xml b/gpslogger/src/main/res/layout/activity_preferences.xml index f014317ce..43bd8186e 100644 --- a/gpslogger/src/main/res/layout/activity_preferences.xml +++ b/gpslogger/src/main/res/layout/activity_preferences.xml @@ -1,6 +1,7 @@ From 1c4da2d38c83bc97ab453a461723835a06ddb89c Mon Sep 17 00:00:00 2001 From: mendhak Date: Fri, 29 Nov 2024 22:16:47 +0000 Subject: [PATCH 2/6] The GPS Main Activity should now adjust to the insets in edge to edge layouts Issue #1110 --- .../mendhak/gpslogger/GpsMainActivity.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsMainActivity.java b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsMainActivity.java index 411f86ce6..9f519df93 100644 --- a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsMainActivity.java +++ b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsMainActivity.java @@ -69,6 +69,9 @@ import androidx.core.app.NotificationManagerCompat; import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; @@ -697,10 +700,8 @@ public void setUpToolbar(){ getSupportActionBar().setListNavigationCallbacks(spinnerAdapter, this); getSupportActionBar().setSelectedNavigationItem(getUserSelectedNavigationItem()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - } + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } catch(Exception ex){ //http://stackoverflow.com/questions/26657348/appcompat-v7-v21-0-0-causing-crash-on-samsung-devices-with-android-v4-2-2 @@ -1088,6 +1089,25 @@ public void setupEvenlyDistributedToolbar(){ // Toolbar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarBottom); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.content_layout), (v, windowInsets) -> { + Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()); + + // Apply the insets as a margin to the view so it doesn't overlap with status bar + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); + mlp.leftMargin = insets.left; + mlp.bottomMargin = insets.bottom; + mlp.rightMargin = insets.right; + // mlp.topMargin = insets.top; + v.setLayoutParams(mlp); + + // Alternatively set the padding on the view itself. + // v.setPadding(0, 0, 0, 0); + + // Return CONSUMED if you don't want want the window insets to keep passing down to descendant views. + // return windowInsets; + return WindowInsetsCompat.CONSUMED; + }); + // Add 10 spacing on either side of the toolbar toolbar.setContentInsetsAbsolute(10, 10); From d624d20f7de675d82994c1645337f1ec2e863fdb Mon Sep 17 00:00:00 2001 From: mendhak Date: Fri, 29 Nov 2024 22:23:20 +0000 Subject: [PATCH 3/6] 133 RC1 --- gpslogger/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpslogger/build.gradle b/gpslogger/build.gradle index e31f29601..d8a3f8faa 100644 --- a/gpslogger/build.gradle +++ b/gpslogger/build.gradle @@ -45,8 +45,8 @@ android { targetSdkVersion 35 compileSdk 34 - versionCode 132 - versionName "132" + versionCode 133 + versionName "133-rc1" // Used by AppAuth-Android manifestPlaceholders = [ From eab41b826ee88710cfc71170e69ccfa8f2208b65 Mon Sep 17 00:00:00 2001 From: mendhak Date: Sun, 1 Dec 2024 18:27:46 +0000 Subject: [PATCH 4/6] Gradle plugin version update --- gpslogger/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpslogger/build.gradle b/gpslogger/build.gradle index d8a3f8faa..a88454c7f 100644 --- a/gpslogger/build.gradle +++ b/gpslogger/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:8.1.4' + classpath 'com.android.tools.build:gradle:8.7.1' classpath 'org.jacoco:org.jacoco.core:0.8.7' classpath "com.moowork.gradle:gradle-node-plugin:0.13" From 4a86a4c07879cf1c2f769bc0334e6f3ab8c46e07 Mon Sep 17 00:00:00 2001 From: mendhak Date: Thu, 2 Jan 2025 15:07:37 +0000 Subject: [PATCH 5/6] Auto send timers to use alarm manager compat, it was causing a crash on Android 15 when background usage was denied. Issue #1187 --- .../java/com/mendhak/gpslogger/GpsLoggingService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java index 5d4513cab..07aba969c 100644 --- a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java +++ b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java @@ -330,11 +330,10 @@ public void setupAutoSendTimers() { } PendingIntent sender = PendingIntent.getBroadcast(this, 0, alarmIntent, flags); AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, sender); - } - else { - am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, sender); + if(AlarmManagerCompat.canScheduleExactAlarms(am)){ + AlarmManagerCompat.setExactAndAllowWhileIdle(am, AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, sender); + } else { + AlarmManagerCompat.setAndAllowWhileIdle(am, AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, sender); } LOG.debug("Autosend alarm has been set"); From 30b1d4396e7a566933276faa80c4a11449329c95 Mon Sep 17 00:00:00 2001 From: mendhak Date: Thu, 2 Jan 2025 15:13:18 +0000 Subject: [PATCH 6/6] Changelog for v133 --- fastlane/metadata/android/en-US/changelogs/133.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/133.txt diff --git a/fastlane/metadata/android/en-US/changelogs/133.txt b/fastlane/metadata/android/en-US/changelogs/133.txt new file mode 100644 index 000000000..ad3fa18da --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/133.txt @@ -0,0 +1,2 @@ +* Bugfix - when background work permission was denied, autosend was causing the app to crash +* Bugfix - adjust the layout insets for Android 15 \ No newline at end of file