From 86ad6986b10fbd00b5231a0cffdd9fa170b81957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 18 Nov 2023 22:16:16 +0100 Subject: [PATCH] Basic Scaffold --- .../inspectionProfiles/Project_Default.xml | 46 ++++++ .../simplecloudnotifier2/MainActivity.kt | 132 +++++++++++++++++- .../src/main/res/drawable/fas_bookmark.xml | 9 ++ .../app/src/main/res/drawable/fas_burger.xml | 9 ++ .../src/main/res/drawable/fas_computer.xml | 9 ++ .../app/src/main/res/drawable/fas_gauge.xml | 9 ++ .../app/src/main/res/drawable/fas_gear.xml | 9 ++ .../app/src/main/res/drawable/fas_key.xml | 9 ++ .../main/res/drawable/fas_paper_plane_top.xml | 9 ++ .../app/src/main/res/drawable/fas_plus.xml | 9 ++ .../app/src/main/res/drawable/fas_road.xml | 9 ++ .../app/src/main/res/drawable/fas_sack.xml | 9 ++ .../app/src/main/res/drawable/fas_user.xml | 9 ++ 13 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 android_v2/.idea/inspectionProfiles/Project_Default.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_bookmark.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_burger.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_computer.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_gauge.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_gear.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_key.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_paper_plane_top.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_plus.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_road.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_sack.xml create mode 100644 android_v2/app/src/main/res/drawable/fas_user.xml diff --git a/android_v2/.idea/inspectionProfiles/Project_Default.xml b/android_v2/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..53a1745 --- /dev/null +++ b/android_v2/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,46 @@ + + + + \ No newline at end of file diff --git a/android_v2/app/src/main/java/com/blackforestbytes/simplecloudnotifier2/MainActivity.kt b/android_v2/app/src/main/java/com/blackforestbytes/simplecloudnotifier2/MainActivity.kt index 9db558c..de50980 100644 --- a/android_v2/app/src/main/java/com/blackforestbytes/simplecloudnotifier2/MainActivity.kt +++ b/android_v2/app/src/main/java/com/blackforestbytes/simplecloudnotifier2/MainActivity.kt @@ -3,41 +3,159 @@ package com.blackforestbytes.simplecloudnotifier2 import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.offset +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Menu +import androidx.compose.material3.CenterAlignedTopAppBar +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.FabPosition +import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.FloatingActionButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.NavigationBar +import androidx.compose.material3.NavigationBarItem +import androidx.compose.material3.Scaffold 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.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import com.blackforestbytes.simplecloudnotifier2.ui.theme.Simplecloudnotifier2Theme class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { Simplecloudnotifier2Theme { // A surface container using the 'background' color from the theme Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { - Greeting("Android") + + Content() + } } } } } +@OptIn(ExperimentalMaterial3Api::class) @Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) +fun Content() { + Scaffold( + + topBar = { + CenterAlignedTopAppBar( + colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + containerColor = MaterialTheme.colorScheme.primaryContainer, + titleContentColor = MaterialTheme.colorScheme.primary, + ), + title = { + Text("Messages", maxLines = 1, overflow = TextOverflow.Ellipsis) + }, + navigationIcon = { + IconButton(onClick = { /* do something */ }) { + Icon(painterResource(R.drawable.fas_gauge), contentDescription = "Menu", modifier = Modifier.size(24.dp)) + } + }, + + actions = { + IconButton(onClick = { /* do something */ }) { + Icon(painterResource(R.drawable.fas_paper_plane_top), contentDescription = "Send message", modifier = Modifier.size(24.dp)) + } + }, + ) + }, + + bottomBar = { + NavigationBar { + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_road), contentDescription = "Channels", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_computer), contentDescription = "Clients", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_key), contentDescription = "Keys", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_bookmark), contentDescription = "Subscriptions", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_user), contentDescription = "User", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + NavigationBarItem( + icon = { Icon(painterResource(R.drawable.fas_gear), contentDescription = "Settings", modifier = Modifier.size(32.dp)) }, + onClick = {}, + selected = false, + ) + } + }, + + floatingActionButton = { + Box(){ + FloatingActionButton( + onClick = { /* stub */ }, + shape = FloatingActionButtonDefaults.shape, + modifier = Modifier + .align(Alignment.Center) + .size(70.dp) + .offset(y = 50.dp) + ) { + Icon( + painter = painterResource(R.drawable.fas_plus), + contentDescription = null, + modifier = Modifier.size(45.dp) + ) + } + } + }, + + floatingActionButtonPosition = FabPosition.Center, + + ) { innerPadding -> + Text( + modifier = Modifier.padding(innerPadding), + text = "Hello World" + ) + } } @Preview(showBackground = true) @Composable fun GreetingPreview() { Simplecloudnotifier2Theme { - Greeting("Android") + + Content() + } } \ No newline at end of file diff --git a/android_v2/app/src/main/res/drawable/fas_bookmark.xml b/android_v2/app/src/main/res/drawable/fas_bookmark.xml new file mode 100644 index 0000000..1c28437 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_bookmark.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_burger.xml b/android_v2/app/src/main/res/drawable/fas_burger.xml new file mode 100644 index 0000000..338d9dc --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_burger.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_computer.xml b/android_v2/app/src/main/res/drawable/fas_computer.xml new file mode 100644 index 0000000..20d95ed --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_computer.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_gauge.xml b/android_v2/app/src/main/res/drawable/fas_gauge.xml new file mode 100644 index 0000000..398f619 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_gauge.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_gear.xml b/android_v2/app/src/main/res/drawable/fas_gear.xml new file mode 100644 index 0000000..6faf7b9 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_gear.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_key.xml b/android_v2/app/src/main/res/drawable/fas_key.xml new file mode 100644 index 0000000..0ae64d2 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_key.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_paper_plane_top.xml b/android_v2/app/src/main/res/drawable/fas_paper_plane_top.xml new file mode 100644 index 0000000..f00130e --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_paper_plane_top.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_plus.xml b/android_v2/app/src/main/res/drawable/fas_plus.xml new file mode 100644 index 0000000..0b6b8e4 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_plus.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_road.xml b/android_v2/app/src/main/res/drawable/fas_road.xml new file mode 100644 index 0000000..0085e02 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_road.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_sack.xml b/android_v2/app/src/main/res/drawable/fas_sack.xml new file mode 100644 index 0000000..247190e --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_sack.xml @@ -0,0 +1,9 @@ + + + diff --git a/android_v2/app/src/main/res/drawable/fas_user.xml b/android_v2/app/src/main/res/drawable/fas_user.xml new file mode 100644 index 0000000..cf42865 --- /dev/null +++ b/android_v2/app/src/main/res/drawable/fas_user.xml @@ -0,0 +1,9 @@ + + +