Skip to content

Commit 06d0094

Browse files
authored
Merge pull request #110 from Producdevity/feat/ui-improvements
Feat/UI improvements
2 parents 7566981 + 9ccaa52 commit 06d0094

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

app/src/main/java/com/OxGames/Pluvia/ui/screen/library/HomeLibraryAppScreen.kt

+25-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.OxGames.Pluvia.ui.screen.library
33
import android.content.Intent
44
import android.content.res.Configuration
55
import android.net.Uri
6+
import androidx.compose.animation.AnimatedVisibility
67
import androidx.compose.foundation.layout.Box
78
import androidx.compose.foundation.layout.Column
89
import androidx.compose.foundation.layout.Row
@@ -83,11 +84,16 @@ fun AppScreen(
8384
onBack: () -> Unit,
8485
) {
8586
val context = LocalContext.current
86-
var downloadInfo by remember {
87+
var downloadInfo by remember(appId) {
8788
mutableStateOf(SteamService.getAppDownloadInfo(appId))
8889
}
89-
var downloadProgress by remember { mutableFloatStateOf(downloadInfo?.getProgress() ?: 0f) }
90-
var isInstalled by remember { mutableStateOf(SteamService.isAppInstalled(appId)) }
90+
var downloadProgress by remember(appId) {
91+
mutableFloatStateOf(downloadInfo?.getProgress() ?: 0f)
92+
}
93+
var isInstalled by remember(appId) {
94+
mutableStateOf(SteamService.isAppInstalled(appId))
95+
}
96+
9197
val isDownloading: () -> Boolean = { downloadInfo != null && downloadProgress < 1f }
9298

9399
var loadingDialogVisible by rememberSaveable { mutableStateOf(false) }
@@ -455,20 +461,22 @@ private fun AppScreenContent(
455461
}
456462

457463
if (isDownloading) {
458-
Column(
459-
modifier = Modifier
460-
.align(Alignment.CenterVertically)
461-
.weight(1f)
462-
.padding(4.dp),
463-
) {
464-
Text(
465-
modifier = Modifier.align(Alignment.End),
466-
text = "${(downloadProgress * 100f).toInt()}%",
467-
)
468-
LinearProgressIndicator(
469-
modifier = Modifier.fillMaxWidth(),
470-
progress = { downloadProgress },
471-
)
464+
AnimatedVisibility(visible = true) {
465+
Column(
466+
modifier = Modifier
467+
.align(Alignment.CenterVertically)
468+
.weight(1f)
469+
.padding(4.dp),
470+
) {
471+
Text(
472+
modifier = Modifier.align(Alignment.End),
473+
text = "${(downloadProgress * 100f).toInt()}%",
474+
)
475+
LinearProgressIndicator(
476+
modifier = Modifier.fillMaxWidth(),
477+
progress = { downloadProgress },
478+
)
479+
}
472480
}
473481
} else {
474482
Spacer(Modifier.weight(1f))

app/src/main/java/com/OxGames/Pluvia/ui/screen/library/HomeLibraryScreen.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,19 @@ private fun LibraryScreenContent(
149149
FloatingActionMenuItem(
150150
labelText = "Installed",
151151
isSelected = state.appInfoSortType == FabFilter.INSTALLED,
152-
onClick = { onFabFilter(FabFilter.INSTALLED) },
152+
onClick = {
153+
onFabFilter(FabFilter.INSTALLED)
154+
fabState.close()
155+
},
153156
content = { Icon(Icons.Filled.InstallMobile, "Installed") },
154157
)
155158
FloatingActionMenuItem(
156159
labelText = "Alphabetic",
157160
isSelected = state.appInfoSortType == FabFilter.ALPHABETIC,
158-
onClick = { onFabFilter(FabFilter.ALPHABETIC) },
161+
onClick = {
162+
onFabFilter(FabFilter.ALPHABETIC)
163+
fabState.close()
164+
},
159165
content = { Icon(Icons.Filled.SortByAlpha, "Alphabetic") },
160166
)
161167
}

0 commit comments

Comments
 (0)