made google play demo account; removed quickdays; removed lecturenotes; fixed settings not applying right away bug
This commit is contained in:
@@ -239,6 +239,8 @@ class Global {
|
||||
var subjectToShow by mutableStateOf("")
|
||||
var markToShow by mutableStateOf(Mark())
|
||||
|
||||
var demoMode: Boolean = false
|
||||
|
||||
inner class FilePaths {
|
||||
val accountData: String = "account_data.txt"
|
||||
val timetable: String = "timetable.json"
|
||||
|
||||
@@ -91,8 +91,11 @@ fun launchContinue(
|
||||
global.finalMarks = Parsing.parseFinalMarks(finalMarks)
|
||||
|
||||
// load the lecture notes
|
||||
Util.loadLectureNotes()
|
||||
Util.csvToLectureNotes()
|
||||
//Util.loadLectureNotes()
|
||||
//Util.csvToLectureNotes()
|
||||
|
||||
// load the settings
|
||||
settings = Util.fileToString(global.filePaths.settings).toSettingsData()
|
||||
|
||||
// listen for internet availability in case of disconnection
|
||||
if (!global.internetAwaitListenerRunning)
|
||||
|
||||
@@ -341,8 +341,10 @@ fun MarksAll() {
|
||||
shape = RoundedCornerShape(global.dimens.roundedCorner)
|
||||
)
|
||||
.clickable {
|
||||
global.marksDepthLevel = MarksDepthLevel.Subject
|
||||
global.subjectToShow = subject
|
||||
if (markList[0].grade != "0") {
|
||||
global.marksDepthLevel = MarksDepthLevel.Subject
|
||||
global.subjectToShow = subject
|
||||
} // else { isInDemo == true }
|
||||
}
|
||||
} else {
|
||||
Modifier
|
||||
@@ -353,8 +355,10 @@ fun MarksAll() {
|
||||
shape = RoundedCornerShape(global.dimens.roundedCorner)
|
||||
)
|
||||
.clickable {
|
||||
global.marksDepthLevel = MarksDepthLevel.Subject
|
||||
global.subjectToShow = subject
|
||||
if (markList[0].grade != "0") {
|
||||
global.marksDepthLevel = MarksDepthLevel.Subject
|
||||
global.subjectToShow = subject
|
||||
} // else { isInDemo == true }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +471,7 @@ fun MarksAll() {
|
||||
)
|
||||
}
|
||||
|
||||
FloatingActionButton(
|
||||
/*FloatingActionButton(
|
||||
onClick = { global.currentScreenElement = ScreenElement.FinalMarks },
|
||||
modifier = Modifier
|
||||
.padding(10.dp)
|
||||
@@ -483,7 +487,7 @@ fun MarksAll() {
|
||||
contentDescription = "Final marks",
|
||||
tint = PastelYellow // You can customize the icon color
|
||||
)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@ fun SettingsScreen() {
|
||||
|
||||
// load the settings dat every time the settings screen is opened,
|
||||
// maybe i can add a flag that determines if the settings are up to date?
|
||||
settings = Util.fileToString(global.filePaths.settings).toSettingsData()
|
||||
if (!global.demoMode) {
|
||||
settings = Util.fileToString(global.filePaths.settings).toSettingsData()
|
||||
}
|
||||
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
@@ -60,7 +62,9 @@ fun SettingsScreen() {
|
||||
|
||||
SettingsTableRow(settings.useAmoledMode)
|
||||
|
||||
SettingsTableRow(settings.showRefreshButton)
|
||||
if (!global.demoMode) {
|
||||
SettingsTableRow(settings.showRefreshButton)
|
||||
}
|
||||
|
||||
SettingsTableRow(settings.useAnimations)
|
||||
}
|
||||
|
||||
@@ -89,26 +89,55 @@ fun signInButtonCallback(ctx: Context, usernameText: String, passwordText: Strin
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val valid = Account.isValid(acc)
|
||||
|
||||
checked = true
|
||||
|
||||
if (valid) {
|
||||
Account.save(acc)
|
||||
global.currentScreen = Screen.Splash
|
||||
launchStart(ctx)
|
||||
if (global.username == "demo" && global.password == "Demo1234") {
|
||||
// start the demo
|
||||
launchDemo(ctx)
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
ctx,
|
||||
"Neplatné přihlašovací údaje nebo nejste připojeni k internetu, zkuste to znovu.",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
val valid = Account.isValid(acc)
|
||||
|
||||
checked = true
|
||||
|
||||
if (valid) {
|
||||
Account.save(acc)
|
||||
global.currentScreen = Screen.Splash
|
||||
launchStart(ctx)
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
ctx,
|
||||
"Neplatné přihlašovací údaje nebo nejste připojeni k internetu, zkuste to znovu.",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun launchDemo(ctx: Context) {
|
||||
global.demoMode = true
|
||||
|
||||
settings = Util.fileToString(global.filePaths.settings).toSettingsData()
|
||||
settings.showRefreshButton.checked.value = false
|
||||
|
||||
val d = Day()
|
||||
d.name = "demoday"
|
||||
d.date = "1. 1."
|
||||
d.subjects = listOf(Subject.empty())
|
||||
global.timetable = listOf(d)
|
||||
|
||||
global.marks = mutableMapOf("demomarks" to mutableListOf(Mark().none()))
|
||||
|
||||
global.newMarks = global.marks
|
||||
|
||||
global.status = "demo"
|
||||
|
||||
global.launched = true
|
||||
global.refreshed = true
|
||||
global.currentScreen = Screen.Main
|
||||
global.currentScreenElement = ScreenElement.Timetable
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SignInScreen() {
|
||||
// handle the back gesture (back swipe form side or back button on bottom android navbar)
|
||||
|
||||
@@ -83,7 +83,7 @@ var showDetailDialog by mutableStateOf(false)
|
||||
fun TimetableScreen() {
|
||||
val pagerState = rememberPagerState(pageCount = { if (global.timetable.isNotEmpty()) global.timetable.size else 6 }) // FIXME
|
||||
Column {
|
||||
QuickDays(pagerState)
|
||||
//QuickDays(pagerState)
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
@@ -603,10 +603,10 @@ private fun DayScreen(day: Day) {
|
||||
Box(modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.zIndex(99f)
|
||||
.clickable {
|
||||
/*.clickable {
|
||||
global.selectedLecture = lectureId
|
||||
showDetailDialog = true
|
||||
})
|
||||
}*/)
|
||||
|
||||
if (
|
||||
(global.lectureNotes[global.selectedLecture] != null &&
|
||||
|
||||
Reference in New Issue
Block a user