|
20 | 20 | import androidx.appcompat.app.AppCompatActivity; |
21 | 21 | import androidx.core.app.ActivityCompat; |
22 | 22 | import androidx.core.content.ContextCompat; |
| 23 | +import androidx.core.graphics.Insets; |
23 | 24 | import androidx.core.util.Consumer; |
| 25 | +import androidx.core.view.ViewCompat; |
| 26 | +import androidx.core.view.WindowInsetsCompat; |
24 | 27 |
|
25 | 28 | import com.google.zxing.Result; |
26 | 29 | import com.mendix.mendixnative.activity.MendixReactActivity; |
@@ -57,6 +60,13 @@ public class MainActivity extends AppCompatActivity implements ZXingScannerView. |
57 | 60 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
58 | 61 | super.onCreate(savedInstanceState); |
59 | 62 | setContentView(R.layout.activity_main_dev); |
| 63 | + // Edge-to-edge: keep the content clear of the system bars and display cutout |
| 64 | + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.root), (view, windowInsets) -> { |
| 65 | + Insets bars = windowInsets.getInsets( |
| 66 | + WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()); |
| 67 | + view.setPadding(bars.left, bars.top, bars.right, bars.bottom); |
| 68 | + return WindowInsetsCompat.CONSUMED; |
| 69 | + }); |
60 | 70 | getWindow().getDecorView().setFilterTouchesWhenObscured(true); |
61 | 71 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
62 | 72 | getWindow().setHideOverlayWindows(true); |
|
0 commit comments