Add README
Update some stuff
This commit is contained in:
@@ -89,7 +89,6 @@ class FachActivity : ComponentActivity() {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getGrades(this@FachActivity, name).collect { savedGrades ->
|
||||
grades = savedGrades.toMutableList()
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +512,7 @@ fun GradePrefab(
|
||||
@Composable
|
||||
fun Item(name : String, onItemClick: (String) -> Unit){
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = name) },
|
||||
text = { Text(text = name, style = MaterialTheme.typography.labelMedium) },
|
||||
onClick = { onItemClick(name) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -114,8 +114,11 @@ fun NotenContent(activity: ComponentActivity){
|
||||
val editor = sharedPreferences.edit()
|
||||
|
||||
var allAverage by remember {
|
||||
mutableStateOf(calculateAllAverage(loadAllAverages(sharedPreferences)))
|
||||
mutableStateOf(0f)
|
||||
}
|
||||
|
||||
allAverage = calculateAllAverage(sharedPreferences)
|
||||
|
||||
var showDeleteConfirmation by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
@@ -189,7 +192,7 @@ fun NotenContent(activity: ComponentActivity){
|
||||
saWeight = saWeights[i],
|
||||
activity = activity,
|
||||
sharedPreferences = sharedPreferences,
|
||||
onAvgChange = { allAverage = calculateAllAverage(loadAllAverages(sharedPreferences)) }
|
||||
onAvgChange = { allAverage = calculateAllAverage(sharedPreferences) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -201,7 +204,7 @@ fun NotenContent(activity: ComponentActivity){
|
||||
saWeight = saWeights[i],
|
||||
activity = activity,
|
||||
sharedPreferences = sharedPreferences,
|
||||
onAvgChange = { allAverage = calculateAllAverage(loadAllAverages(sharedPreferences)) }
|
||||
onAvgChange = { allAverage = calculateAllAverage(sharedPreferences) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -213,7 +216,7 @@ fun NotenContent(activity: ComponentActivity){
|
||||
saWeight = saWeights[i],
|
||||
activity = activity,
|
||||
sharedPreferences = sharedPreferences,
|
||||
onAvgChange = { allAverage = calculateAllAverage(loadAllAverages(sharedPreferences)) }
|
||||
onAvgChange = { allAverage = calculateAllAverage(sharedPreferences) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -225,7 +228,7 @@ fun NotenContent(activity: ComponentActivity){
|
||||
saWeight = saWeights[i],
|
||||
activity = activity,
|
||||
sharedPreferences = sharedPreferences,
|
||||
onAvgChange = { allAverage = calculateAllAverage(loadAllAverages(sharedPreferences)) }
|
||||
onAvgChange = { allAverage = calculateAllAverage(sharedPreferences) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -237,7 +240,7 @@ fun NotenContent(activity: ComponentActivity){
|
||||
saWeight = saWeights[i],
|
||||
activity = activity,
|
||||
sharedPreferences = sharedPreferences,
|
||||
onAvgChange = { allAverage = calculateAllAverage(loadAllAverages(sharedPreferences)) }
|
||||
onAvgChange = { allAverage = calculateAllAverage(sharedPreferences) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -343,9 +346,10 @@ fun GroopTitle(name: String, top: Boolean){
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
}
|
||||
|
||||
fun calculateAllAverage(avgs: List<Float>): Float{
|
||||
fun calculateAllAverage(sharedPreferences: SharedPreferences): Float{
|
||||
var total = 0.0f
|
||||
var number = 0
|
||||
val avgs = loadAllAverages(sharedPreferences)
|
||||
|
||||
avgs.forEach{ avg ->
|
||||
if (avg != 0.0f && !avg.isNaN()){
|
||||
@@ -353,6 +357,7 @@ fun calculateAllAverage(avgs: List<Float>): Float{
|
||||
number += 1
|
||||
}
|
||||
}
|
||||
|
||||
return (total / number)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
@@ -129,17 +130,24 @@ fun SettingsContent(activity: ComponentActivity) {
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Divider()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(
|
||||
text = "About",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.clickable {
|
||||
val intent = Intent(activity, AboutActivity::class.java)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.clickable {
|
||||
val intent = Intent(activity, AboutActivity::class.java)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = "About",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(horizontal = 32.dp, vertical = 8.dp)
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user