Skip to content

fix: Add fitsSystemWindows to handle edge-to-edge behavior in Android 15 #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/java/net/osmtracker/activity/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.text.TextWatcher;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;


/**
Expand Down Expand Up @@ -63,6 +64,10 @@ public class Preferences extends PreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
ListView listView = getListView();
listView.setFitsSystemWindows(true);
listView.setClipToPadding(false);
listView.setPadding(0, 48, 0, 0);

// Set summary of some preferences to their actual values
// and register a change listener to set again the summary in case of change
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/net/osmtracker/activity/WaypointList.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.CursorAdapter;
import android.widget.ListView;

/**
* Activity that lists the previous waypoints tracked by the user.
Expand All @@ -15,15 +17,24 @@
*/
public class WaypointList extends ListActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ListView listView = getListView();
listView.setFitsSystemWindows(true);
listView.setClipToPadding(false);
listView.setPadding(0, 48, 0, 0);
}

@Override
protected void onResume() {
Long trackId = getIntent().getExtras().getLong(TrackContentProvider.Schema.COL_TRACK_ID);

Cursor cursor = getContentResolver().query(TrackContentProvider.waypointsUri(trackId),
null, null, null, TrackContentProvider.Schema.COL_TIMESTAMP + " desc");
startManagingCursor(cursor);
setListAdapter(new WaypointListAdapter(WaypointList.this, cursor));

super.onResume();
}

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout-iw/waypointlist_item.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content" android:id="@+id/wplist_item_timestamp" android:layout_height="wrap_content" android:text="{timestamp}" android:layout_below="@+id/wplist_item_location" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp"></TextView>
<TextView style="@android:style/TextAppearance.Large" android:layout_width="wrap_content" android:id="@+id/wplist_item_name" android:layout_height="wrap_content" android:text="{name}" android:layout_alignParentTop="true" android:layout_alignParentRight="true"></TextView>
<TextView android:layout_width="wrap_content" android:id="@+id/wplist_item_location" android:layout_height="wrap_content" android:text="{location}" android:layout_below="@+id/wplist_item_name" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp"></TextView>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
android:padding="10dp"
android:fitsSystemWindows="true">

<LinearLayout
android:id="@+id/about_header"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/available_layouts.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
android:fillViewport="true"
android:fitsSystemWindows="true">

<LinearLayout
android:id="@+id/root_layout"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/buttons_presets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/buttons_presets"
android:paddingTop="4dp">
android:paddingTop="4dp"
android:fitsSystemWindows="true">

<TextView
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/displaytrackmap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/github_repository_settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:padding="7dp">
android:layout_height="match_parent" android:padding="7dp" android:fitsSystemWindows="true">

<LinearLayout
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/gpsstatus_record.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:fitsSystemWindows="true">

<TextView
android:id="@+id/gpsstatus_record_tvHeading"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/osm_upload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
android:orientation="vertical"
android:fitsSystemWindows="true">

<LinearLayout
android:id="@+id/trackdetail_buttons"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/tracklogger.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="fill_parent">
android:orientation="vertical" android:layout_height="fill_parent" android:fitsSystemWindows="true">
<net.osmtracker.layout.GpsStatusRecord
android:id="@+id/gpsStatus" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/trackmanager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
android:layout_width="fill_parent"
android:fitsSystemWindows="true">

<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
Expand Down
35 changes: 28 additions & 7 deletions app/src/main/res/layout/waypointlist_item.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView android:layout_height="wrap_content"
android:id="@+id/wplist_item_name" android:text="{name}"
android:layout_width="wrap_content" style="@android:style/TextAppearance.Large"></TextView>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="{timestamp}" android:id="@+id/wplist_item_timestamp" android:layout_below="@+id/wplist_item_location" android:layout_alignBaseline="@+id/wplist_item_name" android:layout_alignParentRight="true" android:layout_alignRight="@+id/wplist_item_name" android:layout_marginRight="10dp"></TextView><TextView android:layout_height="wrap_content"
android:id="@+id/wplist_item_name"
android:text="{name}"
android:layout_width="wrap_content"
style="@android:style/TextAppearance.Large">
</TextView>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="{timestamp}"
android:id="@+id/wplist_item_timestamp"
android:layout_below="@+id/wplist_item_location"
android:layout_alignBaseline="@+id/wplist_item_name"
android:layout_alignParentRight="true"
android:layout_alignRight="@+id/wplist_item_name"
android:layout_marginRight="10dp">
</TextView>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/wplist_item_location"
android:text="{location}" android:layout_below="@+id/wplist_item_name" android:layout_alignParentRight="true" android:layout_marginRight="10dp"></TextView>
android:text="{location}"
android:layout_below="@+id/wplist_item_name"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp">
</TextView>


</RelativeLayout>
10 changes: 6 additions & 4 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<ListPreference
android:title="@string/prefs_voicerec_duration"
android:key="voicerec.duration"
android:entryValues="@array/prefs_voicerec_durations"
android:defaultValue="2"
android:entries="@array/prefs_voicerec_durations" />
android:entries="@array/prefs_voicerec_durations"/>
<CheckBoxPreference
android:key="sound_enabled"
android:title="@string/prefs_sound_enabled"
Expand Down Expand Up @@ -126,6 +130,4 @@
android:entryValues="@array/prefs_ui_orientation_options_values" />
</PreferenceCategory>



</PreferenceScreen>