Add first Main-screen
This commit is contained in:
@@ -3,13 +3,30 @@ package com.schoolapp.cleverclass
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
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.tooling.preview.Preview
|
||||
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.sp
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -17,30 +34,59 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
// A surface container using the 'background' color from the theme
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
Greeting("Android")
|
||||
Surface(modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background) {
|
||||
Content()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Content of Main-screen
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = "Hello $name!",
|
||||
modifier = modifier
|
||||
)
|
||||
fun Content(){
|
||||
Column() {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.background),
|
||||
title = {
|
||||
Text(text = "CleverClass",
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)))
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
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 = "...")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
||||
// Main-menu Buttons
|
||||
@Composable
|
||||
fun GreetingPreview() {
|
||||
CleverClassTheme {
|
||||
Greeting("Android")
|
||||
fun Button(onClick: () -> Unit, color : Color, text : String) {
|
||||
Button(
|
||||
onClick = { onClick() },
|
||||
shape = RoundedCornerShape(40),
|
||||
colors = ButtonDefaults.outlinedButtonColors(containerColor = color),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(128.dp)
|
||||
.padding(start = 16.dp, end = 16.dp, top = 16.dp)
|
||||
) {
|
||||
Text(text,
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontSize = 20.sp)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user