forked from geode-sdk/android-launcher
fix inset padding on android 16+
This commit is contained in:
2 files changed
+31
-2
No files matched your search
@@ -20,7 +20,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.geode.launcher"
|
applicationId = "com.geode.launcher"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 35
|
targetSdk = 36
|
||||||
versionCode = 23
|
versionCode = 23
|
||||||
versionName = "1.7.0"
|
versionName = "1.7.0"
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.os.Environment
|
|||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowInsets
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
@@ -22,6 +23,7 @@ import androidx.compose.ui.platform.ComposeView
|
|||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import com.customRobTop.BaseRobTopActivity
|
import com.customRobTop.BaseRobTopActivity
|
||||||
import com.customRobTop.JniToCpp
|
import com.customRobTop.JniToCpp
|
||||||
import com.geode.launcher.main.LaunchNotification
|
import com.geode.launcher.main.LaunchNotification
|
||||||
@@ -185,7 +187,34 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
|||||||
|
|
||||||
loadInternalMods()
|
loadInternalMods()
|
||||||
|
|
||||||
setContentView(createView())
|
val baseView = createView()
|
||||||
|
|
||||||
|
if (!GeodeUtils.handleSafeArea && Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
|
||||||
|
val frameLayoutParams = ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
val frameLayout = FrameLayout(this)
|
||||||
|
frameLayout.layoutParams = frameLayoutParams
|
||||||
|
|
||||||
|
frameLayout.setOnApplyWindowInsetsListener { v, insets ->
|
||||||
|
val displayInsets = insets.displayCutout
|
||||||
|
if (displayInsets != null) {
|
||||||
|
v.updatePadding(
|
||||||
|
left = displayInsets.safeInsetLeft,
|
||||||
|
top = displayInsets.safeInsetTop,
|
||||||
|
right = displayInsets.safeInsetRight,
|
||||||
|
bottom = displayInsets.safeInsetBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
WindowInsets.CONSUMED
|
||||||
|
}
|
||||||
|
|
||||||
|
frameLayout.addView(baseView)
|
||||||
|
setContentView(frameLayout)
|
||||||
|
} else {
|
||||||
|
setContentView(baseView)
|
||||||
|
}
|
||||||
|
|
||||||
setupPostLibraryLoad(gdPackageInfo)
|
setupPostLibraryLoad(gdPackageInfo)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user