-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
26 changed files
with
514 additions
and
59 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
58 changes: 58 additions & 0 deletions
58
...d/src/androidMain/kotlin/dev/datlag/burningseries/shared/ui/custom/ProjectCard.android.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,58 @@ | ||
package dev.datlag.burningseries.shared.ui.custom | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material3.Card | ||
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.platform.LocalContext | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import coil3.compose.AsyncImage | ||
import dev.datlag.burningseries.shared.common.isPackageInstalled | ||
import dev.datlag.burningseries.shared.common.openInBrowser | ||
import dev.datlag.burningseries.shared.other.Project | ||
import dev.icerock.moko.resources.compose.painterResource | ||
import dev.icerock.moko.resources.compose.stringResource | ||
|
||
@Composable | ||
actual fun ProjectCard(project: Project, modifier: Modifier) { | ||
val context = LocalContext.current | ||
|
||
if (context.isPackageInstalled(project.`package`)) { | ||
Card( | ||
modifier = modifier, | ||
onClick = { | ||
(project.googlePlay ?: project.github)?.openInBrowser(context) | ||
} | ||
) { | ||
Row( | ||
modifier = Modifier.padding(16.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
project.icon?.let { | ||
Image( | ||
modifier = Modifier.size(64.dp), | ||
painter = painterResource(it), | ||
contentDescription = stringResource(project.title) | ||
) | ||
} | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Text( | ||
text = stringResource(project.title), | ||
fontWeight = FontWeight.Bold, | ||
style = MaterialTheme.typography.titleLarge | ||
) | ||
Text(text = stringResource(project.subTitle)) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
8 changes: 6 additions & 2 deletions
8
app/shared/src/commonMain/kotlin/dev/datlag/burningseries/shared/other/Constants.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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package dev.datlag.burningseries.shared.other | ||
|
||
data object Constants { | ||
const val PULZ_PACKAGE = "dev.datlag.pulz" | ||
const val GOOGLE_PLAY_PULZ = "https://play.google.com/store/apps/details?id=dev.datlag.pulz" | ||
data object Sponsor { | ||
const val GITHUB = "https://github.com/sponsors/DatL4g" | ||
const val POLAR = "https://polar.sh/DatL4g" | ||
const val PATREON = "https://patreon.com/datlag" | ||
const val PAYPAL = "https://paypal.me/datlag" | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/shared/src/commonMain/kotlin/dev/datlag/burningseries/shared/other/Project.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,26 @@ | ||
package dev.datlag.burningseries.shared.other | ||
|
||
import dev.datlag.burningseries.shared.SharedRes | ||
import dev.icerock.moko.resources.ImageResource | ||
import dev.icerock.moko.resources.StringResource | ||
|
||
sealed interface Project { | ||
|
||
val icon: ImageResource? | ||
val title: StringResource | ||
val subTitle: StringResource | ||
|
||
val `package`: String | ||
val googlePlay: String? | ||
val github: String? | ||
|
||
data object PULZ : Project { | ||
override val icon: ImageResource? = SharedRes.images.PulZ | ||
override val title: StringResource = SharedRes.strings.pulz | ||
override val subTitle: StringResource = SharedRes.strings.pulz_subtitle | ||
|
||
override val `package`: String = "dev.datlag.pulz" | ||
override val googlePlay: String? = "https://play.google.com/store/apps/details?id=$`package`" | ||
override val github: String? = "https://github.com/DatL4g/PulZ" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/shared/src/commonMain/kotlin/dev/datlag/burningseries/shared/ui/custom/ProjectCard.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,8 @@ | ||
package dev.datlag.burningseries.shared.ui.custom | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import dev.datlag.burningseries.shared.other.Project | ||
|
||
@Composable | ||
expect fun ProjectCard(project: Project, modifier: Modifier = Modifier) |
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.
86c15b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks