hard-coded elementsymbol into Array "elementButtonCurrent"
This commit is contained in:
@@ -67,6 +67,15 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
mutableStateOf(-1)
|
mutableStateOf(-1)
|
||||||
}
|
}
|
||||||
val elementConstructorList = listOf(
|
val elementConstructorList = listOf(
|
||||||
|
"H", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "He",
|
||||||
|
"Li", "Be", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "B", "C", "N", "O", "F", "Ne",
|
||||||
|
"Na", "Mg", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Al", "Si", "P", "S", "Cl", "Ar",
|
||||||
|
"K", "Ca", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr",
|
||||||
|
"Rb", "Sr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe",
|
||||||
|
"Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn",
|
||||||
|
"Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"
|
||||||
|
)
|
||||||
|
val elementButtonCurrent = listOf(
|
||||||
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1,
|
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1,
|
||||||
2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, 7, 8, 9,
|
2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, 7, 8, 9,
|
||||||
10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, 14, 15, 16, 17,
|
10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, 14, 15, 16, 17,
|
||||||
@@ -89,7 +98,7 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
IconButton(onClick = { activity.finish() }) {
|
IconButton(onClick = { activity.finish() }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.ArrowBack,
|
imageVector = Icons.Filled.ArrowBack,
|
||||||
contentDescription = null,
|
contentDescription = "",
|
||||||
modifier = Modifier.size(60.dp),
|
modifier = Modifier.size(60.dp),
|
||||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
)
|
)
|
||||||
@@ -101,7 +110,7 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}) {
|
}) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Info,
|
imageVector = Icons.Outlined.Info,
|
||||||
contentDescription = null,
|
contentDescription = "",
|
||||||
modifier = Modifier.size(28.dp),
|
modifier = Modifier.size(28.dp),
|
||||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
)
|
)
|
||||||
@@ -118,14 +127,14 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
) {
|
) {
|
||||||
Row {
|
Row {
|
||||||
for (i in 0 .. 31) {
|
for (i in 0 .. 31) {
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFBCA76D))
|
.background(color = Color(0xFFBCA76D))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Box(
|
Box(
|
||||||
@@ -138,14 +147,14 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 32 .. 63)
|
for (i in 32 .. 63)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFC65253))
|
.background(color = Color(0xFFC65253))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Box(
|
Box(
|
||||||
@@ -157,14 +166,14 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 64 .. 95)
|
for (i in 64 .. 95)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF337733))
|
.background(color = Color(0xFF337733))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Box(
|
Box(
|
||||||
@@ -176,15 +185,15 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 96 .. 127)
|
for (i in 96 .. 127)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
if (i in 112..121) {
|
if (i in 112..121) {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF337733))
|
.background(color = Color(0xFF337733))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -192,9 +201,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFDC2222))
|
.background(color = Color(0xFFDC2222))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -207,15 +216,15 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 128..159)
|
for (i in 128..159)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
if (i in 144..153) {
|
if (i in 144..153) {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFDC2222))
|
.background(color = Color(0xFFDC2222))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -223,9 +232,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF129DC3))
|
.background(color = Color(0xFF129DC3))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -238,16 +247,16 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 160..191)
|
for (i in 160..191)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
when (i) {
|
when (i) {
|
||||||
in 162..175 -> {
|
in 162..175 -> {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFDC2222))
|
.background(color = Color(0xFFDC2222))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in 176..185 -> {
|
in 176..185 -> {
|
||||||
@@ -255,9 +264,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF129DC3))
|
.background(color = Color(0xFF129DC3))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@@ -265,9 +274,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFDDCC69))
|
.background(color = Color(0xFFDDCC69))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,16 +290,16 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
for (i in 192 .. 223)
|
for (i in 192 .. 223)
|
||||||
if (elementConstructorList[i] != -1) {
|
if (elementConstructorList[i] != "") {
|
||||||
when (i) {
|
when (i) {
|
||||||
in 194..207 -> {
|
in 194..207 -> {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF129DC3))
|
.background(color = Color(0xFF129DC3))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in 208..217 -> {
|
in 208..217 -> {
|
||||||
@@ -298,9 +307,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFFDDCC69))
|
.background(color = Color(0xFFDDCC69))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@@ -308,9 +317,9 @@ fun PSEContent(activity: ComponentActivity){
|
|||||||
.padding(3.dp)
|
.padding(3.dp)
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
.background(color = Color(0xFF7044DD))
|
.background(color = Color(0xFF7044DD))
|
||||||
.clickable { dialogChooser = elementConstructorList[i] }
|
.clickable { dialogChooser = elementButtonCurrent[i] }
|
||||||
) {
|
) {
|
||||||
Text(modifier = Modifier.align(Alignment.Center), text = readElementSymbol(activity, elementConstructorList[i]), color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
Text(modifier = Modifier.align(Alignment.Center), text = elementConstructorList[i], color = com.schoolapp.cleverclass.ui.theme.TextOnColouredButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,7 +394,6 @@ fun readElementData(context: Context, int: Int): String {
|
|||||||
val elementDataArray = rootObj.getJSONArray("elements")
|
val elementDataArray = rootObj.getJSONArray("elements")
|
||||||
val elementData = elementDataArray.getJSONObject(int)
|
val elementData = elementDataArray.getJSONObject(int)
|
||||||
return "Name\n >>> ${elementData.get("Name")}\n\n" +
|
return "Name\n >>> ${elementData.get("Name")}\n\n" +
|
||||||
"Elementsymbol\n >>> ${elementData.get("Elementsymbol")}\n\n" +
|
|
||||||
"Molare Masse\n >>> ${elementData.get("Molare Masse")}\n\n" +
|
"Molare Masse\n >>> ${elementData.get("Molare Masse")}\n\n" +
|
||||||
"Dichte\n >>> ${elementData.get("Dichte")}\n\n" +
|
"Dichte\n >>> ${elementData.get("Dichte")}\n\n" +
|
||||||
"Elektronegativität\n >>> ${elementData.get("Elektronegativität")}\n\n" +
|
"Elektronegativität\n >>> ${elementData.get("Elektronegativität")}\n\n" +
|
||||||
@@ -397,12 +405,3 @@ fun readElementData(context: Context, int: Int): String {
|
|||||||
"künstlich\n >>> ${elementData.get("künstlich")}\n\n" +
|
"künstlich\n >>> ${elementData.get("künstlich")}\n\n" +
|
||||||
"langlebigstes Isotop\n >>> ${elementData.get("langlebigstes Isotop")}"
|
"langlebigstes Isotop\n >>> ${elementData.get("langlebigstes Isotop")}"
|
||||||
}
|
}
|
||||||
fun readElementSymbol(context: Context, int: Int): String {
|
|
||||||
val file = "elements_data.json"
|
|
||||||
val assetManager = context.assets
|
|
||||||
val inputStream = assetManager.open(file)
|
|
||||||
val rootObj = JSONObject(InputStreamReader(inputStream).readText())
|
|
||||||
val elementDataArray = rootObj.getJSONArray("elements")
|
|
||||||
val elementData = elementDataArray.getJSONObject(int)
|
|
||||||
return "${elementData.get("Elementsymbol")}"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user