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..."
|
"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
|
val delayTime: Long = 300 // delay in ms
|
||||||
|
|
||||||
// show a loading animation
|
// show a loading animation
|
||||||
while (!done && Util.internetAvail(ctx)) {
|
while (!done && Util.internetAvail(ctx)) {
|
||||||
for (text in loadingArray) {
|
for (text in loadingArray) {
|
||||||
|
if (done) break
|
||||||
toolbarText.value = text
|
toolbarText.value = text
|
||||||
delay(delayTime)
|
delay(delayTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (text in loadingArray.reversedArray().slice(1..<loadingArray.size)) {
|
|
||||||
toolbarText.value = text
|
|
||||||
delay(delayTime)
|
|
||||||
}
|
|
||||||
|
|
||||||
delay(delayTime)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the role of the student
|
// determine the role of the student
|
||||||
@@ -287,7 +283,8 @@ private fun launchPhase2(ctx: Context) {
|
|||||||
Util.fileToString(
|
Util.fileToString(
|
||||||
userDataFilePath
|
userDataFilePath
|
||||||
)
|
)
|
||||||
).getString("fullName")}$role"
|
).getString("fullName")
|
||||||
|
}$role"
|
||||||
|
|
||||||
// set the main content view
|
// set the main content view
|
||||||
screenToShow.value = Screen.Main
|
screenToShow.value = Screen.Main
|
||||||
|
|||||||
@@ -58,10 +58,15 @@ class Network {
|
|||||||
internetAvail = true
|
internetAvail = true
|
||||||
userData = getUserDataJSON()
|
userData = getUserDataJSON()
|
||||||
Util.saveStringToFile(userDataFilePath, userData)
|
Util.saveStringToFile(userDataFilePath, userData)
|
||||||
if (!Parsing.userIsParent()) {
|
studentClass = if (!Parsing.userIsParent()) {
|
||||||
studentClass = JSONObject(
|
JSONObject(
|
||||||
Util.fileToString(userDataFilePath)
|
Util.fileToString(userDataFilePath)
|
||||||
).getJSONObject("class").get("name").toString()
|
).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()
|
studentId = getStudentId()
|
||||||
//syid = getSYID()
|
//syid = getSYID()
|
||||||
|
|||||||
@@ -39,12 +39,6 @@ import kotlinx.coroutines.launch
|
|||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
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")
|
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)
|
Account.save(acc)
|
||||||
signedInAndReadyToLaunch.value = true
|
signedInAndReadyToLaunch.value = true
|
||||||
screenToShow.value = Screen.Splash
|
screenToShow.value = Screen.Splash
|
||||||
|
fetchNewData(ctx, coscope)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
@@ -327,8 +327,7 @@ private fun DayScreen(day: Day) {
|
|||||||
.padding(vertical = 5.dp),
|
.padding(vertical = 5.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
// add this to the 'Svoboda' mode maybe later; for now, it is left out
|
if (settingsData.useSvobodaMode.checked.value) {
|
||||||
/*if (!Parsing.userIsParent()) {
|
|
||||||
if (
|
if (
|
||||||
subject.teacher == "Jindřich Svoboda" &&
|
subject.teacher == "Jindřich Svoboda" &&
|
||||||
studentClass == "5. G"
|
studentClass == "5. G"
|
||||||
@@ -339,7 +338,7 @@ private fun DayScreen(day: Day) {
|
|||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subject.substitute != "2") {
|
if (subject.substitute != "2") {
|
||||||
|
|||||||
Reference in New Issue
Block a user