Update Main-screen and add PSEActivity
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.schoolapp.cleverclass
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
@@ -20,12 +22,13 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
|
||||
@@ -36,7 +39,7 @@ class MainActivity : ComponentActivity() {
|
||||
CleverClassTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background) {
|
||||
Content()
|
||||
MainContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +50,8 @@ class MainActivity : ComponentActivity() {
|
||||
// Content of Main-screen
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun Content(){
|
||||
fun MainContent(){
|
||||
val context = LocalContext.current
|
||||
Column() {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.background),
|
||||
@@ -59,14 +63,14 @@ fun Content(){
|
||||
)
|
||||
|
||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFFFF8A80), text = "Periodensystem")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFF8C9EFF), text = "Stundenplan")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFFEA80FC), text = "Noten")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFF40C4FF), text = "Mebis")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFFB2FF59), text = "DSBmobile")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFF69F0AE), text = "...")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFFFFD740), text = "...")
|
||||
Button(onClick = { /*TODO*/ }, color = Color(0xFFE040FB), text = "...")
|
||||
MainButton(onClick = { switchToActivity(context, PSEActivity::class.java) }, color = Color(0xFFFF8A80), text = "Periodensystem")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFF8C9EFF), text = "Stundenplan")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFFEA80FC), text = "Noten")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFF40C4FF), text = "Mebis")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFFB2FF59), text = "DSBmobile")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFF69F0AE), text = "...")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFFFFD740), text = "...")
|
||||
MainButton(onClick = { /*TODO*/ }, color = Color(0xFFE040FB), text = "...")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,9 +78,9 @@ fun Content(){
|
||||
|
||||
// Main-menu Buttons
|
||||
@Composable
|
||||
fun Button(onClick: () -> Unit, color : Color, text : String) {
|
||||
fun MainButton(onClick: () -> Unit, color : Color, text : String) {
|
||||
Button(
|
||||
onClick = { onClick() },
|
||||
onClick = onClick,
|
||||
shape = RoundedCornerShape(40),
|
||||
colors = ButtonDefaults.outlinedButtonColors(containerColor = color),
|
||||
modifier = Modifier
|
||||
@@ -89,4 +93,9 @@ fun Button(onClick: () -> Unit, color : Color, text : String) {
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontSize = 20.sp)
|
||||
}
|
||||
}
|
||||
|
||||
fun switchToActivity(context : Context, activity : Class<*>){
|
||||
val intent = Intent(context, activity)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
Reference in New Issue
Block a user