Compare commits
23 Commits
344aa1ef9f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
442ef70b8d | ||
|
|
ec3a95fc2d | ||
|
|
b07cd27fce | ||
|
|
39c037a9ab | ||
|
|
f6956349e0 | ||
|
|
a41bd9cbb3 | ||
|
|
0db1e78cd4 | ||
|
|
7bdcb7e3fb | ||
|
|
d36cadeb18 | ||
|
|
1056dc39bf | ||
|
|
15cadb76c6 | ||
|
|
41b54f15ea | ||
|
|
50eb19a464 | ||
|
|
4c3de94dd3 | ||
|
|
30ad4bed64 | ||
|
|
f091451fe8 | ||
| 1c665fea26 | |||
|
|
41be804d5b | ||
|
|
173a3fc5a5 | ||
|
|
718fe65a75 | ||
|
|
e9ca2d8704 | ||
|
|
75302eed36 | ||
|
|
ac7ce0ad3d |
30
README.md
@@ -1,2 +1,32 @@
|
||||
# CleverClass
|
||||
CleverClass ist eine Android-App, die Schülern hilft, ihre Schulnoten zu verwalten, ihren Durchschnitt zu berechnen, den Vertretungsplan von DSBmobile einzusehen, den Stundenplan zu speichern und anzuzeigen sowie ein Periodensystem zu nutzen.
|
||||
|
||||
## Funktionen und Verwendung
|
||||
- **Notenverwaltung:** Trage deine Schulnoten ein und berechne deinen Durchschnitt. Perfekt, um alle Noten aus der Schule übersichtlich zu speichern.
|
||||
- **Vertretungsplan:** Rufe den aktuellen Vertretungsplan von DSBmobile direkt in der App auf.
|
||||
- **Stundenplan:** Trage deinen Stundenplan ein, speichere und verwalte ihn in der App, um immer den Überblick zu behalten.
|
||||
- **Periodensystem:** Nutze das integrierte Periodensystem, um schnell Informationen zu chemischen Elementen nachzuschlagen.
|
||||
## Installation
|
||||
CleverClass kann einfach über den Play Store installiert werden oder durch das Herunterladen der APK-Datei:
|
||||
|
||||
Play Store:
|
||||
- Öffne den Google Play Store auf deinem Android-Gerät
|
||||
- Suche nach "CleverClass"
|
||||
- Tippe auf "Installieren"
|
||||
|
||||
APK-Datei:
|
||||
- Lade die APK-Datei von der [Website](https://google.com/) herunter
|
||||
- Öffne die heruntergeladene APK-Datei auf deinem Android-Gerät
|
||||
- Folge den Anweisungen auf dem Bildschirm, um die Installation abzuschließen
|
||||
## Anforderungen
|
||||
Betriebssystem: Android 8.0 oder neuer
|
||||
## Autoren
|
||||
- Paul Posch
|
||||
- Matthias Meyer
|
||||
- Jakub Szarko
|
||||
- Emilian Bührer
|
||||
## Lizenz
|
||||
Dieses Projekt steht unter der [GNU General Public License Version 3, 29 June 2007](LICENSE).
|
||||
|
||||
## Sonstiges
|
||||
Dieses Projekt ist als Schulprojekt inerhalb von 3 Monaten entstanden.
|
||||
@@ -23,6 +23,7 @@ android {
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
isDebuggable = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
|
||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
@@ -1,9 +1,15 @@
|
||||
package com.schoolapp.cleverclass
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -14,6 +20,7 @@ import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
@@ -23,7 +30,10 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
@@ -73,7 +83,35 @@ fun AboutContent(activity: ComponentActivity){
|
||||
{
|
||||
AboutTextElement("This Product is published under the\nGNU General Public License\nVersion 3, 29 June 2007", 16.dp)
|
||||
AboutTextElement("Developed by:\n- Paul Posch\n- Matthias Meyer\n- Jakub Szarko\n- Emilian Bührer", 32.dp)
|
||||
AboutTextElement("Fun Facts:\nThis app consists of 2.873 lines of code\nThe repository is 413KB big\nThe development took about 3 month", 64.dp) //TODO: Update before launch
|
||||
AboutTextElement("Fun Facts:\nThis app consists of 4.189 lines of code\nThe repository is 768KB big\nThe development took about 3 months", 64.dp)
|
||||
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
Divider()
|
||||
Box(contentAlignment = Alignment.CenterStart,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable {
|
||||
val intent =
|
||||
Intent(Intent.ACTION_VIEW, Uri.parse("https://ko-fi.com/cleverclass"))
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
) {
|
||||
Row {
|
||||
Text(
|
||||
text = "Support the Devs",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Image(
|
||||
painter = painterResource(R.drawable.baseline_open_in_browser_24),
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.gestures.detectTransformGestures
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -12,8 +13,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
@@ -25,13 +25,22 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.lang.Float.max
|
||||
import java.lang.Float.min
|
||||
|
||||
private lateinit var folder : File
|
||||
private lateinit var information : JSONObject
|
||||
@@ -64,6 +73,10 @@ class DSBDayViewActivity : ComponentActivity() {
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DSBDayViewContent(activity: ComponentActivity){
|
||||
var scale by remember { mutableStateOf(1f) }
|
||||
var XOffset by remember { mutableStateOf(0f) }
|
||||
var YOffset by remember { mutableStateOf(0f) }
|
||||
|
||||
Column{
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
@@ -83,24 +96,43 @@ fun DSBDayViewContent(activity: ComponentActivity){
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.zIndex(1f)
|
||||
)
|
||||
|
||||
val imageFiles = folder.listFiles { file -> file.extension == "jpg" }?.toList()
|
||||
|
||||
Column(
|
||||
LazyColumn(
|
||||
userScrollEnabled = true,
|
||||
modifier = Modifier
|
||||
.padding(8.dp)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.pointerInput(Unit) {
|
||||
detectTransformGestures { _, move, zoom, _ ->
|
||||
scale = max(min(zoom * scale, 2f), 1f)
|
||||
val maxXOffset = 520 * (scale - 1)
|
||||
val maxYOffset = 992 * (scale - 1)
|
||||
XOffset = max(min(XOffset + move.x, maxXOffset), -maxXOffset)
|
||||
YOffset = max(min(YOffset + move.y, maxYOffset), -maxYOffset)
|
||||
}
|
||||
}
|
||||
.graphicsLayer(
|
||||
scaleX = scale,
|
||||
scaleY = scale,
|
||||
translationX = XOffset,
|
||||
translationY = YOffset
|
||||
)
|
||||
) {
|
||||
imageFiles?.forEach {
|
||||
Image(
|
||||
bitmap = BitmapFactory.decodeFile(it.absolutePath).asImageBitmap(),
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
item {
|
||||
Image(
|
||||
bitmap = BitmapFactory.decodeFile(it.absolutePath).asImageBitmap(),
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,19 @@ private fun decompressGZIPAndDecodeBase64(compressedData: String): String {
|
||||
private fun downloadImagesTask(jsonResponse: JSONObject, mainDir : File) : Int {
|
||||
clearFolder(mainDir)
|
||||
|
||||
val jsonDaysObject = jsonResponse.getJSONArray("ResultMenuItems").getJSONObject(0).getJSONArray("Childs").getJSONObject(0).getJSONObject("Root").getJSONArray("Childs")
|
||||
var jsonDaysObject = jsonResponse.getJSONArray("ResultMenuItems")
|
||||
for (i in 0 until jsonDaysObject.length()) {
|
||||
if (jsonDaysObject.getJSONObject(i).get("Index") == 0) {
|
||||
jsonDaysObject = jsonDaysObject.getJSONObject(i).getJSONArray("Childs")
|
||||
break
|
||||
}
|
||||
}
|
||||
for (i in 0 until jsonDaysObject.length()) {
|
||||
if (jsonDaysObject.getJSONObject(i).get("Index") == 0) {
|
||||
jsonDaysObject = jsonDaysObject.getJSONObject(i).getJSONObject("Root").getJSONArray("Childs")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for (d in 0 until jsonDaysObject.length()) {
|
||||
val jsonDayObject = jsonDaysObject.getJSONObject(d)
|
||||
@@ -201,20 +213,6 @@ private fun createDataFolder(context: Context) : File {
|
||||
return folder
|
||||
}
|
||||
|
||||
private fun clearFolder(directory: File) {
|
||||
if (directory.exists()) {
|
||||
val files = directory.listFiles()
|
||||
if (files != null) {
|
||||
for (file in files) {
|
||||
if (file.isDirectory) {
|
||||
clearFolder(file)
|
||||
}
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInternetAvailable(context: Context): Boolean {
|
||||
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
val network = connectivityManager.activeNetwork
|
||||
|
||||
@@ -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) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -86,11 +86,15 @@ fun MainContent(activity: ComponentActivity){
|
||||
MainButton(onClick = { switchToActivity(activity, StundenplanActivity::class.java) }, color = Color(0xFFFF4081), text = "Stundenplan", sharedPreferences)
|
||||
MainButton(onClick = { switchToActivity(activity, NotenActivity::class.java) }, color = Color(0xFFE040FB), text = "Noten", sharedPreferences)
|
||||
MainButton(onClick = { switchToActivity(activity, PSEActivity::class.java) }, color = Color(0xFF536DFE), text = "Periodensystem", sharedPreferences)
|
||||
MainButton(onClick = {
|
||||
MainButton(onClick = { switchToActivity(activity, DSBActivity::class.java) }, color = Color(0xFFFF6E40), text = "DSBmobile", sharedPreferences)
|
||||
MainButton(
|
||||
onClick = {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://mebis.bycs.de/"))
|
||||
activity.startActivity(intent)
|
||||
}, color = Color(0xFF7C4DFF), text = "Mebis", sharedPreferences)
|
||||
MainButton(onClick = { switchToActivity(activity, DSBActivity::class.java) }, color = Color(0xFFFF6E40), text = "DSBmobile", sharedPreferences)
|
||||
},
|
||||
color = Color(0xFF7C4DFF),
|
||||
text = "Mebis", sharedPreferences
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ fun PSEContent(activity: ComponentActivity){
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var rootObj : JSONObject
|
||||
|
||||
private val colors = listOf(
|
||||
Color(0xFFBCA76D),
|
||||
@@ -117,7 +118,7 @@ private val elementButtonColors = listOf(
|
||||
@Composable
|
||||
fun PSEMainContent(activity: ComponentActivity) {
|
||||
val inputStream = activity.assets.open("elements_data.json")
|
||||
val rootObj = JSONObject(InputStreamReader(inputStream).readText())
|
||||
rootObj = JSONObject(InputStreamReader(inputStream).readText())
|
||||
|
||||
var showInfo by remember {
|
||||
mutableStateOf(false)
|
||||
@@ -151,7 +152,7 @@ fun PSEMainContent(activity: ComponentActivity) {
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = "",
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
@@ -204,7 +205,7 @@ fun PSEMainContent(activity: ComponentActivity) {
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.horizontalScroll(rememberScrollState()),
|
||||
text = readElementData(rootObj, dcValue),
|
||||
text = readElementData(dcValue),
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
@@ -293,8 +294,8 @@ fun InformationBox(text: String, color: Color){
|
||||
}
|
||||
}
|
||||
|
||||
private fun readElementData(jsonObject: JSONObject, int: Int): String {
|
||||
val elementData = jsonObject.getJSONArray("elements").getJSONObject(int)
|
||||
private fun readElementData(int: Int): String {
|
||||
val elementData = rootObj.getJSONArray("elements").getJSONObject(int)
|
||||
return "Name:\n${elementData.get("Name")}\n\n" +
|
||||
"Ordnungszahl:\n${elementData.get("Ordnungszahl")}\n\n" +
|
||||
"Gruppe:\n${elementData.get("Gruppe")}\n\n" +
|
||||
@@ -305,9 +306,8 @@ private fun readElementData(jsonObject: JSONObject, int: Int): String {
|
||||
"Elektronegativität:\n${elementData.get("Elektronegativität")}\n\n" +
|
||||
"Schmelztemperatur:\n${elementData.get("Schmelztemperatur")}\n\n" +
|
||||
"Siedetemperatur:\n${elementData.get("Siedetemperatur")}\n\n" +
|
||||
"künstlich:\n${elementData.get("künstlich")}\n\n" +
|
||||
"radioaktiv:\n${elementData.get("radioaktiv")}\n\n" +
|
||||
"Halbwertszeit:\n${elementData.get("Halbwertszeit")}\n\n" +
|
||||
"Strahlungsart:\n${elementData.get("Strahlungsart")}\n\n" +
|
||||
"künstlich:\n${elementData.get("künstlich")}\n\n" +
|
||||
"langlebigstes Isotop:\n${elementData.get("langlebigstes Isotop")}"
|
||||
"Strahlungsart:\n${elementData.get("Strahlungsart")}"
|
||||
}
|
||||
@@ -19,10 +19,12 @@ 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
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
@@ -34,8 +36,10 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -63,6 +67,10 @@ fun SettingsContent(activity: ComponentActivity) {
|
||||
val sharedPreferences = activity.getSharedPreferences("Settings", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences.edit()
|
||||
|
||||
var showDeleteConfirmation by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
// Top AppBar
|
||||
TopAppBar(
|
||||
@@ -93,14 +101,14 @@ fun SettingsContent(activity: ComponentActivity) {
|
||||
.weight(1f)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxWidth()
|
||||
|
||||
) {
|
||||
Setting(text = "Stundenplan", sharedPreferences, editor)
|
||||
Setting(text = "Noten", sharedPreferences, editor)
|
||||
Setting(text = "Periodensystem", sharedPreferences, editor)
|
||||
Setting(text = "Mebis", sharedPreferences, editor)
|
||||
Setting(text = "DSBmobile", sharedPreferences, editor)
|
||||
Setting(text = "Mebis", sharedPreferences, editor)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Divider()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@@ -119,6 +127,19 @@ fun SettingsContent(activity: ComponentActivity) {
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
Divider()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { showDeleteConfirmation = true }
|
||||
) {
|
||||
Text(
|
||||
text = "Alle Daten löschen",
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// About Button
|
||||
@@ -129,19 +150,63 @@ 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))
|
||||
}
|
||||
}
|
||||
|
||||
if(showDeleteConfirmation){
|
||||
AlertDialog(
|
||||
onDismissRequest = { showDeleteConfirmation = false },
|
||||
text = {
|
||||
Text(
|
||||
text = "Möchten Sie wirklich alle Daten aus dieser App löschen?\n" +
|
||||
"Dieser Vorgang kann nicht rückgängig gemacht werden.",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Row(modifier = Modifier.fillMaxWidth()){
|
||||
Text(
|
||||
text = "Löschen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.clickable {
|
||||
deleteAllData(activity)
|
||||
showDeleteConfirmation = false
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Text(
|
||||
text = "Abbrechen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.clickable { showDeleteConfirmation = false }
|
||||
)
|
||||
}
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -2,17 +2,28 @@ package com.schoolapp.cleverclass
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.icu.text.DecimalFormat
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.outlined.Edit
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
@@ -22,31 +33,44 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.getLessons
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private val listOfDays = listOf("mon", "tue", "wed", "thu", "fri", "sat", "sun")
|
||||
private val lessonGrabberIndex = 0
|
||||
private val listOfDays = listOf("Mo", "Di", "Mi", "Do", "Fr")
|
||||
private val listOfBreakIndexes = mutableListOf<Int>()
|
||||
|
||||
class StundenplanActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val sharedPreferences = this.getSharedPreferences("TimeTable", Context.MODE_PRIVATE)
|
||||
val maxLessons = sharedPreferences.getString("maxLessons", "").toString()
|
||||
val lessonLength = sharedPreferences.getString("lessonLength", "").toString()
|
||||
val setupDone = sharedPreferences.getBoolean("setupDone", false)
|
||||
|
||||
val lessons = MutableList(5) { listOf<LessonData>() }
|
||||
|
||||
//Loading saved lessons when NOT auto-loading the setup
|
||||
if (setupDone) {
|
||||
listOfDays.forEachIndexed { index, dayLessons ->
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getLessons(this@StundenplanActivity, dayLessons).collect { savedLessons ->
|
||||
lessons[index] = savedLessons.toMutableList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
@@ -54,16 +78,15 @@ class StundenplanActivity : ComponentActivity() {
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
println(maxLessons)
|
||||
//println(lessonLength)
|
||||
if (maxLessons.isEmpty() || lessonLength.isEmpty()) {
|
||||
//Auto-load setup, if incomplete
|
||||
if (!setupDone) {
|
||||
val intent = Intent(this@StundenplanActivity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "FirstSetup")
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
StundenplanContent(activity = this)
|
||||
StundenplanContent(activity = this, lessons)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,8 +96,24 @@ class StundenplanActivity : ComponentActivity() {
|
||||
// Content of Stundenplan
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun StundenplanContent(activity: ComponentActivity){
|
||||
Column() {
|
||||
fun StundenplanContent(activity: ComponentActivity, loadedLessons: List<List<LessonData>>){
|
||||
//Declaration of most sharedPreferences-stored data (same SharedPreferences as in TimeTableSetupActivity.kt)
|
||||
val sharedPreferences = activity.getSharedPreferences("TimeTable", Context.MODE_PRIVATE)
|
||||
val lessonLength = sharedPreferences.getInt("lessonLength", 0)
|
||||
val firstLesson = sharedPreferences.getFloat("firstLesson", 0.0f).toString()
|
||||
val breakAmnt = sharedPreferences.getInt("breakAmnt", 0)
|
||||
val listOfBreakStartTimes = mutableListOf<String>()
|
||||
val listOfBreakLengths = mutableListOf<Int>()
|
||||
for (i in 0 until breakAmnt) {
|
||||
listOfBreakStartTimes.add(sharedPreferences.getFloat("break${i}StartTime", 0.0f).toString())
|
||||
listOfBreakLengths.add(sharedPreferences.getInt("break${i}Length", 0))
|
||||
}
|
||||
|
||||
var showInfo by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
Column {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
title = {
|
||||
@@ -92,50 +131,325 @@ fun StundenplanContent(activity: ComponentActivity){
|
||||
)
|
||||
}
|
||||
},
|
||||
actions ={
|
||||
//Info button
|
||||
IconButton(
|
||||
onClick = { showInfo = !showInfo }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
//Edit button
|
||||
IconButton(
|
||||
onClick = {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Edit,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Column() {
|
||||
listOfDays.forEach() {currentDay ->
|
||||
Day(currentDay)
|
||||
//Start of the timetable --> One Row() with multiple Column() to create the table
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.horizontalScroll(rememberScrollState())
|
||||
) {
|
||||
//Left-handed lesson indexing with beginning time of each lesson or break
|
||||
InfoColumn(
|
||||
loadedLessons = loadedLessons,
|
||||
breakAmnt = breakAmnt,
|
||||
breaksStartTime = listOfBreakStartTimes,
|
||||
firstLesson = firstLesson,
|
||||
lessonLength = lessonLength,
|
||||
breaksLength = listOfBreakLengths
|
||||
)
|
||||
|
||||
//Creation of 5 Columns
|
||||
loadedLessons.forEachIndexed { index, dailyLessons ->
|
||||
//Width variable for variable Box sizes
|
||||
Column(modifier = Modifier.width(250.dp)) {
|
||||
//Additional extraIndex to count lessons without breaks getting into the way
|
||||
var extraIndex = 0
|
||||
|
||||
//Box with the day on top of each Column()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(250.dp, 50.dp)
|
||||
.padding(3.dp)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = listOfDays[index],
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
|
||||
//Core timetable
|
||||
//One Box for each lesson or break
|
||||
for (i in 0 until (dailyLessons.size + breakAmnt)) {
|
||||
//If the current index is saved as a break in listOfBreakIndexes --> Spacer Box
|
||||
if (listOfBreakIndexes.indexOf(i) != -1) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(250.dp, 100.dp)
|
||||
)
|
||||
}
|
||||
//Else creation of a Box containing all the information from the LessonData object
|
||||
else if (dailyLessons != emptyList<LessonData>() && dailyLessons.size != extraIndex) {
|
||||
LessonBox(subject = dailyLessons[extraIndex].subject, teacher = dailyLessons[extraIndex].teacher, room = dailyLessons[extraIndex].room)
|
||||
//ExtraIndex counted up only here as it does only index the lessons and NOT the breaks
|
||||
extraIndex++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Right-handed lesson indexing with beginning time of each lesson or break
|
||||
InfoColumn(
|
||||
loadedLessons = loadedLessons,
|
||||
breakAmnt = breakAmnt,
|
||||
breaksStartTime = listOfBreakStartTimes,
|
||||
firstLesson = firstLesson,
|
||||
lessonLength = lessonLength,
|
||||
breaksLength = listOfBreakLengths
|
||||
)
|
||||
}
|
||||
}
|
||||
if (showInfo) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showInfo = false },
|
||||
text = {
|
||||
Text(
|
||||
text = "Die Breite der Spalten ist auf eine bestimmte Größe festgelegt.\n\n" +
|
||||
"Zu lange Eingaben können horizontal gescrollt werden.",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium)
|
||||
},
|
||||
confirmButton = {
|
||||
Text(
|
||||
text = "Schließen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.clickable { showInfo = false }
|
||||
)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//Data class to save objects via DataShare containing information about lessons
|
||||
data class LessonData(
|
||||
val subject: String,
|
||||
val teacher: String,
|
||||
val room: String
|
||||
var subject: String,
|
||||
var teacher: String,
|
||||
var room: String
|
||||
)
|
||||
|
||||
|
||||
//Implementation of Box with a darker border than the other Boxes
|
||||
// contains the information from the corresponding LessonData object
|
||||
@Composable
|
||||
fun Day(day: String) {
|
||||
var lessons = emptyList<LessonData>()
|
||||
val context = LocalContext.current
|
||||
Column {
|
||||
LaunchedEffect(lessons, context) {
|
||||
getLessons(context, day).collect { savedLessons ->
|
||||
lessons = savedLessons.toMutableList()
|
||||
fun LessonBox(subject: String, teacher: String, room: String) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(250.dp, 100.dp)
|
||||
.padding(3.dp)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column {
|
||||
if (subject != "") {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(horizontal = 5.dp),
|
||||
text = subject,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
if (room != "") {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(horizontal = 5.dp),
|
||||
text = room,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
if (teacher != "") {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(horizontal = 5.dp),
|
||||
text = teacher,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
lessons.forEach() {
|
||||
Lesson(subject = it.subject, teacher = it.teacher, room = it.room)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Left-/Right-Handed info Column
|
||||
@Composable
|
||||
fun InfoColumn(loadedLessons: List<List<LessonData>>, breakAmnt: Int, breaksStartTime: List<String>, firstLesson: String, lessonLength: Int, breaksLength: List<Int>) {
|
||||
Column {
|
||||
//Determining how much lessons the longest day of the week has
|
||||
var maxLessons = 0
|
||||
for (dailyLessons in loadedLessons) {
|
||||
if (dailyLessons.size > maxLessons) {
|
||||
maxLessons = dailyLessons.size
|
||||
}
|
||||
}
|
||||
|
||||
//Variable for time management with custom break times
|
||||
var lessonTimeIncrement = 0
|
||||
//Variable for decreasing the number in the InfoColumn after a "Pause" String
|
||||
var lessonNegIncrement = 0
|
||||
//Additional extraIndex to count lessons without breaks getting into the way
|
||||
var extraIndex = 0
|
||||
|
||||
//Clear the list of brake indexes needed earlier in the timetable core
|
||||
listOfBreakIndexes.drop(listOfBreakIndexes.size)
|
||||
|
||||
//Spacer Box
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(100.dp, 50.dp)
|
||||
.padding(3.dp)
|
||||
)
|
||||
//Loop for creating Boxes on the side
|
||||
for (i in 0 until (maxLessons + breakAmnt)) {
|
||||
//Boolean to avoid double creation of the same Box
|
||||
var loopDone = false
|
||||
//Loop through all saved break start time
|
||||
for (breakTime in breaksStartTime) {
|
||||
if (!loopDone) {
|
||||
//Variable = minutes of the currently looked at break
|
||||
var formattedBreakSubstring = breakTime.substringAfter('.')
|
||||
//When the Float wos like XX.n, it the n-Part will be n0 (fix for values 10, 20, etc.)
|
||||
if (formattedBreakSubstring == "1" || formattedBreakSubstring == "2" || formattedBreakSubstring == "3" || formattedBreakSubstring == "4" || formattedBreakSubstring == "5") {
|
||||
formattedBreakSubstring += "0"
|
||||
}
|
||||
//Format start time of the break the same way as the lesson start time is formatted
|
||||
val formattedBreakTime = "@" + DecimalFormat("00").format(breakTime.substringBefore('.').toInt()) + ":" + DecimalFormat("00").format(formattedBreakSubstring.toInt())
|
||||
//Check whether the start time of the currently looked at brake and lesson are the sa,e
|
||||
if (substringHelper(extraIndex, firstLesson, lessonLength, lessonTimeIncrement) == formattedBreakTime) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(100.dp)
|
||||
.padding(3.dp)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
) {
|
||||
//"Pause" String instead of indexing
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.scale(1.1f),
|
||||
text = "Pause",
|
||||
textDecoration = TextDecoration.Underline,
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
//String with the starting time of the current break
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.padding(3.dp)
|
||||
.scale(0.8f),
|
||||
text = formattedBreakTime,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
//Add length of current break to the increment
|
||||
lessonTimeIncrement += breaksLength[breaksStartTime.indexOf(breakTime)]
|
||||
//Add info that one moe brake exists to the indexing increment
|
||||
lessonNegIncrement++
|
||||
//Add the extraIndex (lessonIndex) into the listOfBreakIndexes list to include breaks in timetable core
|
||||
listOfBreakIndexes.add(i)
|
||||
//Prevent double creation of Boxes
|
||||
loopDone = true
|
||||
}
|
||||
}
|
||||
//When looped through all breaks, but none fitted
|
||||
else if (breakTime == breaksStartTime.last()) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(100.dp)
|
||||
.padding(3.dp)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
) {
|
||||
//String with the indexing of the lessons
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.scale(1.1f),
|
||||
text = "${i + 1 - lessonNegIncrement}:",
|
||||
textDecoration = TextDecoration.Underline,
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
//String with the starting time of the lesson
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.padding(3.dp)
|
||||
.scale(0.8f),
|
||||
text = substringHelper(extraIndex, firstLesson, lessonLength, lessonTimeIncrement),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
//Prevent double creation of Boxes
|
||||
loopDone = true
|
||||
//Counting up the lesson only index
|
||||
extraIndex++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Lesson(subject: String, teacher: String, room: String) {
|
||||
Box(modifier = Modifier
|
||||
.size(200.dp, 100.dp)
|
||||
.padding(3.dp)
|
||||
) {
|
||||
Text(modifier = Modifier.align(Alignment.Center),
|
||||
text = "$subject\n@$room\n/w$teacher")
|
||||
//Function that moves the formatting and calculation of the lesson start times away from in-line
|
||||
fun substringHelper (int: Int, eductString: String, lessonLength: Int, increment: Int): String {
|
||||
//Variable = minutes of the entered Time
|
||||
var subString = eductString.substringAfter('.')
|
||||
//Fix of 10, 20, etc.
|
||||
if (subString == "1" || subString == "2" || subString == "3" || subString == "4" || subString == "5") {
|
||||
subString += "0"
|
||||
}
|
||||
}
|
||||
|
||||
fun currentDay(): String {
|
||||
return "hi"
|
||||
//Calculation based on start time of the first hour, lesson length, indexing of the current lesson (extraIndex!) and the increment calculated from the break times
|
||||
//Formatting to "@hh:mm"
|
||||
val productString = "@" + DecimalFormat("00").format((((subString.toInt() + int * lessonLength) + increment) / 60) + eductString.substringBefore('.').toInt()) + ":" + DecimalFormat("00").format((((subString.toInt()) + int * lessonLength) + increment) % 60)
|
||||
//Return statement to use the formatted and calculated product in the timetable
|
||||
return productString
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.schoolapp.cleverclass
|
||||
|
||||
import android.app.TimePickerDialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.icu.text.DecimalFormat
|
||||
import android.icu.text.DecimalFormatSymbols
|
||||
import android.icu.util.Calendar
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -17,6 +22,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
@@ -24,20 +30,30 @@ import androidx.compose.foundation.text.selection.TextSelectionColors
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material.icons.outlined.Edit
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material.ripple.LocalRippleTheme
|
||||
import androidx.compose.material.ripple.RippleAlpha
|
||||
import androidx.compose.material.ripple.RippleTheme
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.TabRow
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -45,25 +61,59 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.getLessons
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.saveLessons
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
import com.schoolapp.cleverclass.ui.theme.InputPrimaryColor
|
||||
import com.schoolapp.cleverclass.ui.theme.InputSecondaryColor
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Locale
|
||||
|
||||
private lateinit var activityType : String
|
||||
private lateinit var activityState : String
|
||||
private val listOfDays = listOf("Mo", "Di", "Mi", "Do", "Fr")
|
||||
|
||||
//Custom ripple to remove effect when touching tabs
|
||||
private class CustomRippleTheme : RippleTheme {
|
||||
@Composable
|
||||
override fun defaultColor(): Color = Color.Unspecified
|
||||
|
||||
@Composable
|
||||
override fun rippleAlpha(): RippleAlpha = RippleAlpha(
|
||||
draggedAlpha = 0f,
|
||||
focusedAlpha = 0f,
|
||||
hoveredAlpha = 0f,
|
||||
pressedAlpha = 0f
|
||||
)
|
||||
}
|
||||
|
||||
class TimeTableSetupActivity : ComponentActivity() {
|
||||
companion object{
|
||||
const val TYPE_KEY = "type_key"
|
||||
const val STATE_KEY = "state_key"
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
//Defines setup type --> Time vs. Day
|
||||
activityType = intent.getStringExtra(TYPE_KEY).toString()
|
||||
//Defines curent day of week
|
||||
activityState = intent.getStringExtra(STATE_KEY).toString()
|
||||
|
||||
//Load lessons of defined day from activityState
|
||||
var lessons = listOf<LessonData>()
|
||||
if (activityType == "DaySetup") {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getLessons(this@TimeTableSetupActivity, listOfDays[activityState.toInt()]).collect { savedLessons ->
|
||||
lessons = savedLessons.toList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
@@ -71,7 +121,7 @@ class TimeTableSetupActivity : ComponentActivity() {
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
TimeTableSetupContent(activity = this)
|
||||
TimeTableSetupContent(activity = this, lessons)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +132,8 @@ class TimeTableSetupActivity : ComponentActivity() {
|
||||
// Content of TimeTableSetup
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<LessonData>){
|
||||
//One-time definition of the inputField colorscheme
|
||||
val inputFieldColors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
textColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
@@ -93,34 +144,65 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
),
|
||||
focusedBorderColor = InputSecondaryColor,
|
||||
unfocusedBorderColor = Color.Transparent
|
||||
)
|
||||
)
|
||||
|
||||
//Declaration of most sharedPreferences-stored data
|
||||
val sharedPreferences = activity.getSharedPreferences("TimeTable", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences.edit()
|
||||
|
||||
var maxLessons by remember {
|
||||
mutableStateOf(sharedPreferences.getString("maxLessons", "-1").toString())
|
||||
}
|
||||
//Length of one lesson
|
||||
var lessonLength by remember {
|
||||
mutableStateOf(sharedPreferences.getString("lessonLength", "-1").toString())
|
||||
}
|
||||
var showPassword by remember {
|
||||
mutableStateOf(false)
|
||||
mutableStateOf(sharedPreferences.getInt("lessonLength", 0).toString())
|
||||
}
|
||||
|
||||
//Number of breaks on one day
|
||||
var breakAmnt by remember {
|
||||
mutableStateOf(sharedPreferences.getInt("breakAmnt", 0).toString())
|
||||
}
|
||||
|
||||
//Beginning time of the first lesson (Format: hh.mm)
|
||||
var firstLesson by remember {
|
||||
mutableStateOf(sharedPreferences.getFloat("firstLesson", 0.0f))
|
||||
}
|
||||
|
||||
//Value to determine whether the first setup will be loaded again
|
||||
var setupDone by remember {
|
||||
mutableStateOf(sharedPreferences.getBoolean("setupDone", false))
|
||||
}
|
||||
|
||||
//AlertDialog
|
||||
var showInfo by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
var showDeleteConfirmation by remember {
|
||||
mutableStateOf(false)
|
||||
|
||||
//Variable for loaded lessons from onCreate()
|
||||
var lessons by remember {
|
||||
mutableStateOf(loadedLessons)
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
title = { Text(text = "") },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { activity.finish() }) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
activity.finish()
|
||||
if (setupDone) {
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
else {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.ArrowBack,
|
||||
contentDescription = null,
|
||||
@@ -138,6 +220,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
.fillMaxHeight()
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
//Background
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = RoundedCornerShape(20),
|
||||
@@ -146,6 +229,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
//Title
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = "Stundenplan Setup",
|
||||
@@ -155,109 +239,452 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
if (activityType == "Settings")
|
||||
IconButton(onClick = { showDeleteConfirmation = !showDeleteConfirmation }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Delete,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
else if (activityType == "FirstSetup")
|
||||
IconButton(onClick = { showInfo = !showInfo }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
|
||||
//Info Button --> AlertDialog
|
||||
IconButton(onClick = { showInfo = !showInfo }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
value = maxLessons,
|
||||
onValueChange = { maxLessons = it },
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "Maximale Stundenanzahl an einem Tag",
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
value = lessonLength,
|
||||
onValueChange = { lessonLength = it },
|
||||
placeholder = {
|
||||
//Setup for basic time data (lesson/break length etc.)
|
||||
if (activityType == "TimeSetup") {
|
||||
//Time input begin of first lesson
|
||||
Text(
|
||||
text = "Beginn der 1. Stunde",
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
OutlinedButton(
|
||||
onClick = {
|
||||
val c = Calendar.getInstance()
|
||||
val mHour = c.get(Calendar.HOUR_OF_DAY)
|
||||
val mMinute = c.get(Calendar.MINUTE)
|
||||
val timePickerDialog = TimePickerDialog(activity, TimePickerDialog.OnTimeSetListener(function = { view, h, m ->
|
||||
firstLesson = h.toFloat() + (m.toFloat() / 100)
|
||||
editor.putFloat("firstLesson", firstLesson)
|
||||
}), mHour, mMinute, true)
|
||||
timePickerDialog.show()
|
||||
},
|
||||
modifier = Modifier.align(Alignment.Start)
|
||||
) {
|
||||
val locale = Locale.getDefault()
|
||||
val symbols = DecimalFormatSymbols(locale)
|
||||
symbols.decimalSeparator = ':'
|
||||
val decimalFormat = DecimalFormat("00.00", symbols)
|
||||
|
||||
Text(
|
||||
text = "Länge einer Schulstunde",
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
visualTransformation = if(showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
|
||||
trailingIcon = {
|
||||
IconButton(onClick = { showPassword = !showPassword })
|
||||
{
|
||||
Image(
|
||||
painter = painterResource(
|
||||
id = if(showPassword)
|
||||
R.drawable.baseline_visibility_24
|
||||
else
|
||||
R.drawable.baseline_visibility_off_24
|
||||
),
|
||||
contentDescription = null,
|
||||
text = decimalFormat.format(firstLesson) + " Uhr ",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
|
||||
Icon(imageVector = Icons.Outlined.Edit, contentDescription = null)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
//Duration of one lesson
|
||||
OutlinedTextField(
|
||||
value = lessonLength,
|
||||
onValueChange = { lessonLength = it },
|
||||
label = { Text(text = "Länge einer Schulstunde in min") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
//Input amount of breaks
|
||||
OutlinedTextField(
|
||||
value = breakAmnt,
|
||||
onValueChange = { breakAmnt = it},
|
||||
label = { Text(text = "Anzahl der Pausen") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
|
||||
//Input of length and start time for each break
|
||||
if (breakAmnt != "") {
|
||||
//declaration of sharedPreferences for break data
|
||||
for (i in 0 until breakAmnt.toInt()) {
|
||||
var currentBreakStartTime by remember{
|
||||
mutableStateOf(sharedPreferences.getFloat("break${i}StartTime", 0.0f))
|
||||
}
|
||||
var currentBreakLength by remember{
|
||||
mutableStateOf(sharedPreferences.getInt("break${i}Length", 0).toString())
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
//Input start time (break)
|
||||
Text(
|
||||
text = "Startzeit der ${i + 1}. Pause:",
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
OutlinedButton(
|
||||
onClick = {
|
||||
val c = Calendar.getInstance()
|
||||
val mHour = c.get(Calendar.HOUR_OF_DAY)
|
||||
val mMinute = c.get(Calendar.MINUTE)
|
||||
val timePickerDialog = TimePickerDialog(activity, TimePickerDialog.OnTimeSetListener(function = { view, h, m ->
|
||||
currentBreakStartTime = h.toFloat() + (m.toFloat() / 100)
|
||||
editor.putFloat("break${i}StartTime", currentBreakStartTime)
|
||||
}), mHour, mMinute, true)
|
||||
timePickerDialog.show()
|
||||
},
|
||||
modifier = Modifier.align(Alignment.Start)
|
||||
) {
|
||||
val locale = Locale.getDefault()
|
||||
val symbols = DecimalFormatSymbols(locale)
|
||||
symbols.decimalSeparator = ':'
|
||||
val decimalFormat = DecimalFormat("00.00", symbols)
|
||||
|
||||
Text(
|
||||
text = decimalFormat.format(currentBreakStartTime) + " Uhr ",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
|
||||
Icon(imageVector = Icons.Outlined.Edit, contentDescription = null)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(5.dp))
|
||||
|
||||
//Input duration (break)
|
||||
OutlinedTextField(
|
||||
value = currentBreakLength,
|
||||
onValueChange = {
|
||||
currentBreakLength = it
|
||||
if (currentBreakLength != "") {
|
||||
editor.putInt("break${i}Length", currentBreakLength.toInt())
|
||||
}},
|
||||
label = { Text(text = "Länge der ${i + 1}. Pause in min") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.clickable {
|
||||
editor.putString("maxLessons", maxLessons)
|
||||
editor.putString("lessonLength", lessonLength)
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
Row {
|
||||
//Go back to StundenplanActivity
|
||||
FilledTonalButton(
|
||||
onClick = {
|
||||
editor.putInt("lessonLength", lessonLength.toInt())
|
||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
if (setupDone) {
|
||||
//Reopen of activity so values will be updated
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
else {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Zurück",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier
|
||||
.width(5.dp)
|
||||
)
|
||||
|
||||
//Move on to DaySetup
|
||||
Button(
|
||||
onClick = {
|
||||
editor.putInt("lessonLength", lessonLength.toInt())
|
||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
//State 0 for indexing days (0..4)
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "0")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Weiter",
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = "Speichen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.padding(10.dp)
|
||||
}
|
||||
|
||||
//DaySetup for information on the lessons (teacher, subject, amount per day, etc.)
|
||||
else if (activityType == "DaySetup") {
|
||||
//State that defines the current day (e.g. for LessonData or the Tab highlighting)
|
||||
val state by remember {
|
||||
mutableStateOf(activityState.toInt())
|
||||
}
|
||||
|
||||
//SharedPreferences for the amount of hours of each day (indexed by state --> 0..4)
|
||||
var currentLessonAmount by remember {
|
||||
mutableStateOf(sharedPreferences.getInt("lessonAmount${listOfDays[state]}", 0).toString())
|
||||
}
|
||||
|
||||
//TabRow with Tabs to visualize the days; no onClick fun and thus the custom ripple theme
|
||||
CompositionLocalProvider(LocalRippleTheme provides CustomRippleTheme()) {
|
||||
TabRow(selectedTabIndex = state,
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer) {
|
||||
for (day in listOfDays) {
|
||||
Tab(selected = false,
|
||||
onClick = {},
|
||||
modifier = Modifier.padding(5.dp)
|
||||
) {
|
||||
Text(
|
||||
text = day,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
//Input of the amount of lessons on the current day
|
||||
OutlinedTextField(
|
||||
value = currentLessonAmount,
|
||||
onValueChange = {
|
||||
currentLessonAmount = it
|
||||
if (currentLessonAmount == "") {
|
||||
editor.putInt("lessonAmount${listOfDays[state]}", 0)
|
||||
}
|
||||
else {
|
||||
editor.putInt("lessonAmount${listOfDays[state]}", currentLessonAmount.toInt())
|
||||
}
|
||||
},
|
||||
label = { Text(text = "Anzahl der Schulstunden (${listOfDays[state]})") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
|
||||
//Creation of TextField for further input for the lessons themselves + saveUsage into DataStore --> saveLessonUsage(...)
|
||||
if (currentLessonAmount != "") {
|
||||
if (currentLessonAmount != "0") {
|
||||
//Creation/Removal of the current amount of LessonData object depending pn currentLessonAmount
|
||||
for (i in lessons.size until currentLessonAmount.toInt()) {
|
||||
lessons = lessons + LessonData("", "", "")
|
||||
}
|
||||
while (currentLessonAmount.toInt() < lessons.size) {
|
||||
lessons = lessons.dropLast(1)
|
||||
}
|
||||
|
||||
lessons.forEachIndexed { index, lessonData ->
|
||||
//Input variables
|
||||
var currentSubject by remember {
|
||||
mutableStateOf(lessonData.subject)
|
||||
}
|
||||
var currentTeacher by remember {
|
||||
mutableStateOf(lessonData.teacher)
|
||||
}
|
||||
var currentRoom by remember {
|
||||
mutableStateOf(lessonData.room)
|
||||
}
|
||||
|
||||
//Input of the subject of the current lesson
|
||||
OutlinedTextField(
|
||||
value = currentSubject,
|
||||
onValueChange = {
|
||||
currentSubject = it
|
||||
lessonData.subject = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Fach der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
|
||||
//Input of the room of the current lesson
|
||||
OutlinedTextField(
|
||||
value = currentRoom,
|
||||
onValueChange = {
|
||||
currentRoom = it
|
||||
lessonData.room = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Raum der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
|
||||
//Input of the teacher of the current lesson
|
||||
OutlinedTextField(
|
||||
value = currentTeacher,
|
||||
onValueChange = {
|
||||
currentTeacher = it
|
||||
lessonData.teacher = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Lehrer der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
}
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
}
|
||||
//save an empty list into DataStore currentLessonAmount == 0
|
||||
else {
|
||||
saveLessonsUsage(activity, emptyList(), state)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
//Checkbox on the friday page (state == 4) to prevent setup from automatically openening next time
|
||||
if (state == 4) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(2.dp)
|
||||
.fillMaxWidth()
|
||||
.background(color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
)
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Ertes Setup beendet?",
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
Checkbox(checked = setupDone, onCheckedChange = {setupDone = !setupDone})
|
||||
}
|
||||
}
|
||||
|
||||
//Go back
|
||||
Row {
|
||||
FilledTonalButton(
|
||||
onClick = {
|
||||
activity.finish()
|
||||
//To TimeSetup
|
||||
if (state == 0) {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
//To the day before (STATE_KEY -= 1)
|
||||
else {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "${state - 1}")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Zurück",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier
|
||||
.width(5.dp)
|
||||
)
|
||||
|
||||
//Go forwards
|
||||
Button(
|
||||
onClick = {
|
||||
activity.finish()
|
||||
//To next day (STATE_KEY += 1)
|
||||
if (state != 4) {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "${state + 1}")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
//To Stundenplan
|
||||
else {
|
||||
editor.putBoolean("setupDone", setupDone)
|
||||
//Reopen of activity so values will be updated
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
editor.apply()
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Weiter",
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//AlertDialog to inform the user of the possibility of changing all inputs later
|
||||
if (showInfo) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showInfo = false },
|
||||
text = {
|
||||
Text(
|
||||
text = "Der Benutzername und das Passwort können später in den Einstellungen geändert werden",
|
||||
text = "Alle Eingaben können später geändert werden.",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium)
|
||||
},
|
||||
@@ -274,43 +701,11 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
.padding(5.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (showDeleteConfirmation) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showDeleteConfirmation = false },
|
||||
text = {
|
||||
Text(
|
||||
text = "Möchten Sie wirklich die Anmeldedaten löschen?",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Row(modifier = Modifier.fillMaxWidth()){
|
||||
Text(
|
||||
text = "Bestätigen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.clickable {
|
||||
editor.putString("username", "")
|
||||
editor.putString("password", "")
|
||||
editor.apply()
|
||||
showDeleteConfirmation = false
|
||||
activity.finish()
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Text(
|
||||
text = "Abbrechen",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.clickable { showDeleteConfirmation = false }
|
||||
)
|
||||
}
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
//Function that implements the save of List<LessonData>
|
||||
fun saveLessonsUsage(context: Context, lessons: List<LessonData>, int: Int) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
saveLessons(context, lessons, listOfDays[int])
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.schoolapp.cleverclass
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -17,6 +21,10 @@ import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
|
||||
const val NO_INTERNET_CONNECTION_CODE = -1
|
||||
@@ -63,4 +71,47 @@ fun StaticLoadingScreen(){
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteAllData(activity: ComponentActivity){
|
||||
val sharedPrefs = listOf("Settings", "DSBmobile", "gradeAverages", "TimeTable")
|
||||
for (prefName in sharedPrefs) {
|
||||
val sharedPreferences = activity.getSharedPreferences(prefName, Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences.edit()
|
||||
editor.clear()
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
clearFolder(activity.filesDir)
|
||||
clearFolder(activity.cacheDir)
|
||||
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
restartApp(activity)
|
||||
}
|
||||
}
|
||||
|
||||
fun clearFolder(directory: File) {
|
||||
if (directory.exists()) {
|
||||
val files = directory.listFiles()
|
||||
if (files != null) {
|
||||
for (file in files) {
|
||||
if (file.isDirectory) {
|
||||
clearFolder(file)
|
||||
}
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun restartApp(context: Context) {
|
||||
val packageManager = context.packageManager
|
||||
val intent = packageManager.getLaunchIntentForPackage(context.packageName)
|
||||
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
intent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
if (context is Activity) {
|
||||
context.finish()
|
||||
}
|
||||
Runtime.getRuntime().exit(0)
|
||||
}
|
||||
@@ -8,9 +8,9 @@ val Black80 = Color(0xFF333333)
|
||||
val Black70 = Color(0xFF4B4B4B)
|
||||
|
||||
val White100 = Color(0xFFFFFFFF)
|
||||
val White90 = Color(0xFFEBEBEB)
|
||||
val White90 = Color(0xFFFAFAFA)
|
||||
val White80 = Color(0xFFD3D3D3)
|
||||
val White70 = Color(0xFFBBBBBB)
|
||||
val White70 = Color(0xFFAFAFAF)
|
||||
|
||||
|
||||
val TextOnColouredButton = Color(0xFF121212)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19,4L5,4c-1.11,0 -2,0.9 -2,2v12c0,1.1 0.89,2 2,2h4v-2L5,18L5,8h14v10h-4v2h4c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.89,-2 -2,-2zM12,10l-4,4h3v6h2v-6h3l-4,-4z"/>
|
||||
</vector>
|
||||
@@ -1,170 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_background.webp
Normal file
|
After Width: | Height: | Size: 410 B |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_background.webp
Normal file
|
After Width: | Height: | Size: 292 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_background.webp
Normal file
|
After Width: | Height: | Size: 554 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_background.webp
Normal file
|
After Width: | Height: | Size: 900 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 9.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 16 KiB |