Bet result page
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
e554c57ef9
commit
3c5545bdb6
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
store=keys/keystore.jks
|
||||
password=placeYourBets
|
Binary file not shown.
@ -1,21 +1,28 @@
|
||||
package fr.iut.alldev.allin.vo.bet.visitor
|
||||
package fr.iut.alldev.allin.vo.bet.displayer
|
||||
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import fr.iut.alldev.allin.data.model.bet.CustomBet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import fr.iut.alldev.allin.test.TestTags
|
||||
import fr.iut.alldev.allin.vo.bet.BetDisplayer
|
||||
|
||||
class BetTestVisitor : DisplayBetVisitor {
|
||||
class BetTestDisplayer : BetDisplayer {
|
||||
@Composable
|
||||
override fun VisitYesNoBet(b: YesNoBet) {
|
||||
override fun DisplayYesNoBet(b: YesNoBet) {
|
||||
Text("This is a YesNo Bet", Modifier.testTag(TestTags.YES_NO_BET.tag))
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun VisitMatchBet(b: MatchBet) {
|
||||
override fun DisplayMatchBet(b: MatchBet) {
|
||||
Text("This is a Match Bet", Modifier.testTag(TestTags.MATCH_BET.tag))
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun DisplayCustomBet(b: CustomBet) {
|
||||
Text("This is a Custom Bet", Modifier.testTag(TestTags.CUSTOM_BET.tag))
|
||||
}
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package fr.iut.alldev.allin.ui.betResult
|
||||
|
||||
import androidx.compose.foundation.MarqueeSpacing
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.basicMarquee
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.SheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import fr.iut.alldev.allin.R
|
||||
import fr.iut.alldev.allin.data.ext.formatToMediumDateNoYear
|
||||
import fr.iut.alldev.allin.data.ext.formatToTime
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.betResult.components.BetResultBottomSheetBetCard
|
||||
import fr.iut.alldev.allin.ui.betResult.components.BetResultBottomSheetContentCoinAmount
|
||||
import fr.iut.alldev.allin.ui.betResult.components.BetResultBottomSheetContentCongratulations
|
||||
import fr.iut.alldev.allin.ui.core.AllInBottomSheet
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheet(
|
||||
state: SheetState,
|
||||
sheetVisibility: Boolean,
|
||||
username: String,
|
||||
coinAmount: Int,
|
||||
bet: Bet,
|
||||
stake: Int,
|
||||
winnings: Int,
|
||||
odds: Float,
|
||||
onDismiss: () -> Unit
|
||||
) {
|
||||
AllInBottomSheet(
|
||||
sheetVisibility = sheetVisibility,
|
||||
onDismiss = onDismiss,
|
||||
state = state,
|
||||
dragHandle = null
|
||||
) {
|
||||
BetResultBottomSheetContent(
|
||||
username = username,
|
||||
coinAmount = coinAmount,
|
||||
bet = bet,
|
||||
stake = stake,
|
||||
winnings = winnings,
|
||||
odds = odds,
|
||||
onClose = onDismiss
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheetContent(
|
||||
username: String,
|
||||
coinAmount: Int,
|
||||
bet: Bet,
|
||||
stake: Int,
|
||||
winnings: Int,
|
||||
odds: Float,
|
||||
onClose: () -> Unit
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(AllInTheme.colors.allInMainGradientReverse),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.allin_marquee),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.rotate(11f)
|
||||
.scale(1.2f)
|
||||
.offset(x = (-24).dp)
|
||||
.basicMarquee(spacing = MarqueeSpacing(0.dp)),
|
||||
tint = AllInTheme.colors.white.copy(alpha = .05f)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onClose,
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.align(Alignment.TopStart)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
tint = AllInTheme.colors.white,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
}
|
||||
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.allin),
|
||||
contentDescription = null,
|
||||
tint = AllInTheme.colors.white,
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.align(Alignment.TopCenter)
|
||||
)
|
||||
|
||||
Column(
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
verticalArrangement = Arrangement.spacedBy(48.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
|
||||
BetResultBottomSheetContentCongratulations(username = username)
|
||||
BetResultBottomSheetContentCoinAmount(amount = coinAmount)
|
||||
BetResultBottomSheetBetCard(
|
||||
title = bet.phrase,
|
||||
creator = bet.creator,
|
||||
category = bet.theme,
|
||||
date = bet.endBetDate.formatToMediumDateNoYear(),
|
||||
time = bet.endBetDate.formatToTime(),
|
||||
status = bet.betStatus,
|
||||
stake = stake,
|
||||
winnings = winnings,
|
||||
odds = odds
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Preview(widthDp = 800, heightDp = 1280)
|
||||
@Composable
|
||||
private fun BetResultBottomSheetContentPreview() {
|
||||
AllInTheme {
|
||||
BetResultBottomSheetContent(
|
||||
username = "Pseudo",
|
||||
coinAmount = 3976,
|
||||
bet = YesNoBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = BetStatus.InProgress,
|
||||
creator = "creator",
|
||||
),
|
||||
stake = 4175,
|
||||
winnings = 2600,
|
||||
odds = 6.7f
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package fr.iut.alldev.allin.ui.betResult.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import fr.iut.alldev.allin.data.model.bet.BetFinishedStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.core.bet.BetCard
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheetBetCard(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
creator: String,
|
||||
category: String,
|
||||
date: String,
|
||||
time: String,
|
||||
status: BetStatus,
|
||||
stake: Int,
|
||||
winnings: Int,
|
||||
odds: Float
|
||||
) {
|
||||
BetCard(
|
||||
title = title,
|
||||
creator = creator,
|
||||
category = category,
|
||||
date = date,
|
||||
time = time,
|
||||
status = status,
|
||||
modifier = modifier
|
||||
) {
|
||||
BetResultBottomSheetBetCardStats(
|
||||
stake = stake,
|
||||
winnings = winnings,
|
||||
odds = odds
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun BetResultBottomSheetBetCardPreview() {
|
||||
AllInTheme {
|
||||
BetResultBottomSheetBetCard(
|
||||
creator = "Creator",
|
||||
category = "Category",
|
||||
title = "Title",
|
||||
date = "Date",
|
||||
time = "Time",
|
||||
status = BetStatus.Finished(BetFinishedStatus.WON),
|
||||
stake = 2446,
|
||||
winnings = 6930,
|
||||
odds = 2.3f
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package fr.iut.alldev.allin.ui.betResult.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import fr.iut.alldev.allin.R
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.core.AllInCard
|
||||
import fr.iut.alldev.allin.ui.core.AllInCoinCount
|
||||
import fr.iut.alldev.allin.ui.core.IconPosition
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheetBetCardStats(
|
||||
stake: Int,
|
||||
winnings: Int,
|
||||
odds: Float
|
||||
) {
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.background(AllInTheme.themeColors.background2)
|
||||
.padding(horizontal = 19.dp, vertical = 11.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.bet_result_stake),
|
||||
style = AllInTheme.typography.sm2,
|
||||
color = AllInTheme.themeColors.onMainSurface
|
||||
)
|
||||
|
||||
AllInCoinCount(
|
||||
amount = stake,
|
||||
color = AllInTheme.colors.allInPurple,
|
||||
textStyle = AllInTheme.typography.sm1,
|
||||
position = IconPosition.TRAILING
|
||||
)
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.bet_result_winnings),
|
||||
style = AllInTheme.typography.sm2,
|
||||
color = AllInTheme.colors.allInPurple
|
||||
)
|
||||
AllInCoinCount(
|
||||
amount = winnings,
|
||||
textStyle = AllInTheme.typography.sm1,
|
||||
brush = AllInTheme.colors.allInMainGradient,
|
||||
position = IconPosition.TRAILING
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.bet_result_odds),
|
||||
style = AllInTheme.typography.sm2,
|
||||
color = AllInTheme.themeColors.onBackground2
|
||||
)
|
||||
AllInCard(
|
||||
radius = 8.dp,
|
||||
backgroundBrush = AllInTheme.colors.allInMainGradient
|
||||
) {
|
||||
Box(Modifier.padding(vertical = 4.dp, horizontal = 8.dp)) {
|
||||
Text(
|
||||
text = "$odds",
|
||||
style = AllInTheme.typography.sm1,
|
||||
color = AllInTheme.colors.white
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun BetResultBottomSheetBetCardStatsPreview() {
|
||||
AllInTheme {
|
||||
BetResultBottomSheetBetCardStats(
|
||||
stake = 2446,
|
||||
winnings = 6930,
|
||||
odds = 2.3f
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package fr.iut.alldev.allin.ui.betResult.components
|
||||
|
||||
import androidx.compose.animation.core.RepeatMode
|
||||
import androidx.compose.animation.core.animateFloat
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import fr.iut.alldev.allin.R
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheetContentCongratulations(
|
||||
modifier: Modifier = Modifier,
|
||||
username: String
|
||||
) {
|
||||
val infiniteTransition = rememberInfiniteTransition(label = "")
|
||||
|
||||
val rotation by infiniteTransition.animateFloat(
|
||||
initialValue = -11f,
|
||||
targetValue = -5f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(900),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
), label = ""
|
||||
)
|
||||
|
||||
val scale by infiniteTransition.animateFloat(
|
||||
initialValue = 1f,
|
||||
targetValue = .9f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(900),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
), label = ""
|
||||
)
|
||||
|
||||
Row(
|
||||
modifier = modifier
|
||||
.rotate(rotation)
|
||||
.scale(scale),
|
||||
verticalAlignment = Alignment.Top,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Text(
|
||||
text= stringResource(id = R.string.bet_result_congratulations),
|
||||
style = AllInTheme.typography.h1,
|
||||
fontSize = 25.sp,
|
||||
fontStyle = FontStyle.Italic,
|
||||
color = AllInTheme.colors.white
|
||||
)
|
||||
Text(
|
||||
text = "${username.uppercase()} !",
|
||||
style = AllInTheme.typography.h1,
|
||||
fontSize = 30.sp,
|
||||
fontStyle = FontStyle.Italic,
|
||||
color = AllInTheme.colors.white
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package fr.iut.alldev.allin.ui.betResult.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import fr.iut.alldev.allin.R
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.core.AllInCoinCount
|
||||
import fr.iut.alldev.allin.ui.core.IconPosition
|
||||
|
||||
@Composable
|
||||
fun BetResultBottomSheetContentCoinAmount(
|
||||
modifier: Modifier = Modifier,
|
||||
amount: Int
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(14.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.bet_result_you_win),
|
||||
style = AllInTheme.typography.sm2,
|
||||
color = AllInTheme.colors.white,
|
||||
fontSize = 20.sp
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier
|
||||
.border(
|
||||
width = 2.dp,
|
||||
shape = RoundedCornerShape(100.dp),
|
||||
color = AllInTheme.colors.white
|
||||
)
|
||||
.padding(vertical = 22.dp, horizontal = 33.dp)
|
||||
|
||||
) {
|
||||
AllInCoinCount(
|
||||
amount = amount,
|
||||
textStyle = AllInTheme.typography.h1,
|
||||
position = IconPosition.TRAILING,
|
||||
color = AllInTheme.colors.white,
|
||||
size = 60,
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.offset(y = (-6).dp)
|
||||
)
|
||||
AllInCoinCount(
|
||||
amount = amount,
|
||||
textStyle = AllInTheme.typography.h1,
|
||||
position = IconPosition.TRAILING,
|
||||
color = AllInTheme.colors.white.copy(alpha = .32f),
|
||||
size = 60,
|
||||
modifier = Modifier.align(Alignment.Center)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun BetResultBottomSheetContentCoinAmountPreview() {
|
||||
AllInTheme {
|
||||
BetResultBottomSheetContentCoinAmount(amount = 1572)
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package fr.iut.alldev.allin.ui.core
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.graphics.BlendMode
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.CompositingStrategy
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
|
||||
@Composable
|
||||
fun Icon(
|
||||
painter: Painter,
|
||||
contentDescription: String?,
|
||||
modifier: Modifier = Modifier,
|
||||
tint: Color = LocalContentColor.current,
|
||||
brush: Brush? = null,
|
||||
) {
|
||||
Icon(
|
||||
painter = painter,
|
||||
contentDescription = contentDescription,
|
||||
modifier = brush?.let {
|
||||
modifier
|
||||
.graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }
|
||||
.drawWithCache {
|
||||
onDrawWithContent {
|
||||
drawContent()
|
||||
drawRect(brush, blendMode = BlendMode.SrcAtop)
|
||||
}
|
||||
}
|
||||
} ?: modifier,
|
||||
tint = tint
|
||||
)
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package fr.iut.alldev.allin.ui.core.bet
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.ext.getDateStartLabelId
|
||||
import fr.iut.alldev.allin.theme.AllInTheme
|
||||
import fr.iut.alldev.allin.ui.core.AllInCard
|
||||
|
||||
@Composable
|
||||
fun BetCard(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
creator: String,
|
||||
category: String,
|
||||
date: String,
|
||||
time: String,
|
||||
status: BetStatus,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
AllInCard(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
radius = 16.dp
|
||||
) {
|
||||
Column(
|
||||
Modifier.padding(horizontal = 19.dp, vertical = 11.dp)
|
||||
) {
|
||||
BetTitleHeader(
|
||||
title = title,
|
||||
category = category,
|
||||
creator = creator,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(11.dp))
|
||||
BetDateTimeRow(
|
||||
label = stringResource(id = status.getDateStartLabelId()),
|
||||
date = date,
|
||||
time = time
|
||||
)
|
||||
}
|
||||
HorizontalDivider(
|
||||
thickness = 1.dp,
|
||||
color = AllInTheme.themeColors.border
|
||||
)
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun BetCardPreview() {
|
||||
AllInTheme {
|
||||
BetCard(
|
||||
creator = "Creator",
|
||||
category = "Category",
|
||||
title = "Title",
|
||||
date = "Date",
|
||||
time = "Time",
|
||||
status = BetStatus.Waiting
|
||||
){
|
||||
Text("Content")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package fr.iut.alldev.allin.ui.preview
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.BetFinishedStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.CustomBet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
class BetPreviewProvider: PreviewParameterProvider<Bet> {
|
||||
override val values = sequenceOf(
|
||||
YesNoBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = BetStatus.Finished(BetFinishedStatus.WON),
|
||||
creator = "creator"
|
||||
),
|
||||
MatchBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = BetStatus.Finished(BetFinishedStatus.WON),
|
||||
creator = "creator",
|
||||
nameTeam1 = "The Monarchs",
|
||||
nameTeam2 = "Climate Change"
|
||||
),
|
||||
CustomBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = BetStatus.Finished(BetFinishedStatus.WON),
|
||||
creator = "creator",
|
||||
possibleAnswers = setOf(
|
||||
"Answer 1",
|
||||
"Answer 2",
|
||||
"Answer 3",
|
||||
"Answer 4"
|
||||
)
|
||||
|
||||
),
|
||||
)
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package fr.iut.alldev.allin.ui.preview
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import fr.iut.alldev.allin.data.model.bet.BetFinishedStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
|
||||
class BetStatusPreviewProvider: PreviewParameterProvider<BetStatus> {
|
||||
override val values = sequenceOf(
|
||||
BetStatus.InProgress,
|
||||
BetStatus.Waiting,
|
||||
BetStatus.Finished(BetFinishedStatus.WON),
|
||||
BetStatus.Finished(BetFinishedStatus.LOST)
|
||||
)
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package fr.iut.alldev.allin.ui.preview
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
|
||||
class BetStatusPreviewProvider : PreviewParameterProvider<BetStatus> {
|
||||
override val values = BetStatus.entries
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package fr.iut.alldev.allin.ui.preview
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.BetStatus
|
||||
import fr.iut.alldev.allin.data.model.bet.CustomBet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
|
||||
class BetWithStatusPreviewProvider : PreviewParameterProvider<Bet> {
|
||||
override val values = BetStatus.entries.flatMap { status ->
|
||||
sequenceOf(
|
||||
YesNoBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = status,
|
||||
creator = "creator"
|
||||
),
|
||||
MatchBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = status,
|
||||
creator = "creator",
|
||||
nameTeam1 = "The Monarchs",
|
||||
nameTeam2 = "Climate Change"
|
||||
),
|
||||
CustomBet(
|
||||
theme = "Theme",
|
||||
phrase = "Phrase",
|
||||
endRegisterDate = ZonedDateTime.now(),
|
||||
endBetDate = ZonedDateTime.now(),
|
||||
isPublic = true,
|
||||
betStatus = status,
|
||||
creator = "creator",
|
||||
possibleAnswers = setOf(
|
||||
"Answer 1",
|
||||
"Answer 2",
|
||||
"Answer 3",
|
||||
"Answer 4"
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package fr.iut.alldev.allin.vo
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
interface ViewObject<V : Visitor>{
|
||||
@Composable
|
||||
fun Accept(v: V)
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
package fr.iut.alldev.allin.vo
|
||||
|
||||
interface Visitor
|
@ -0,0 +1,27 @@
|
||||
package fr.iut.alldev.allin.vo.bet
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.CustomBet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
|
||||
interface BetDisplayer {
|
||||
@Composable
|
||||
fun DisplayBet(bet: Bet){
|
||||
when(bet){
|
||||
is CustomBet -> DisplayCustomBet(bet)
|
||||
is MatchBet -> DisplayMatchBet(bet)
|
||||
is YesNoBet -> DisplayYesNoBet(bet)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DisplayYesNoBet(b: YesNoBet)
|
||||
|
||||
@Composable
|
||||
fun DisplayMatchBet(b: MatchBet)
|
||||
|
||||
@Composable
|
||||
fun DisplayCustomBet(b: CustomBet)
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package fr.iut.alldev.allin.vo.bet
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import fr.iut.alldev.allin.vo.ViewObject
|
||||
import fr.iut.alldev.allin.vo.bet.visitor.DisplayBetVisitor
|
||||
|
||||
abstract class BetVO<T: Bet>(val bet: T)
|
||||
: ViewObject<DisplayBetVisitor> {
|
||||
@Composable
|
||||
abstract override fun Accept(v: DisplayBetVisitor)
|
||||
}
|
||||
|
||||
class YesNoBetVO(bet: YesNoBet) : BetVO<YesNoBet>(bet){
|
||||
@Composable
|
||||
override fun Accept(v: DisplayBetVisitor){
|
||||
v.VisitYesNoBet(b = bet)
|
||||
}
|
||||
}
|
||||
|
||||
class MatchBetVO(bet: MatchBet) : BetVO<MatchBet>(bet){
|
||||
@Composable
|
||||
override fun Accept(v: DisplayBetVisitor){
|
||||
v.VisitMatchBet(b = bet)
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package fr.iut.alldev.allin.vo.bet.factory
|
||||
|
||||
import fr.iut.alldev.allin.data.model.bet.Bet
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import fr.iut.alldev.allin.vo.bet.BetVO
|
||||
import fr.iut.alldev.allin.vo.bet.MatchBetVO
|
||||
import fr.iut.alldev.allin.vo.bet.YesNoBetVO
|
||||
|
||||
private val betTypeToVOMap = mapOf(
|
||||
YesNoBet::class.java to YesNoBetVOFactory(),
|
||||
MatchBet::class.java to MatchBetVOFactory()
|
||||
)
|
||||
abstract class BetVOFactory<out T : Bet> {
|
||||
abstract fun create(bet: @UnsafeVariance T): BetVO<@UnsafeVariance T>
|
||||
}
|
||||
|
||||
class YesNoBetVOFactory : BetVOFactory<YesNoBet>() {
|
||||
override fun create(bet: YesNoBet) =
|
||||
YesNoBetVO(bet)
|
||||
}
|
||||
|
||||
class MatchBetVOFactory : BetVOFactory<MatchBet>() {
|
||||
override fun create(bet: MatchBet) =
|
||||
MatchBetVO(bet)
|
||||
}
|
||||
|
||||
fun Bet.toBetVO() = betTypeToVOMap[this.javaClass]?.create(this)
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
package fr.iut.alldev.allin.vo.bet.visitor
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import fr.iut.alldev.allin.data.model.bet.MatchBet
|
||||
import fr.iut.alldev.allin.data.model.bet.YesNoBet
|
||||
import fr.iut.alldev.allin.vo.Visitor
|
||||
|
||||
|
||||
interface DisplayBetVisitor : Visitor {
|
||||
@Composable
|
||||
fun VisitYesNoBet(b: YesNoBet)
|
||||
|
||||
@Composable
|
||||
fun VisitMatchBet(b: MatchBet)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<array name="com_google_android_gms_fonts_certs">
|
||||
<item>@array/com_google_android_gms_fonts_certs_dev</item>
|
||||
<item>@array/com_google_android_gms_fonts_certs_prod</item>
|
||||
</array>
|
||||
<string-array name="com_google_android_gms_fonts_certs_dev">
|
||||
<item>
|
||||
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCS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vcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
|
||||
</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -1,12 +1,8 @@
|
||||
package fr.iut.alldev.allin.data.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module(includes = [ReleaseNetworkModule::class])
|
||||
@InstallIn(SingletonComponent::class)
|
||||
|
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
debugStoreFile=../keys/debug.keystore
|
||||
releaseStoreFile=../keys/release.keystore
|
||||
aliasRelease=placeYourBets
|
||||
passwordRelease=placeYourBets
|
Binary file not shown.
Loading…
Reference in new issue