@@ -8,17 +8,12 @@ package app.morphe.manager.ui.screen.patcher
88import androidx.compose.animation.AnimatedContent
99import androidx.compose.animation.AnimatedVisibility
1010import androidx.compose.foundation.layout.*
11- import androidx.compose.foundation.shape.RoundedCornerShape
1211import androidx.compose.material.icons.Icons
1312import androidx.compose.material.icons.outlined.Info
14- import androidx.compose.material.icons.outlined.SportsEsports
1513import androidx.compose.material3.CircularProgressIndicator
16- import androidx.compose.material3.Icon
1714import androidx.compose.material3.MaterialTheme
18- import androidx.compose.material3.Surface
1915import androidx.compose.material3.Text
2016import androidx.compose.runtime.*
21- import androidx.compose.runtime.saveable.rememberSaveable
2217import androidx.compose.ui.Alignment
2318import androidx.compose.ui.Modifier
2419import androidx.compose.ui.graphics.StrokeCap
@@ -32,8 +27,6 @@ import androidx.compose.ui.unit.dp
3227import androidx.compose.ui.unit.sp
3328import app.morphe.manager.R
3429import app.morphe.manager.ui.model.State
35- import app.morphe.manager.ui.screen.patcher.game.MiniGameContent
36- import app.morphe.manager.ui.screen.patcher.game.MiniGameState
3730import app.morphe.manager.ui.screen.shared.*
3831import app.morphe.manager.ui.viewmodel.HomeAndPatcherMessages
3932import app.morphe.manager.ui.viewmodel.PatcherViewModel
@@ -51,14 +44,12 @@ fun SimplePatchingInProgress(
5144 patchesProgress : Pair <Int , Int >,
5245 patcherViewModel : PatcherViewModel ,
5346 showLongStepWarning : Boolean = false,
54- miniGameState : MiniGameState ,
5547 onCancelClick : () -> Unit ,
5648 onHomeClick : () -> Unit
5749) {
5850 val windowSize = rememberWindowSize()
5951 val (completed, total) = patchesProgress
6052 val context = LocalContext .current
61- var showGame by rememberSaveable { mutableStateOf(false ) }
6253
6354 val currentMessage = remember {
6455 mutableIntStateOf(
@@ -95,9 +86,6 @@ fun SimplePatchingInProgress(
9586 total = total,
9687 showLongStepWarning = showLongStepWarning,
9788 patcherViewModel = patcherViewModel,
98- showGame = showGame,
99- onToggleGame = { showGame = ! showGame },
100- miniGameState = miniGameState,
10189 onCancelClick = onCancelClick,
10290 onHomeClick = onHomeClick
10391 )
@@ -131,9 +119,6 @@ private fun AdaptiveProgressContent(
131119 total : Int ,
132120 showLongStepWarning : Boolean ,
133121 patcherViewModel : PatcherViewModel ,
134- showGame : Boolean ,
135- onToggleGame : () -> Unit ,
136- miniGameState : MiniGameState ,
137122 onCancelClick : () -> Unit = {},
138123 onHomeClick : () -> Unit = {}
139124) {
@@ -184,121 +169,44 @@ private fun AdaptiveProgressContent(
184169 )
185170 }
186171
187- // Right column: Progress circle or game
188- ProgressSlot (
189- progress = progress,
190- completed = completed,
191- total = total,
192- showGame = showGame,
193- onToggleGame = onToggleGame,
194- miniGameState = miniGameState,
172+ // Right column: Circular progress
173+ Box (
195174 modifier = Modifier
196175 .weight(0.5f )
197- .fillMaxHeight()
198- )
199- }
200- } else {
201- // Single-column layout for compact windows (portrait)
202- BoxWithConstraints (
203- modifier = Modifier
204- .fillMaxSize()
205- .padding(horizontal = contentPadding),
206- contentAlignment = Alignment .Center
207- ) {
208- // Slot height = square board (maxWidth) + 56dp header (ScoreRow 44dp + spacing 12dp),
209- // capped so message + details still fit.
210- val slotHeight = (maxWidth + 56 .dp)
211- .coerceAtMost(maxHeight - 160 .dp)
212- .coerceAtLeast(220 .dp)
213-
214- Column (
215- modifier = Modifier .fillMaxWidth(),
216- horizontalAlignment = Alignment .CenterHorizontally ,
217- verticalArrangement = Arrangement .spacedBy(itemSpacing)
176+ .fillMaxHeight(),
177+ contentAlignment = Alignment .Center
218178 ) {
219- ProgressMessageSection (currentMessage)
220-
221- ProgressSlot (
179+ CircularProgressWithStats (
222180 progress = progress,
223181 completed = completed,
224182 total = total,
225- showGame = showGame,
226- onToggleGame = onToggleGame,
227- miniGameState = miniGameState,
228- modifier = Modifier
229- .fillMaxWidth()
230- .height(slotHeight)
231- )
232-
233- ProgressDetailsSection (
234- showLongStepWarning = showLongStepWarning,
235- patcherViewModel = patcherViewModel,
236- windowSize = windowSize
183+ modifier = Modifier .size(280 .dp)
237184 )
238185 }
239186 }
240- }
241- }
187+ } else {
188+ // Single-column layout for compact windows (portrait)
189+ Column (
190+ modifier = Modifier
191+ .fillMaxWidth()
192+ .padding(horizontal = contentPadding),
193+ horizontalAlignment = Alignment .CenterHorizontally ,
194+ verticalArrangement = Arrangement .spacedBy(itemSpacing * 3 )
195+ ) {
196+ ProgressMessageSection (currentMessage)
242197
243- /* *
244- * Swappable slot that shows either the circular progress or the mini-game.
245- */
246- @Composable
247- private fun ProgressSlot (
248- progress : Float ,
249- completed : Int ,
250- total : Int ,
251- showGame : Boolean ,
252- onToggleGame : () -> Unit ,
253- miniGameState : MiniGameState ,
254- modifier : Modifier = Modifier
255- ) {
256- LaunchedEffect (showGame) {
257- if (! showGame) miniGameState.pauseActiveGame()
258- }
259- Box (modifier = modifier) {
260- if (showGame) {
261- MiniGameContent (
262- state = miniGameState,
263- modifier = Modifier .fillMaxSize(),
198+ CircularProgressWithStats (
264199 progress = progress,
265- gameContentPadding = 8 .dp,
266- onBackToHost = onToggleGame
200+ completed = completed,
201+ total = total,
202+ modifier = Modifier .size(280 .dp)
203+ )
204+
205+ ProgressDetailsSection (
206+ showLongStepWarning = showLongStepWarning,
207+ patcherViewModel = patcherViewModel,
208+ windowSize = windowSize
267209 )
268- } else {
269- Column (
270- modifier = Modifier .fillMaxSize().padding(8 .dp),
271- verticalArrangement = Arrangement .spacedBy(12 .dp)
272- ) {
273- Row (
274- modifier = Modifier .fillMaxWidth(),
275- horizontalArrangement = Arrangement .End
276- ) {
277- Surface (
278- onClick = onToggleGame,
279- shape = RoundedCornerShape (10 .dp),
280- color = MaterialTheme .colorScheme.surfaceVariant
281- ) {
282- Icon (
283- imageVector = Icons .Outlined .SportsEsports ,
284- contentDescription = null ,
285- tint = MaterialTheme .colorScheme.onSurfaceVariant,
286- modifier = Modifier .padding(12 .dp).size(20 .dp)
287- )
288- }
289- }
290- Box (
291- modifier = Modifier .weight(1f ).fillMaxWidth(),
292- contentAlignment = Alignment .Center
293- ) {
294- CircularProgressWithStats (
295- progress = progress,
296- completed = completed,
297- total = total,
298- modifier = Modifier .size(280 .dp)
299- )
300- }
301- }
302210 }
303211 }
304212}
0 commit comments