-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8237d8
commit 49b64ff
Showing
48 changed files
with
1,474 additions
and
1,515 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dai/opennote/domain/usecase/Operations.kt → ...ngdai/opennote/domain/usecase/UseCases.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
app/src/main/java/com/yangdai/opennote/presentation/component/AdaptiveNavigationScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.yangdai.opennote.presentation.component | ||
|
||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.material3.DrawerState | ||
import androidx.compose.material3.ModalDrawerSheet | ||
import androidx.compose.material3.ModalNavigationDrawer | ||
import androidx.compose.material3.PermanentDrawerSheet | ||
import androidx.compose.material3.PermanentNavigationDrawer | ||
import androidx.compose.runtime.Composable | ||
|
||
/** | ||
* A composable function that adapts the navigation drawer based on the screen size. | ||
* | ||
* @param isLargeScreen A boolean indicating whether the screen is large or not. | ||
* @param drawerState The state of the drawer. | ||
* @param gesturesEnabled A boolean indicating whether gestures are enabled or not. | ||
* @param drawerContent The content of the drawer. | ||
* @param content The main content. | ||
*/ | ||
@Composable | ||
fun AdaptiveNavigationScreen( | ||
isLargeScreen: Boolean, | ||
drawerState: DrawerState, | ||
gesturesEnabled: Boolean, | ||
drawerContent: @Composable (ColumnScope.() -> Unit), | ||
content: @Composable () -> Unit | ||
) = if (isLargeScreen) { | ||
PermanentNavigationScreen( | ||
drawerContent = drawerContent, | ||
content = content | ||
) | ||
} else { | ||
ModalNavigationScreen( | ||
drawerContent = drawerContent, | ||
drawerState = drawerState, | ||
gesturesEnabled = gesturesEnabled, | ||
content = content | ||
) | ||
} | ||
|
||
@Composable | ||
fun ModalNavigationScreen( | ||
drawerContent: @Composable (ColumnScope.() -> Unit), | ||
drawerState: DrawerState, | ||
gesturesEnabled: Boolean, | ||
content: @Composable () -> Unit | ||
) = ModalNavigationDrawer( | ||
drawerContent = { | ||
ModalDrawerSheet( | ||
drawerState = drawerState, | ||
content = drawerContent | ||
) | ||
}, | ||
drawerState = drawerState, | ||
gesturesEnabled = gesturesEnabled, | ||
content = content | ||
) | ||
|
||
@Composable | ||
fun PermanentNavigationScreen( | ||
drawerContent: @Composable (ColumnScope.() -> Unit), | ||
content: @Composable () -> Unit | ||
) = PermanentNavigationDrawer( | ||
drawerContent = { | ||
PermanentDrawerSheet( | ||
content = drawerContent | ||
) | ||
}, | ||
content = content | ||
) |
Oops, something went wrong.