-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
755 additions
and
502 deletions.
There are no files selected for viewing
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
72 changes: 72 additions & 0 deletions
72
app/src/main/java/io/github/skydynamic/maiproberplus/ui/component/WindowInsetsSpacer.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,72 @@ | ||
package io.github.skydynamic.maiproberplus.ui.component | ||
|
||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.calculateEndPadding | ||
import androidx.compose.foundation.layout.calculateStartPadding | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.Dp | ||
import io.github.skydynamic.maiproberplus.Application.Companion.application | ||
import io.github.skydynamic.maiproberplus.GlobalViewModel | ||
|
||
object WindowInsetsSpacer { | ||
val topPadding: Dp | ||
get() = GlobalViewModel.windowInsetsPadding | ||
.calculateTopPadding() | ||
|
||
val bottomPadding: Dp | ||
get() = GlobalViewModel.windowInsetsPadding | ||
.calculateBottomPadding() | ||
|
||
val startPadding: Dp | ||
@Composable | ||
get() = GlobalViewModel.windowInsetsPadding | ||
.calculateStartPadding( | ||
application.layoutDirection | ||
) | ||
|
||
val endPadding: Dp | ||
@Composable | ||
get() = GlobalViewModel.windowInsetsPadding | ||
.calculateEndPadding( | ||
application.layoutDirection | ||
) | ||
|
||
@Composable | ||
fun StartPaddingSpacer( | ||
modifier: Modifier = Modifier | ||
) { | ||
Spacer( | ||
modifier.width(startPadding) | ||
) | ||
} | ||
|
||
@Composable | ||
fun EndPaddingSpacer( | ||
modifier: Modifier = Modifier | ||
) { | ||
Spacer( | ||
modifier.width(endPadding) | ||
) | ||
} | ||
|
||
@Composable | ||
fun TopPaddingSpacer( | ||
modifier: Modifier = Modifier | ||
) { | ||
Spacer( | ||
modifier.height(topPadding) | ||
) | ||
} | ||
|
||
@Composable | ||
fun BottomPaddingSpacer( | ||
modifier: Modifier = Modifier | ||
) { | ||
Spacer( | ||
modifier.height(bottomPadding) | ||
) | ||
} | ||
} |
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
Oops, something went wrong.