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 diff --git a/gpslogger/build.gradle b/gpslogger/build.gradle index e31f29601..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" @@ -45,8 +45,8 @@ android { targetSdkVersion 35 compileSdk 34 - versionCode 132 - versionName "132" + versionCode 133 + versionName "133-rc1" // Used by AppAuth-Android manifestPlaceholders = [ 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"); 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); 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 @@