Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create save sqlite #31

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/main/kotlin/model/reader/database/graph.db
Binary file not shown.
41 changes: 25 additions & 16 deletions src/main/kotlin/view/HeaderView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.foundation.gestures.onDrag
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Icon
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.runtime.*
Expand All @@ -20,6 +20,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupProperties
import components.MyText
import graph
import model.reader.SQLiteReader

@OptIn(ExperimentalFoundationApi::class)
@Composable
Expand Down Expand Up @@ -108,7 +110,8 @@ fun ImageButtonFile(imageResourceId: String, onClick: () -> Unit) {
}

@Composable
private fun FileMenu(){
private fun FileMenu() {
var count by remember { mutableStateOf(0) }
val imageResources = listOf(
"DataBase.svg",
"JSON.svg",
Expand All @@ -119,13 +122,13 @@ private fun FileMenu(){
)

Box(
Modifier
.size(300.dp, 300.dp)
.shadow(
elevation = 5f.dp,
spotColor = Color.Black
)
.background(Color(0xFF3D3D3D)),
Modifier
.size(300.dp, 300.dp)
.shadow(
elevation = 5f.dp,
spotColor = Color.Black
)
.background(Color(0xFF3D3D3D)),

) {
LazyColumn(
Expand All @@ -137,11 +140,17 @@ private fun FileMenu(){
ImageButtonFile(
imageResourceId = image,
onClick = {
if (image == "DataBase.svg") {
SQLiteReader().saveGraph(
graph, "src/main/kotlin/model/reader/database/graph.db", "graph$count"
)
count++
}
}
)
}
}
}
}
}

@OptIn(ExperimentalFoundationApi::class)
Expand All @@ -150,7 +159,7 @@ private fun FileButton() {
var isImageVisible by remember { mutableStateOf(false) }
Box(
Modifier
.clickable{ isImageVisible = !isImageVisible }
.clickable { isImageVisible = !isImageVisible }
.size(Config.headerHeight.dp)
.shadow(
elevation = 5f.dp,
Expand All @@ -159,16 +168,16 @@ private fun FileButton() {
contentAlignment = Alignment.Center
) {
MyText("File", 16f)
}
}
if (isImageVisible) {
Box(
Modifier.padding(top = 33.dp)
) {
Popup (
Popup(
properties = PopupProperties(focusable = false)
) {
FileMenu()
) {
FileMenu()
}
}
}
}
}
Loading