Repository: Automattic/pocket-casts-android
File: modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/HelpFragment.kt (Kotlin)

Code before:
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.settings.status.StatusFragment
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModePan
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModeResize
import au.com.shiftyjelly.pocketcasts.ui.helper.FragmentHostListener
import au.com.shiftyjelly.pocketcasts.views.fragments.BaseFragment
import au.com.shiftyjelly.pocketcasts.views.helper.HasBackstack
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class HelpFragment : BaseFragment(), HasBackstack {
    @Inject
    lateinit var settings: Settings

    private var webView: WebView? = null

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?,
    ) = content {
        AppThemeWithBackground(theme.activeTheme) {
            val density = LocalDensity.current
            val imeInsets = WindowInsets.ime
            val keyboardHeight = with(density) { imeInsets.getBottom(density).toDp() }
            
            val basePadding = 16.dp
            val keyboardPadding = if (keyboardHeight > 0.dp) {
                24.dp
            } else {
                0.dp
            }
            val totalPadding = basePadding + keyboardPadding

            HelpPage(
                activity = requireActivity(),
                onShowLogs = {
                    (requireActivity() as FragmentHostListener).addFragment(LogsFragment())
                },
                onShowStatusPage = {
                    (requireActivity() as FragmentHostListener).addFragment(StatusFragment())
                },
                onGoBack = {
                    @Suppress("DEPRECATION")
                    activity?.onBackPressed()
                },
                onWebViewCreated = { webView = it },
                onWebViewDisposed = { webView = null },
                modifier = Modifier
                    .fillMaxSize()

Review comment (bug):
There's nothing wrong with this but `WindowInsets` already provides API for getting padding. `WindowInsets.ime.asPaddingValues().calculateBottomPadding()`.

Code after:
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.settings.status.StatusFragment
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModePan
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModeResize
import au.com.shiftyjelly.pocketcasts.ui.helper.FragmentHostListener
import au.com.shiftyjelly.pocketcasts.utils.extensions.pxToDp
import au.com.shiftyjelly.pocketcasts.views.fragments.BaseFragment
import au.com.shiftyjelly.pocketcasts.views.helper.HasBackstack
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class HelpFragment : BaseFragment(), HasBackstack {
    @Inject
    lateinit var settings: Settings

    private var webView: WebView? = null

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?,
    ) = content {
        AppThemeWithBackground(theme.activeTheme) {
            val context = LocalContext.current
            val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()

            val bottomPadding by settings.bottomInset.collectAsState(0)
            val miniPlayerPadding = bottomPadding.pxToDp(context).dp

            val basePadding = 16.dp
            val keyboardPadding = if (keyboardHeight > 0.dp) {
                24.dp
            } else {
                0.dp
            }
            val totalPadding = basePadding + keyboardPadding + miniPlayerPadding

            HelpPage(
                activity = requireActivity(),
                onShowLogs = {
                    (requireActivity() as FragmentHostListener).addFragment(LogsFragment())
                },
                onShowStatusPage = {
                    (requireActivity() as FragmentHostListener).addFragment(StatusFragment())
                },
                onGoBack = {
                    @Suppress("DEPRECATION")
                    activity?.onBackPressed()
                },