Update Type.kt
Change settings button on Main-screen Add SettingsActivity Add AboutActivity
This commit is contained in:
@@ -60,12 +60,18 @@ dependencies {
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
}
|
||||
@@ -12,6 +12,16 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.CleverClass"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.theme.AboutActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_about"
|
||||
android:theme="@style/Theme.CleverClass" />
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:theme="@style/Theme.CleverClass" />
|
||||
<activity
|
||||
android:name=".PSEActivity"
|
||||
android:exported="false"
|
||||
|
||||
80
app/src/main/java/com/schoolapp/cleverclass/AboutActivity.kt
Normal file
80
app/src/main/java/com/schoolapp/cleverclass/AboutActivity.kt
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.schoolapp.cleverclass.ui.theme
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
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.layout.size
|
||||
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.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
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.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
class AboutActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background) {
|
||||
AboutContent(activity = this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Content of About
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AboutContent(activity: ComponentActivity){
|
||||
Column() {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
title = {
|
||||
Text(text = "About",
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { activity.finish() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.ArrowBack,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxWidth())
|
||||
{
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(text = "This Product is published under the GNU General Public License",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp))
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
Text(text = "Developed by:\n- Paul Posch\n- Matthias Meyer\n- Jakub Szarko\n- Emilian Bührer",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,11 @@ 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.magnifier
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
@@ -32,11 +30,7 @@ import androidx.compose.runtime.Composable
|
||||
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
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -59,19 +53,22 @@ class MainActivity : ComponentActivity() {
|
||||
@Composable
|
||||
fun MainContent(){
|
||||
val context = LocalContext.current
|
||||
|
||||
Column{
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(containerColor = MaterialTheme.colorScheme.primaryContainer),
|
||||
title = {
|
||||
Text(text = "CleverClass",
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
color = MaterialTheme.colorScheme.onPrimary)
|
||||
},
|
||||
actions = {
|
||||
IconButton(onClick = { /*TODO: menu*/ }) {
|
||||
Icon(imageVector = Icons.Filled.Menu,
|
||||
IconButton(
|
||||
onClick = { switchToActivity(context, SettingsActivity::class.java) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Settings,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(32.dp))
|
||||
modifier = Modifier.size(28.dp))
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
@@ -102,8 +99,7 @@ fun MainButton(onClick: () -> Unit, color : Color, text : String) {
|
||||
) {
|
||||
Text(text,
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontSize = 20.sp)
|
||||
style = MaterialTheme.typography.labelMedium)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@ import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
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 com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
|
||||
@@ -48,9 +45,8 @@ fun PSEContent(activity: ComponentActivity){
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
title = {
|
||||
Text(text = "Periodensystem",
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal))
|
||||
)
|
||||
},
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { activity.finish() }) {
|
||||
Icon(
|
||||
|
||||
115
app/src/main/java/com/schoolapp/cleverclass/SettingsActivity.kt
Normal file
115
app/src/main/java/com/schoolapp/cleverclass/SettingsActivity.kt
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.schoolapp.cleverclass
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
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
|
||||
import androidx.compose.foundation.layout.height
|
||||
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.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Switch
|
||||
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.unit.dp
|
||||
import com.schoolapp.cleverclass.ui.theme.AboutActivity
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
|
||||
class SettingsActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background) {
|
||||
SettingsContent(activity = this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Content of Settings
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun SettingsContent(activity: ComponentActivity){
|
||||
Column {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(MaterialTheme.colorScheme.primaryContainer),
|
||||
title = {
|
||||
Text(text = "Einstellungen",
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { activity.finish() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.ArrowBack,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
// Settings
|
||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
Setting(text = "Stundenplan")
|
||||
Setting(text = "Noten")
|
||||
Setting(text = "Periodensystem")
|
||||
Setting(text = "Mebis")
|
||||
Setting(text = "DSBmobile")
|
||||
}
|
||||
|
||||
// About Button
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.Bottom,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,)
|
||||
{
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Divider()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(text = "About",
|
||||
modifier = Modifier.clickable {
|
||||
val intent = Intent(activity, AboutActivity::class.java)
|
||||
activity.startActivity(intent)},
|
||||
style = MaterialTheme.typography.bodySmall)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Setting(text : String){
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
Switch(checked = true, onCheckedChange = null)
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
Text(text = text,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium)
|
||||
}
|
||||
}
|
||||
@@ -2,33 +2,40 @@ package com.schoolapp.cleverclass.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
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.R
|
||||
|
||||
// Set of Material typography styles to start with
|
||||
val Typography = Typography(
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
labelMedium = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
fontSize = 20.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
),
|
||||
headlineMedium = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
),
|
||||
headlineSmall = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.arlrdbd, FontWeight.Normal)),
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
*/
|
||||
)
|
||||
@@ -1,4 +1,6 @@
|
||||
<resources>
|
||||
<string name="app_name">CleverClass</string>
|
||||
<string name="title_activity_pseactivity">PSEActivity</string>
|
||||
<string name="title_activity_settings">SettingsActivity</string>
|
||||
<string name="title_activity_about">AboutActivity</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user