Compare commits

..

2 Commits

Author SHA1 Message Date
matthias
c5d32a5add minor changes 2024-04-10 20:57:54 +02:00
matthias
8dead6d667 minor changes 2024-04-10 20:56:14 +02:00
4 changed files with 1914 additions and 48 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,7 @@ import com.schoolapp.cleverclass.ui.theme.TextOnColouredButton
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
readData() readData(applicationContext)
setContent { setContent {
CleverClassTheme { CleverClassTheme {
Surface(modifier = Modifier.fillMaxSize(), Surface(modifier = Modifier.fillMaxSize(),

View File

@@ -79,9 +79,3 @@ fun PSEContent(activity: ComponentActivity){
} }
} }
} }
fun main() {
readData()
println(elements[0].data0)
println(elements[0].data10)
}

View File

@@ -1,10 +1,12 @@
package com.schoolapp.cleverclass package com.schoolapp.cleverclass
import java.io.File import android.content.Context
import java.io.BufferedReader
import java.io.IOException import java.io.IOException
import java.util.Scanner import java.io.InputStreamReader
val elements = mutableListOf<PSEData>() val elements = mutableListOf<PSEData>()
var i = 0
class PSEData() { class PSEData() {
var data0: String = "" var data0: String = ""
@@ -60,45 +62,43 @@ class PSEData() {
} }
} }
fun main() { fun readData(context: Context) {
readData() val elementInput = mutableListOf<String>()
} val file = "elements_data.txt"
fun readData() { val assetManager = context.assets
val elementInput = mutableListOf("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "") val inputStream = assetManager.open(file)
val fileName = "app/src/main/assets/elements_data.txt"
var i = 0
while (i < 1) {
try { try {
val sc = Scanner(File(fileName)) BufferedReader(InputStreamReader(inputStream)).use { br ->
var j = 0 br.lines().forEach {
while (j < 1) { elementInput.add(it)
elementInput[j] = sc.nextLine()
j++
} }
} catch (e: IOException) { }
}
catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
if (i < 118) {
while (i < 118) {
val pseobject = PSEData( val pseobject = PSEData(
string0 = elementInput[0], string0 = elementInput[(i * 16)],
string1 = elementInput[1], string1 = elementInput[(i * 16) + 1],
string2 = elementInput[2], string2 = elementInput[(i * 16) + 2],
string3 = elementInput[3], string3 = elementInput[(i * 16) + 3],
string4 = elementInput[4], string4 = elementInput[(i * 16) + 4],
string5 = elementInput[5], string5 = elementInput[(i * 16) + 5],
string6 = elementInput[6], string6 = elementInput[(i * 16) + 6],
string7 = elementInput[7], string7 = elementInput[(i * 16) + 7],
string8 = elementInput[8], string8 = elementInput[(i * 16) + 8],
string9 = elementInput[9], string9 = elementInput[(i * 16) + 9],
string10 = elementInput[10], string10 = elementInput[(i * 16) + 10],
string11 = elementInput[11], string11 = elementInput[(i * 16) + 11],
string12 = elementInput[12], string12 = elementInput[(i * 16) + 12],
string13 = elementInput[13], string13 = elementInput[(i * 16) + 13],
string14 = elementInput[14], string14 = elementInput[(i * 16) + 14],
string15 = elementInput[15] string15 = elementInput[(i * 16) + 15]
) )
elements.add(pseobject) elements.add(pseobject)
i++ i++
} }
println(elements[0].data0) }
println("hi")
} }