nextNoteVault #23
@ -1,6 +1,7 @@
 | 
			
		||||
package come.stormborntales.notevault
 | 
			
		||||
 | 
			
		||||
import android.os.Bundle
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import androidx.activity.ComponentActivity
 | 
			
		||||
import androidx.activity.compose.setContent
 | 
			
		||||
import androidx.activity.enableEdgeToEdge
 | 
			
		||||
@ -11,6 +12,7 @@ import androidx.compose.material3.Text
 | 
			
		||||
import androidx.compose.runtime.Composable
 | 
			
		||||
import androidx.compose.ui.Modifier
 | 
			
		||||
import androidx.compose.ui.tooling.preview.Preview
 | 
			
		||||
import come.stormborntales.notevault.ui.screens.MainScreen
 | 
			
		||||
import come.stormborntales.notevault.ui.theme.NoteVaultTheme
 | 
			
		||||
 | 
			
		||||
class MainActivity : ComponentActivity() {
 | 
			
		||||
@ -19,17 +21,20 @@ class MainActivity : ComponentActivity() {
 | 
			
		||||
        enableEdgeToEdge()
 | 
			
		||||
        setContent {
 | 
			
		||||
            NoteVaultTheme {
 | 
			
		||||
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
 | 
			
		||||
                    Greeting(
 | 
			
		||||
                        name = "Android",
 | 
			
		||||
                        modifier = Modifier.padding(innerPadding)
 | 
			
		||||
                    )
 | 
			
		||||
                }
 | 
			
		||||
                MainScreen(
 | 
			
		||||
                    onAddNoteClicked = {
 | 
			
		||||
                        // Hier kommt später deine Logik zum Öffnen der Galerie oder eines Dialogs.
 | 
			
		||||
                        // Zum Beispiel kannst du hier später ein Intent einbauen, um ein Bild zu wählen.
 | 
			
		||||
                        Log.d("MainActivity", "FAB geklickt! Hier könnte die Galerie geöffnet werden.")
 | 
			
		||||
                    }
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@Composable
 | 
			
		||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
 | 
			
		||||
    Text(
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,58 @@
 | 
			
		||||
package come.stormborntales.notevault.ui.screens
 | 
			
		||||
 | 
			
		||||
import androidx.compose.foundation.layout.fillMaxSize
 | 
			
		||||
import androidx.compose.foundation.layout.fillMaxWidth
 | 
			
		||||
import androidx.compose.foundation.layout.padding
 | 
			
		||||
import androidx.compose.foundation.lazy.LazyColumn
 | 
			
		||||
import androidx.compose.foundation.lazy.items
 | 
			
		||||
import androidx.compose.material.icons.Icons
 | 
			
		||||
import androidx.compose.material.icons.filled.Add
 | 
			
		||||
import androidx.compose.material3.*
 | 
			
		||||
import androidx.compose.runtime.Composable
 | 
			
		||||
import androidx.compose.ui.Modifier
 | 
			
		||||
import androidx.compose.ui.unit.dp
 | 
			
		||||
 | 
			
		||||
@OptIn(ExperimentalMaterial3Api::class)
 | 
			
		||||
@Composable
 | 
			
		||||
fun MainScreen(
 | 
			
		||||
    onAddNoteClicked: () -> Unit // Übergib hier deine Logik für den Import
 | 
			
		||||
) {
 | 
			
		||||
    val dummyNotes = listOf("Notenblatt 1", "Notenblatt 2", "Notenblatt 3")
 | 
			
		||||
 | 
			
		||||
    Scaffold(
 | 
			
		||||
        topBar = {
 | 
			
		||||
            TopAppBar(
 | 
			
		||||
                title = { Text("Meine Noten") }
 | 
			
		||||
            )
 | 
			
		||||
        },
 | 
			
		||||
        floatingActionButton = {
 | 
			
		||||
            FloatingActionButton(
 | 
			
		||||
                onClick = onAddNoteClicked
 | 
			
		||||
            ) {
 | 
			
		||||
                Icon(Icons.Default.Add, contentDescription = "Neue Noten hinzufügen")
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        floatingActionButtonPosition = FabPosition.End
 | 
			
		||||
    ) { innerPadding ->
 | 
			
		||||
        LazyColumn(
 | 
			
		||||
            contentPadding = innerPadding,
 | 
			
		||||
            modifier = Modifier
 | 
			
		||||
                .fillMaxSize()
 | 
			
		||||
                .padding(16.dp)
 | 
			
		||||
        ) {
 | 
			
		||||
            items(dummyNotes) { note ->
 | 
			
		||||
                Card(
 | 
			
		||||
                    modifier = Modifier
 | 
			
		||||
                        .fillMaxWidth()
 | 
			
		||||
                        .padding(vertical = 8.dp),
 | 
			
		||||
                    elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
 | 
			
		||||
                ) {
 | 
			
		||||
                    Text(
 | 
			
		||||
                        text = note,
 | 
			
		||||
                        modifier = Modifier.padding(16.dp)
 | 
			
		||||
                    )
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user