made the showRefreshButton setting work
This commit is contained in:
@@ -62,11 +62,7 @@ fun TimetableScreen() {
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
DayPager()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(bottom = 10.dp)
|
||||
.background(color = Color.Black, shape = RoundedCornerShape(roundedCornerDimen))
|
||||
) {
|
||||
if (settingsData.showRefreshButton.checked.value) {
|
||||
RefreshButton()
|
||||
}
|
||||
}
|
||||
@@ -89,29 +85,35 @@ fun RefreshButton(modifier: Modifier = Modifier) {
|
||||
val coscope = rememberCoroutineScope()
|
||||
val ctx = LocalContext.current
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
coscope.launch {
|
||||
fetchNewData(ctx, coscope)
|
||||
}
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
contentColor = Color.White,
|
||||
containerColor = Color.Black
|
||||
),
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.border(
|
||||
width = 5.dp,
|
||||
shape = RoundedCornerShape(roundedCornerDimen),
|
||||
color = PastelYellow
|
||||
)
|
||||
.padding(vertical = 10.dp)
|
||||
.padding(bottom = 10.dp)
|
||||
.background(color = Color.Black, shape = RoundedCornerShape(roundedCornerDimen))
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Refresh,
|
||||
contentDescription = "Refresh icon",
|
||||
modifier = Modifier.size(25.dp)
|
||||
)
|
||||
Button(
|
||||
onClick = {
|
||||
coscope.launch {
|
||||
fetchNewData(ctx, coscope)
|
||||
}
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
contentColor = Color.White,
|
||||
containerColor = Color.Black
|
||||
),
|
||||
modifier = Modifier
|
||||
.border(
|
||||
width = 5.dp,
|
||||
shape = RoundedCornerShape(roundedCornerDimen),
|
||||
color = PastelYellow
|
||||
)
|
||||
.padding(vertical = 10.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Refresh,
|
||||
contentDescription = "Refresh icon",
|
||||
modifier = Modifier.size(25.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +375,9 @@ private fun DayScreen(day: Day) {
|
||||
}
|
||||
}
|
||||
// TODO: remove when added settings to turn the refresh button on/off
|
||||
Spacer(modifier = Modifier.height(90.dp))
|
||||
if (settingsData.showRefreshButton.checked.value) {
|
||||
Spacer(modifier = Modifier.height(90.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user