-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
9 changed files
with
269 additions
and
74 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
45 changes: 45 additions & 0 deletions
45
.../datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubOwnerSection.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,45 @@ | ||
package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.defaultMinSize | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.rounded.Code | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.unit.dp | ||
import dev.datlag.aniflow.SharedRes | ||
import dev.datlag.aniflow.other.Constants | ||
import dev.datlag.tooling.compose.onClick | ||
import dev.icerock.moko.resources.compose.stringResource | ||
|
||
@Composable | ||
fun GitHubOwnerSection( | ||
modifier: Modifier = Modifier, | ||
) { | ||
val uriHandler = LocalUriHandler.current | ||
|
||
Row( | ||
modifier = modifier | ||
.defaultMinSize(minHeight = ButtonDefaults.MinHeight) | ||
.clip(MaterialTheme.shapes.medium) | ||
.onClick { | ||
uriHandler.openUri(Constants.GITHUB_OWNER) | ||
}, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Icon( | ||
imageVector = Icons.Rounded.Code, | ||
contentDescription = null, | ||
) | ||
Text(text = stringResource(SharedRes.strings.developed_by_datlag)) | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...v/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubRepoSection.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,49 @@ | ||
package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.defaultMinSize | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.LocalContentColor | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.unit.dp | ||
import dev.datlag.aniflow.SharedRes | ||
import dev.datlag.aniflow.other.Constants | ||
import dev.datlag.tooling.compose.onClick | ||
import dev.icerock.moko.resources.compose.painterResource | ||
import dev.icerock.moko.resources.compose.stringResource | ||
|
||
@Composable | ||
fun GitHubRepoSection( | ||
modifier: Modifier = Modifier, | ||
) { | ||
val uriHandler = LocalUriHandler.current | ||
|
||
Row( | ||
modifier = modifier | ||
.defaultMinSize(minHeight = ButtonDefaults.MinHeight) | ||
.clip(MaterialTheme.shapes.small) | ||
.onClick { | ||
uriHandler.openUri(Constants.GITHUB_REPO) | ||
}, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Image( | ||
modifier = Modifier.size(24.dp), | ||
painter = painterResource(SharedRes.images.github), | ||
contentDescription = null, | ||
colorFilter = ColorFilter.tint(LocalContentColor.current) | ||
) | ||
Text(text = stringResource(SharedRes.strings.github_repository)) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...in/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/NekosSection.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,60 @@ | ||
package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component | ||
|
||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.defaultMinSize | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.* | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.unit.dp | ||
import dev.datlag.aniflow.SharedRes | ||
import dev.datlag.tooling.compose.onClick | ||
import dev.icerock.moko.resources.compose.painterResource | ||
import dev.icerock.moko.resources.compose.stringResource | ||
|
||
@Composable | ||
fun NekosSection( | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit | ||
) { | ||
var clicked by remember { mutableStateOf(0) } | ||
|
||
Row( | ||
modifier = modifier | ||
.defaultMinSize(minHeight = ButtonDefaults.MinHeight) | ||
.clip(MaterialTheme.shapes.medium) | ||
.onClick { | ||
if (clicked >= 99) { | ||
onClick() | ||
} else { | ||
clicked++ | ||
} | ||
}, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Image( | ||
modifier = Modifier.size(24.dp), | ||
painter = painterResource(SharedRes.images.cat_filled), | ||
contentDescription = null, | ||
colorFilter = ColorFilter.tint(LocalContentColor.current) | ||
) | ||
Text(text = stringResource(SharedRes.strings.nekos_api)) | ||
AnimatedVisibility( | ||
visible = clicked >= 1, | ||
) { | ||
Badge( | ||
containerColor = MaterialTheme.colorScheme.tertiaryContainer | ||
) { | ||
Text(text = "$clicked") | ||
} | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
.../dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/SponsorSection.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,87 @@ | ||
package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.defaultMinSize | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.rounded.Savings | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.unit.dp | ||
import com.maxkeppeker.sheets.core.models.base.Header | ||
import com.maxkeppeker.sheets.core.models.base.IconSource | ||
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState | ||
import com.maxkeppeler.sheets.option.OptionDialog | ||
import com.maxkeppeler.sheets.option.models.DisplayMode | ||
import com.maxkeppeler.sheets.option.models.Option | ||
import com.maxkeppeler.sheets.option.models.OptionConfig | ||
import com.maxkeppeler.sheets.option.models.OptionSelection | ||
import dev.datlag.aniflow.SharedRes | ||
import dev.datlag.aniflow.other.Constants | ||
import dev.datlag.tooling.compose.onClick | ||
import dev.icerock.moko.resources.compose.painterResource | ||
import dev.icerock.moko.resources.compose.stringResource | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun SponsorSection( | ||
modifier: Modifier = Modifier, | ||
) { | ||
val sponsorDialog = rememberUseCaseState() | ||
val uriHandler = LocalUriHandler.current | ||
|
||
OptionDialog( | ||
state = sponsorDialog, | ||
config = OptionConfig( | ||
mode = DisplayMode.LIST | ||
), | ||
selection = OptionSelection.Single( | ||
options = listOf( | ||
Option( | ||
icon = IconSource(painter = painterResource(SharedRes.images.github)), | ||
titleText = stringResource(SharedRes.strings.github) | ||
), | ||
Option( | ||
icon = IconSource(painter = painterResource(SharedRes.images.polar)), | ||
titleText = stringResource(SharedRes.strings.polar) | ||
), | ||
Option( | ||
icon = IconSource(painter = painterResource(SharedRes.images.patreon)), | ||
titleText = stringResource(SharedRes.strings.patreon) | ||
) | ||
), | ||
onSelectOption = { option, _ -> | ||
when (option) { | ||
0 -> uriHandler.openUri(Constants.Sponsor.GITHUB) | ||
1 -> uriHandler.openUri(Constants.Sponsor.POLAR) | ||
2 -> uriHandler.openUri(Constants.Sponsor.PATREON) | ||
} | ||
} | ||
), | ||
header = Header.Default( | ||
title = stringResource(SharedRes.strings.sponsor), | ||
icon = IconSource(imageVector = Icons.Rounded.Savings) | ||
) | ||
) | ||
|
||
Row( | ||
modifier = modifier | ||
.defaultMinSize(minHeight = ButtonDefaults.MinHeight) | ||
.clip(MaterialTheme.shapes.medium) | ||
.onClick { | ||
sponsorDialog.show() | ||
}, | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Icon( | ||
imageVector = Icons.Rounded.Savings, | ||
contentDescription = null, | ||
) | ||
Text(text = stringResource(SharedRes.strings.sponsor)) | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.