Skip to content
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

Milestone 133 #1180

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions gpslogger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ android {

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

// Used by AppAuth-Android
manifestPlaceholders = [
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