Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00e697d1 authored by Ben Reich's avatar Ben Reich
Browse files

Simply check if the nav bar is visible before adding padding

It turns out all the excessive API calls to verify that the nav bar is
visible is not necessary as there appears to be a simple API that
returns true/false if the gesture bar is visible or not. Let's prefer
that instead.

Bug: 402604097
Test: m DocumentsUIGoogle to Pixel tablet and observe
Flag: com.android.documentsui.flags.use_material3
Change-Id: I318c5062502c1001f19ac85ceba87be1fe1d34ed
parent f0d52d9e
Loading
Loading
Loading
Loading
+4 −9
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.Toolbar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.Fragment;


import com.android.documentsui.AbstractActionHandler.CommonAddons;
import com.android.documentsui.AbstractActionHandler.CommonAddons;
@@ -594,15 +595,9 @@ public abstract class BaseActivity
                            insets.getSystemWindowInsetRight(),
                            insets.getSystemWindowInsetRight(),
                            0);
                            0);


                    // When use_material3 flag is ON and FEATURE_FREEFORM_WINDOW_MANAGEMENT is
                    boolean isNavBarVisible =
                    // enabled, then there should not be any additional bottom gap in full screen
                            insets.isVisible(WindowInsetsCompat.Type.navigationBars());
                    // mode. Otherwise need to take into account the system window insets such as
                    if (isNavBarVisible) {
                    // the bottom swipe up navigation gesture.
                    if (!isUseMaterial3FlagEnabled()
                            || !getApplicationContext()
                                    .getPackageManager()
                                    .hasSystemFeature(
                                            PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT)) {
                        View saveContainer = findViewById(getRes(R.id.container_save));
                        View saveContainer = findViewById(getRes(R.id.container_save));
                        saveContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
                        saveContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());