diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FragmentExtensions.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FragmentExtensions.kt index f0f692ecc..ebc808a08 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FragmentExtensions.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FragmentExtensions.kt @@ -19,7 +19,6 @@ package org.kiwix.kiwixmobile.core.extensions import android.content.Context -import android.os.Build import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.Toast @@ -60,9 +59,6 @@ val Fragment.coreMainActivity get() = activity as CoreMainActivity fun Fragment.enableEdgeToEdgeMode() { activity?.window?.let { - WindowCompat.setDecorFitsSystemWindows( - it, - Build.VERSION.SDK_INT < Build.VERSION_CODES.Q - ) + WindowCompat.setDecorFitsSystemWindows(it, false) } } diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ViewExtensions.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ViewExtensions.kt index be377ad3d..e4d3d6c96 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ViewExtensions.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ViewExtensions.kt @@ -19,15 +19,12 @@ package org.kiwix.kiwixmobile.core.extensions import android.annotation.SuppressLint -import android.os.Build import android.view.View import android.view.ViewGroup import android.view.Window -import android.view.WindowManager import androidx.annotation.ColorInt import androidx.appcompat.widget.TooltipCompat import androidx.core.view.ViewCompat -import androidx.core.view.ViewGroupCompat import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat @@ -94,33 +91,19 @@ fun View.setToolTipWithContentDescription(description: String) { fun View.showFullScreenMode(window: Window) { WindowCompat.setDecorFitsSystemWindows(window, false) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - WindowInsetsControllerCompat(window, window.decorView).apply { - hide(WindowInsetsCompat.Type.systemBars()) - hide(WindowInsetsCompat.Type.displayCutout()) - systemBarsBehavior = - WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE - } - } - @Suppress("Deprecation") - window.apply { - addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) - clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) + WindowInsetsControllerCompat(window, window.decorView).apply { + hide(WindowInsetsCompat.Type.systemBars()) + hide(WindowInsetsCompat.Type.displayCutout()) + systemBarsBehavior = + WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE } } fun View.closeFullScreenMode(window: Window) { WindowCompat.setDecorFitsSystemWindows(window, true) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - WindowInsetsControllerCompat(window, window.decorView).apply { - show(WindowInsetsCompat.Type.systemBars()) - show(WindowInsetsCompat.Type.displayCutout()) - } - } - @Suppress("DEPRECATION") - window.apply { - addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) - clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) + WindowInsetsControllerCompat(window, window.decorView).apply { + show(WindowInsetsCompat.Type.systemBars()) + show(WindowInsetsCompat.Type.displayCutout()) } } @@ -137,7 +120,6 @@ fun View.closeFullScreenMode(window: Window) { */ fun View?.applyEdgeToEdgeInsets(shouldAddBottomPadding: Boolean = true) { this?.let { - ViewGroupCompat.installCompatInsetsDispatch(this) ViewCompat.setOnApplyWindowInsetsListener(it) { view, windowInsets -> val insets = windowInsets.getInsets( WindowInsetsCompat.Type.systemBars()