summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt
new file mode 100644
index 000000000..19c53c481
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt
@@ -0,0 +1,31 @@
+// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package org.yuzu.yuzu_emu.utils
+
+import android.annotation.SuppressLint
+import android.app.Activity
+import android.content.Context
+import android.graphics.Rect
+
+object InsetsHelper {
+ const val THREE_BUTTON_NAVIGATION = 0
+ const val TWO_BUTTON_NAVIGATION = 1
+ const val GESTURE_NAVIGATION = 2
+
+ @SuppressLint("DiscouragedApi")
+ fun getSystemGestureType(context: Context): Int {
+ val resources = context.resources
+ val resourceId =
+ resources.getIdentifier("config_navBarInteractionMode", "integer", "android")
+ return if (resourceId != 0) {
+ resources.getInteger(resourceId)
+ } else 0
+ }
+
+ fun getBottomPaddingRequired(activity: Activity): Int {
+ val visibleFrame = Rect()
+ activity.window.decorView.getWindowVisibleDisplayFrame(visibleFrame)
+ return visibleFrame.bottom - visibleFrame.top - activity.resources.displayMetrics.heightPixels
+ }
+}