Skip to content

Commit

Permalink
Merge branch 'milestone133'
Browse files Browse the repository at this point in the history
  • Loading branch information
mendhak committed Jan 2, 2025
2 parents cde1f9f + cb21668 commit 93afabe
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/133.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions gpslogger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -45,8 +45,8 @@ android {

targetSdkVersion 35
compileSdk 34
versionCode 132
versionName "132"
versionCode 133
versionName "133"

// Used by AppAuth-Android
manifestPlaceholders = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
28 changes: 24 additions & 4 deletions gpslogger/src/main/java/com/mendhak/gpslogger/GpsMainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions gpslogger/src/main/res/layout/activity_preferences.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/preference_activity_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down

0 comments on commit 93afabe

Please sign in to comment.