Repository: android/compose-samples
File: Reply/app/src/main/java/com/example/reply/ui/ReplyApp.kt (Kotlin)

Code before:
     * fold state of the device.
     *
     * In the state of folding device If it's half fold in BookPosture we want to avoid content
     * at the crease/hinge
     */
    val (navigationType, contentType) = when (windowSize) {
        WindowSize.Compact -> {
            Pair(ReplyNavigationType.BOTTOM_NAVIGATION, ReplyContentType.LIST_ONLY)
        }
        WindowSize.Medium -> {
            if (foldingDevicePosture != DevicePosture.NormalPosture) {
                Pair(ReplyNavigationType.NAVIGATION_RAIL, ReplyContentType.LIST_AND_DETAIL)
            } else {
                Pair(ReplyNavigationType.NAVIGATION_RAIL, ReplyContentType.LIST_ONLY)
            }
        }
        WindowSize.Expanded -> {
            if (foldingDevicePosture is DevicePosture.BookPosture) {
                Pair(ReplyNavigationType.NAVIGATION_RAIL, ReplyContentType.LIST_AND_DETAIL)
            } else {
                Pair(ReplyNavigationType.FIXED_NAVIGATION_DRAWER, ReplyContentType.LIST_AND_DETAIL)
            }
        }
    }

    if (navigationType == ReplyNavigationType.FIXED_NAVIGATION_DRAWER) {
        PermanentNavigationDrawer(drawerContent = {}) {
            ReplyAppContent(navigationType, contentType)
        }
    } else {
        ModalNavigationDrawer(drawerContent = {}) {
            ReplyAppContent(navigationType, contentType)
        }
    }
}

@Composable
fun ReplyAppContent(navigationType: ReplyNavigationType, contentType: ReplyContentType) {
    Row(modifier = Modifier
        .fillMaxSize()) {
        if (navigationType == ReplyNavigationType.NAVIGATION_RAIL) {
            //ReplyNavigationRail()
        }
        Column(modifier = Modifier.fillMaxSize()) {
            if (contentType == ReplyContentType.LIST_AND_DETAIL) {
                // ReplyListAndDetailContent()
            } else {
                // ReplyListContent()
            }
            if (navigationType == ReplyNavigationType.BOTTOM_NAVIGATION) {
                //ReplyBottomNavigation()

Review comment (suggestion):
I think the code from here onwards needs some `TODO` comments so we know what's still coming i.t.o navigation component implementations

Code after:
     * In the state of folding device If it's half fold in BookPosture we want to avoid content
     * at the crease/hinge
     */
    val navigationType: ReplyNavigationType
    val contentType: ReplyContentType
    when (windowSize) {
        WindowSize.COMPACT -> {
            navigationType = ReplyNavigationType.BOTTOM_NAVIGATION
            contentType = ReplyContentType.LIST_ONLY
        }
        WindowSize.MEDIUM -> {
            navigationType = ReplyNavigationType.NAVIGATION_RAIL
            contentType = if (foldingDevicePosture != DevicePosture.NormalPosture) {
                ReplyContentType.LIST_AND_DETAIL
            } else {
                ReplyContentType.LIST_ONLY
            }
        }
        WindowSize.EXPANDED -> {
            navigationType = if (foldingDevicePosture is DevicePosture.BookPosture) {
                ReplyNavigationType.NAVIGATION_RAIL
            } else {
                ReplyNavigationType.PERMANENT_NAVIGATION_DRAWER
            }
            contentType = ReplyContentType.LIST_AND_DETAIL
        }
    }

    if (navigationType == ReplyNavigationType.PERMANENT_NAVIGATION_DRAWER) {
        PermanentNavigationDrawer(drawerContent = {}) {
            ReplyAppContent(navigationType, contentType)
        }
    } else {
        ModalNavigationDrawer(drawerContent = {}) {
            ReplyAppContent(navigationType, contentType)
        }
    }
}

@Composable
fun ReplyAppContent(navigationType: ReplyNavigationType, contentType: ReplyContentType) {
    Row(modifier = Modifier
        .fillMaxSize()) {
        if (navigationType == ReplyNavigationType.NAVIGATION_RAIL) {
            // TODO ReplyNavigationRail()
        }
        Column(modifier = Modifier.fillMaxSize()) {
            if (contentType == ReplyContentType.LIST_AND_DETAIL) {
                // TODO ReplyListAndDetailContent()
            } else {
                // TODO ReplyListContent()