|
54 | 54 | import androidx.appcompat.widget.Toolbar; |
55 | 55 | import androidx.core.app.ActivityCompat; |
56 | 56 | import androidx.core.content.ContextCompat; |
| 57 | +import androidx.core.graphics.Insets; |
57 | 58 | import androidx.core.os.LocaleListCompat; |
| 59 | +import androidx.core.view.ViewCompat; |
| 60 | +import androidx.core.view.WindowInsetsCompat; |
58 | 61 | import androidx.fragment.app.DialogFragment; |
59 | 62 |
|
60 | 63 | import com.rustamg.filedialogs.FileDialog; |
@@ -234,7 +237,20 @@ public void clearStatus() { |
234 | 237 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
235 | 238 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { |
236 | 239 | CompatUtils.enableEdgeToEdge(this); |
237 | | - getWindow().getDecorView().setPadding(0, 0, 0, getNavigationBarHeight()); |
| 240 | + ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(), (view, windowInsets) -> { |
| 241 | + // Get the navigation bar insets |
| 242 | + Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()); |
| 243 | + |
| 244 | + // Apply the navigation bar height as bottom padding |
| 245 | + view.setPadding( |
| 246 | + view.getPaddingLeft(), |
| 247 | + view.getPaddingTop(), |
| 248 | + view.getPaddingRight(), |
| 249 | + insets.bottom // Dynamic height in pixels |
| 250 | + ); |
| 251 | + |
| 252 | + return windowInsets; |
| 253 | + }); |
238 | 254 | } |
239 | 255 |
|
240 | 256 | super.onCreate(savedInstanceState); |
@@ -1678,13 +1694,4 @@ private void reportException(Throwable exception) { |
1678 | 1694 | public enum FallbackFileType { |
1679 | 1695 | FILE, TABLE_FILE |
1680 | 1696 | } |
1681 | | - |
1682 | | - private int getNavigationBarHeight() { |
1683 | | - Resources resources = getResources(); |
1684 | | - int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); |
1685 | | - if (resourceId > 0) { |
1686 | | - return resources.getDimensionPixelSize(resourceId); |
1687 | | - } |
1688 | | - return 0; |
1689 | | - } |
1690 | 1697 | } |
0 commit comments