made the Svoboda mode work and improved the toolbar ux
This commit is contained in:
@@ -42,23 +42,19 @@ fun fetchNewData(ctx: Context, coscope: CoroutineScope) {
|
||||
"Načítání nových dat",
|
||||
"Načítání nových dat.",
|
||||
"Načítání nových dat..",
|
||||
"Načítání nových dat..."
|
||||
"Načítání nových dat...",
|
||||
"Načítání nových dat..",
|
||||
"Načítání nových dat."
|
||||
)
|
||||
val delayTime: Long = 300 // delay in ms
|
||||
|
||||
// show a loading animation
|
||||
while (!done && Util.internetAvail(ctx)) {
|
||||
for (text in loadingArray) {
|
||||
if (done) break
|
||||
toolbarText.value = text
|
||||
delay(delayTime)
|
||||
}
|
||||
|
||||
for (text in loadingArray.reversedArray().slice(1..<loadingArray.size)) {
|
||||
toolbarText.value = text
|
||||
delay(delayTime)
|
||||
}
|
||||
|
||||
delay(delayTime)
|
||||
}
|
||||
|
||||
// determine the role of the student
|
||||
@@ -287,7 +283,8 @@ private fun launchPhase2(ctx: Context) {
|
||||
Util.fileToString(
|
||||
userDataFilePath
|
||||
)
|
||||
).getString("fullName")}$role"
|
||||
).getString("fullName")
|
||||
}$role"
|
||||
|
||||
// set the main content view
|
||||
screenToShow.value = Screen.Main
|
||||
|
||||
@@ -58,10 +58,15 @@ class Network {
|
||||
internetAvail = true
|
||||
userData = getUserDataJSON()
|
||||
Util.saveStringToFile(userDataFilePath, userData)
|
||||
if (!Parsing.userIsParent()) {
|
||||
studentClass = JSONObject(
|
||||
studentClass = if (!Parsing.userIsParent()) {
|
||||
JSONObject(
|
||||
Util.fileToString(userDataFilePath)
|
||||
).getJSONObject("class").get("name").toString()
|
||||
} else {
|
||||
// if the user is a parent, the class will be of their first child
|
||||
JSONObject(
|
||||
Util.fileToString(userDataFilePath)
|
||||
).getJSONArray("children").getJSONObject(0).getString("className")
|
||||
}
|
||||
studentId = getStudentId()
|
||||
//syid = getSYID()
|
||||
|
||||
@@ -39,12 +39,6 @@ import kotlinx.coroutines.launch
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
||||
private var buttonText: MutableState<String> = mutableStateOf("Přihlásit se")
|
||||
|
||||
@@ -101,6 +95,7 @@ fun signInButtonCallback(ctx: Context, coscope: CoroutineScope, buttonText: Stri
|
||||
Account.save(acc)
|
||||
signedInAndReadyToLaunch.value = true
|
||||
screenToShow.value = Screen.Splash
|
||||
fetchNewData(ctx, coscope)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
ctx,
|
||||
|
||||
@@ -327,8 +327,7 @@ private fun DayScreen(day: Day) {
|
||||
.padding(vertical = 5.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
// add this to the 'Svoboda' mode maybe later; for now, it is left out
|
||||
/*if (!Parsing.userIsParent()) {
|
||||
if (settingsData.useSvobodaMode.checked.value) {
|
||||
if (
|
||||
subject.teacher == "Jindřich Svoboda" &&
|
||||
studentClass == "5. G"
|
||||
@@ -339,7 +338,7 @@ private fun DayScreen(day: Day) {
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
if (subject.substitute != "2") {
|
||||
|
||||
Reference in New Issue
Block a user