mirror of
				https://github.com/AdrianKuta/KahootQuiz.git
				synced 2025-10-31 00:43:40 +01:00 
			
		
		
		
	Refactor: Clean up imports and formatting in UI components
This commit addresses minor code style issues by removing unused imports and standardizing formatting across several UI components within the `ui:quiz` module.
Key changes:
- **`ui/quiz/QuizScreen.kt`**:
    - Added `modifier` parameter to `QuizScreenLoading`'s `CircularProgressIndicator`.
- **`ui/quiz/QuizScreenViewModel.kt`**:
    - Improved code formatting for readability, particularly around `timerState` updates and retrieving question times.
- **`ui/quiz/components/TimerBar.kt`**:
    - Removed unused import `androidx.compose.ui.draw.clipToBounds`.
- **`ui/quiz/components/QuestionContent.kt`**:
    - Reordered imports alphabetically.
- **`ui/quiz/components/Choices.kt`**:
    - Removed unused import `androidx.compose.foundation.layout.width`.
- **`ui/quiz/components/Toolbar.kt`**:
    - Removed unused imports `androidx.compose.foundation.layout.fillMaxWidth` and `androidx.compose.foundation.layout.height`.
			
			
This commit is contained in:
		| @@ -84,7 +84,9 @@ private fun QuizScreen( | ||||
| private fun QuizScreenLoading( | ||||
|     modifier: Modifier = Modifier, | ||||
| ) { | ||||
|     CircularProgressIndicator() | ||||
|     CircularProgressIndicator( | ||||
|         modifier = modifier, | ||||
|     ) | ||||
| } | ||||
|  | ||||
| @Composable | ||||
|   | ||||
| @@ -42,7 +42,8 @@ class QuizScreenViewModel @Inject constructor( | ||||
|                 if (quizState is QuizUiState.Success) { | ||||
|                     // Start only if timer hasn't been started yet and we are on the first question | ||||
|                     if (timerJob == null && _currentQuestionIndex.value == 0) { | ||||
|                         val firstQuestionTime = quizState.quiz.questions.getOrNull(0)?.time?.inWholeSeconds?.toInt() | ||||
|                         val firstQuestionTime = | ||||
|                             quizState.quiz.questions.getOrNull(0)?.time?.inWholeSeconds?.toInt() | ||||
|                         startCountdown(firstQuestionTime) | ||||
|                     } | ||||
|                 } | ||||
| @@ -69,7 +70,7 @@ class QuizScreenViewModel @Inject constructor( | ||||
|                     timerState = TimerState( | ||||
|                         remainingTimeSeconds = remainingTimeSeconds, | ||||
|                         totalTimeSeconds = currentQuestion?.time?.inWholeSeconds?.toInt() ?: 0, | ||||
|                     ) | ||||
|                     ), | ||||
|                 ) | ||||
|             } | ||||
|         } | ||||
| @@ -96,7 +97,8 @@ class QuizScreenViewModel @Inject constructor( | ||||
|             if (nextIndex < total) { | ||||
|                 _selectedChoiceIndex.value = null | ||||
|                 _currentQuestionIndex.value = nextIndex | ||||
|                 val nextQuestionTime = quizState.quiz.questions[nextIndex].time?.inWholeSeconds?.toInt() | ||||
|                 val nextQuestionTime = | ||||
|                     quizState.quiz.questions[nextIndex].time?.inWholeSeconds?.toInt() | ||||
|                 startCountdown(nextQuestionTime) | ||||
|             } else { | ||||
|                 // Last question reached: stop timer and keep state (could navigate to results in the future) | ||||
|   | ||||
| @@ -7,10 +7,9 @@ import androidx.compose.foundation.layout.Arrangement | ||||
| import androidx.compose.foundation.layout.Box | ||||
| import androidx.compose.foundation.layout.FlowRow | ||||
| import androidx.compose.foundation.layout.height | ||||
| import androidx.compose.foundation.layout.offset | ||||
| import androidx.compose.foundation.layout.padding | ||||
| import androidx.compose.foundation.layout.size | ||||
| import androidx.compose.foundation.layout.width | ||||
| import androidx.compose.foundation.layout.offset | ||||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||||
| import androidx.compose.material3.Text | ||||
| import androidx.compose.runtime.Composable | ||||
|   | ||||
| @@ -4,16 +4,16 @@ import androidx.compose.foundation.background | ||||
| import androidx.compose.foundation.layout.Column | ||||
| import androidx.compose.foundation.layout.Spacer | ||||
| import androidx.compose.foundation.layout.fillMaxWidth | ||||
| import androidx.compose.foundation.layout.heightIn | ||||
| import androidx.compose.foundation.layout.height | ||||
| import androidx.compose.foundation.layout.heightIn | ||||
| 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.Modifier | ||||
| import androidx.compose.ui.draw.clip | ||||
| import androidx.compose.ui.graphics.Color | ||||
| import androidx.compose.ui.layout.ContentScale | ||||
| import androidx.compose.ui.draw.clip | ||||
| import androidx.compose.ui.text.style.TextAlign | ||||
| import androidx.compose.ui.unit.dp | ||||
| import androidx.core.text.HtmlCompat | ||||
|   | ||||
| @@ -15,7 +15,6 @@ import androidx.compose.ui.Alignment | ||||
| import androidx.compose.ui.Modifier | ||||
| import androidx.compose.ui.graphics.Color | ||||
| import androidx.compose.ui.unit.dp | ||||
| import androidx.compose.ui.draw.clipToBounds | ||||
| import dev.adriankuta.kahootquiz.core.designsystem.Purple | ||||
|  | ||||
| @Composable | ||||
|   | ||||
| @@ -5,8 +5,6 @@ import androidx.compose.foundation.background | ||||
| import androidx.compose.foundation.layout.Box | ||||
| import androidx.compose.foundation.layout.Row | ||||
| 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.foundation.layout.size | ||||
| import androidx.compose.foundation.layout.width | ||||
|   | ||||
		Reference in New Issue
	
	Block a user