Loading feature/navigation/drawer/dropdown/src/main/kotlin/net/thunderbird/feature/navigation/drawer/dropdown/ui/DrawerContent.kt +2 −26 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.displayCutout import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.statusBars Loading @@ -12,25 +11,18 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.DividerHorizontal import app.k9mail.core.ui.compose.designsystem.atom.Surface import net.thunderbird.feature.navigation.drawer.dropdown.ui.DrawerContract.Event import net.thunderbird.feature.navigation.drawer.dropdown.ui.DrawerContract.State import net.thunderbird.feature.navigation.drawer.dropdown.ui.account.AccountList import net.thunderbird.feature.navigation.drawer.dropdown.ui.account.AccountView import net.thunderbird.feature.navigation.drawer.dropdown.ui.common.DRAWER_WIDTH import net.thunderbird.feature.navigation.drawer.dropdown.ui.common.getAdditionalWidth import net.thunderbird.feature.navigation.drawer.dropdown.ui.folder.FolderList import net.thunderbird.feature.navigation.drawer.dropdown.ui.setting.SettingList // As long as we use DrawerLayout, we don't have to worry about screens narrower than DRAWER_WIDTH. DrawerLayout will // automatically limit the width of the content view so there's still room for a scrim with minimum tap width. private val DRAWER_WIDTH = 360.dp @Composable internal fun DrawerContent( state: State, Loading Loading @@ -94,19 +86,3 @@ internal fun DrawerContent( } } } @Composable fun getAdditionalWidth(): Dp { val density = LocalDensity.current val layoutDirection = LocalLayoutDirection.current val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl return if (isRtl) { WindowInsets.displayCutout.getRight(density = density, layoutDirection = layoutDirection) } else { WindowInsets.displayCutout.getLeft(density = density, layoutDirection = layoutDirection) }.pxToDp() } @Composable fun Int.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() } feature/navigation/drawer/dropdown/src/main/kotlin/net/thunderbird/feature/navigation/drawer/dropdown/ui/common/DrawerUtil.kt 0 → 100644 +30 −0 Original line number Diff line number Diff line package net.thunderbird.feature.navigation.drawer.dropdown.ui.common import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.displayCutout import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp // As long as we use DrawerLayout, we don't have to worry about screens narrower than DRAWER_WIDTH. DrawerLayout will // automatically limit the width of the content view so there's still room for a scrim with minimum tap width. internal val DRAWER_WIDTH = 360.dp @Composable internal fun getAdditionalWidth(): Dp { val density = LocalDensity.current val layoutDirection = LocalLayoutDirection.current val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl return if (isRtl) { WindowInsets.displayCutout.getRight(density = density, layoutDirection = layoutDirection) } else { WindowInsets.displayCutout.getLeft(density = density, layoutDirection = layoutDirection) }.pxToDp() } @Composable private fun Int.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() } Loading
feature/navigation/drawer/dropdown/src/main/kotlin/net/thunderbird/feature/navigation/drawer/dropdown/ui/DrawerContent.kt +2 −26 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.displayCutout import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.statusBars Loading @@ -12,25 +11,18 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.DividerHorizontal import app.k9mail.core.ui.compose.designsystem.atom.Surface import net.thunderbird.feature.navigation.drawer.dropdown.ui.DrawerContract.Event import net.thunderbird.feature.navigation.drawer.dropdown.ui.DrawerContract.State import net.thunderbird.feature.navigation.drawer.dropdown.ui.account.AccountList import net.thunderbird.feature.navigation.drawer.dropdown.ui.account.AccountView import net.thunderbird.feature.navigation.drawer.dropdown.ui.common.DRAWER_WIDTH import net.thunderbird.feature.navigation.drawer.dropdown.ui.common.getAdditionalWidth import net.thunderbird.feature.navigation.drawer.dropdown.ui.folder.FolderList import net.thunderbird.feature.navigation.drawer.dropdown.ui.setting.SettingList // As long as we use DrawerLayout, we don't have to worry about screens narrower than DRAWER_WIDTH. DrawerLayout will // automatically limit the width of the content view so there's still room for a scrim with minimum tap width. private val DRAWER_WIDTH = 360.dp @Composable internal fun DrawerContent( state: State, Loading Loading @@ -94,19 +86,3 @@ internal fun DrawerContent( } } } @Composable fun getAdditionalWidth(): Dp { val density = LocalDensity.current val layoutDirection = LocalLayoutDirection.current val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl return if (isRtl) { WindowInsets.displayCutout.getRight(density = density, layoutDirection = layoutDirection) } else { WindowInsets.displayCutout.getLeft(density = density, layoutDirection = layoutDirection) }.pxToDp() } @Composable fun Int.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() }
feature/navigation/drawer/dropdown/src/main/kotlin/net/thunderbird/feature/navigation/drawer/dropdown/ui/common/DrawerUtil.kt 0 → 100644 +30 −0 Original line number Diff line number Diff line package net.thunderbird.feature.navigation.drawer.dropdown.ui.common import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.displayCutout import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp // As long as we use DrawerLayout, we don't have to worry about screens narrower than DRAWER_WIDTH. DrawerLayout will // automatically limit the width of the content view so there's still room for a scrim with minimum tap width. internal val DRAWER_WIDTH = 360.dp @Composable internal fun getAdditionalWidth(): Dp { val density = LocalDensity.current val layoutDirection = LocalLayoutDirection.current val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl return if (isRtl) { WindowInsets.displayCutout.getRight(density = density, layoutDirection = layoutDirection) } else { WindowInsets.displayCutout.getLeft(density = density, layoutDirection = layoutDirection) }.pxToDp() } @Composable private fun Int.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() }