diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml
new file mode 100644
index 0000000..4a53bee
--- /dev/null
+++ b/.idea/AndroidProjectSystem.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..005afb3
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7c47dd4..6e9213b 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
index b1b87d7..16660f1 100644
--- a/.idea/runConfigurations.xml
+++ b/.idea/runConfigurations.xml
@@ -3,9 +3,14 @@
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index cea861b..69af63b 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -55,4 +55,5 @@ dependencies {
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
+ implementation(libs.androidx.foundation)
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 65dd20c..01cdd52 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,6 +23,8 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/come/stormborntales/notevault/FullScreenActivity.kt b/app/src/main/java/come/stormborntales/notevault/FullScreenActivity.kt
new file mode 100644
index 0000000..deac437
--- /dev/null
+++ b/app/src/main/java/come/stormborntales/notevault/FullScreenActivity.kt
@@ -0,0 +1,26 @@
+package come.stormborntales.notevault
+
+import android.net.Uri
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import come.stormborntales.notevault.ui.screens.FullscreenImageViewer
+import come.stormborntales.notevault.ui.theme.NoteVaultTheme
+
+// FullscreenImageViewerActivity.kt
+class FullscreenImageViewerActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val imageUris = intent.getParcelableArrayListExtra("imageUris") ?: emptyList()
+
+ setContent {
+ NoteVaultTheme {
+ FullscreenImageViewer(
+ images = imageUris,
+ onClose = { finish() }
+ )
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/come/stormborntales/notevault/ui/screens/FullScreenViewer.kt b/app/src/main/java/come/stormborntales/notevault/ui/screens/FullScreenViewer.kt
new file mode 100644
index 0000000..6dae13f
--- /dev/null
+++ b/app/src/main/java/come/stormborntales/notevault/ui/screens/FullScreenViewer.kt
@@ -0,0 +1,58 @@
+package come.stormborntales.notevault.ui.screens
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.pager.HorizontalPager
+import androidx.compose.foundation.pager.rememberPagerState
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.ArrowBack
+import androidx.compose.material3.*
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import android.net.Uri
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.material.icons.filled.Close
+import androidx.compose.ui.layout.ContentScale
+import kotlinx.coroutines.launch
+
+@OptIn(ExperimentalFoundationApi::class)
+@Composable
+fun FullscreenImageViewer(
+ images: List,
+ onClose: () -> Unit
+) {
+ val pagerState = rememberPagerState(pageCount = { images.size })
+
+ Box(modifier = Modifier.fillMaxSize()) {
+ HorizontalPager(state = pagerState) { page ->
+ val context = LocalContext.current
+ val imageBitmap = remember(images[page]) {
+ loadImageBitmap(context, images[page])
+ }
+
+ imageBitmap?.let {
+ Image(
+ bitmap = it,
+ contentDescription = "Notenbild",
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.Black),
+ contentScale = ContentScale.Fit
+ )
+ }
+ }
+
+ IconButton(
+ onClick = onClose,
+ modifier = Modifier
+ .align(Alignment.TopStart)
+ .padding(16.dp)
+ ) {
+ Icon(Icons.Default.Close, contentDescription = "Schließen", tint = Color.White)
+ }
+ }
+}
diff --git a/app/src/main/java/come/stormborntales/notevault/ui/screens/MainScreen.kt b/app/src/main/java/come/stormborntales/notevault/ui/screens/MainScreen.kt
index ed2a795..2289de0 100644
--- a/app/src/main/java/come/stormborntales/notevault/ui/screens/MainScreen.kt
+++ b/app/src/main/java/come/stormborntales/notevault/ui/screens/MainScreen.kt
@@ -1,6 +1,7 @@
package come.stormborntales.notevault.ui.screens
import android.content.Context
+import android.content.Intent
import android.graphics.BitmapFactory
import android.graphics.ImageDecoder
import android.media.Image
@@ -21,6 +22,7 @@ import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
+import come.stormborntales.notevault.FullscreenImageViewerActivity
import come.stormborntales.notevault.data.model.NoteEntry
import java.io.InputStream
@@ -35,17 +37,6 @@ fun loadImageBitmap(context: Context, uri: Uri): ImageBitmap? {
}
}
-fun getFileNameFromUri(context: Context, uri: Uri): String? {
- val cursor = context.contentResolver.query(uri, null, null, null, null)
- cursor?.use {
- val nameIndex = it.getColumnIndex(android.provider.OpenableColumns.DISPLAY_NAME)
- if (it.moveToFirst() && nameIndex >= 0) {
- return it.getString(nameIndex)
- }
- }
- return null
-}
-
@Composable
fun NoteCard(note: NoteEntry) {
val context = LocalContext.current
@@ -108,7 +99,12 @@ fun NoteCard(note: NoteEntry) {
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
OutlinedButton(
- onClick = { /* TODO */ },
+ onClick = {
+ val intent = Intent(context, FullscreenImageViewerActivity::class.java).apply {
+ putParcelableArrayListExtra("imageUris", ArrayList(note.images))
+ }
+ context.startActivity(intent)
+ },
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 4.dp)
) {
Text("Anzeigen", style = MaterialTheme.typography.labelLarge)
@@ -142,6 +138,7 @@ fun MainScreen(
notes: MutableList, // Liste der Notenbilder (hier als URI),
) {
val dummyNotes = notes
+ var noteToShow by remember { mutableStateOf(null) }
// Hole den aktuellen Context
val context = LocalContext.current
Scaffold(
@@ -170,9 +167,4 @@ fun MainScreen(
}
}
}
-
-
-
-
-
}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e51e600..470574e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,6 @@
[versions]
-agp = "8.8.0-alpha05"
+agp = "8.8.2"
+composeBomVersion = "2024.01.00"
kotlin = "2.0.0"
coreKtx = "1.10.1"
junit = "4.13.2"
@@ -11,7 +12,9 @@ composeBom = "2024.04.01"
navigationCompose = "2.8.9"
[libraries]
+androidx-compose-bom-v20240100 = { module = "androidx.compose:compose-bom", version.ref = "composeBomVersion" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+androidx-foundation = { module = "androidx.compose.foundation:foundation" }
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
junit = { group = "junit", name = "junit", version.ref = "junit" }