-
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.
[FEATURE] #50 : EventRegistration Indicator
- Loading branch information
Showing
9 changed files
with
167 additions
and
6 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
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
107 changes: 107 additions & 0 deletions
107
...management/src/main/java/com/wap/wapp/feature/management/event/EventRegistrationScreen.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,107 @@ | ||
package com.wap.wapp.feature.management.event | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.LinearProgressIndicator | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import com.wap.designsystem.WappTheme | ||
import com.wap.designsystem.component.WappTopBar | ||
import com.wap.wapp.feature.management.R | ||
|
||
@Composable | ||
internal fun EventRegistrationScreen( | ||
viewModel: EventRegistrationViewModel = hiltViewModel(), | ||
onBackButtonClicked: () -> Unit, | ||
) { | ||
val snackBarHostState = remember { SnackbarHostState() } | ||
val currentRegistrationState by viewModel.currentRegistrationState.collectAsStateWithLifecycle() | ||
|
||
Scaffold( | ||
snackbarHost = { SnackbarHost(snackBarHostState) }, | ||
containerColor = WappTheme.colors.backgroundBlack, | ||
modifier = Modifier.fillMaxSize(), | ||
) { paddingValues -> | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(paddingValues) // paddingValue padding | ||
.padding(16.dp), // dp value padding | ||
) { | ||
WappTopBar( | ||
titleRes = R.string.event_registration, | ||
showLeftButton = true, | ||
onClickLeftButton = onBackButtonClicked, | ||
) | ||
|
||
EventRegistrationStateIndicator( | ||
eventRegistrationState = currentRegistrationState, | ||
modifier = Modifier.padding(top = 16.dp), | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun EventRegistrationStateIndicator( | ||
eventRegistrationState: EventRegistrationState, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
modifier = modifier, | ||
) { | ||
EventRegistrationStateProgressBar(eventRegistrationState.progress) | ||
EventRegistrationStateText(eventRegistrationState.page) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun EventRegistrationStateText( | ||
currentRegistrationPage: String, | ||
) { | ||
Row { | ||
Text( | ||
text = currentRegistrationPage, | ||
style = WappTheme.typography.contentMedium, | ||
color = WappTheme.colors.yellow, | ||
) | ||
Text( | ||
text = stringResource(R.string.event_registration_total_page), | ||
style = WappTheme.typography.contentMedium, | ||
color = WappTheme.colors.white, | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun EventRegistrationStateProgressBar( | ||
currentRegistrationProgress: Float, | ||
) { | ||
LinearProgressIndicator( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(10.dp), | ||
color = WappTheme.colors.yellow, | ||
progress = currentRegistrationProgress, | ||
strokeCap = StrokeCap.Round, | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
...agement/src/main/java/com/wap/wapp/feature/management/event/EventRegistrationViewModel.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,14 @@ | ||
package com.wap.wapp.feature.management.event | ||
|
||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class EventRegistrationViewModel @Inject constructor() : ViewModel() { | ||
private val _currentRegistrationState: MutableStateFlow<EventRegistrationState> = | ||
MutableStateFlow(EventRegistrationState.EVENT_DETAILS) | ||
val currentRegistrationState = _currentRegistrationState.asStateFlow() | ||
} |
9 changes: 9 additions & 0 deletions
9
...management/src/main/java/com/wap/wapp/feature/management/event/SurveyRegistrationState.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,9 @@ | ||
package com.wap.wapp.feature.management.event | ||
|
||
enum class EventRegistrationState( | ||
val page: String, | ||
val progress: Float, | ||
) { | ||
EVENT_DETAILS("1", 0.5f), | ||
EVENT_SCHEDULE("2", 1.0f), | ||
} |
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