diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7d8d092..46601d4 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.androidApplication) alias(libs.plugins.kotlinAndroid) + //id("org.mozilla.rust-android-gradle.rust-android") version "0.9.3" apply false } android { @@ -54,4 +55,5 @@ dependencies { implementation(libs.androidx.ui.tooling.preview) runtimeOnly(libs.androidx.ui.tooling) implementation(libs.org.eclipse.jgit) + implementation("com.meetup:twain:0.2.2") } \ No newline at end of file diff --git a/app/src/main/java/net/mbess/popequer/ui/Editor.kt b/app/src/main/java/net/mbess/popequer/ui/Editor.kt new file mode 100644 index 0000000..2fa0ff9 --- /dev/null +++ b/app/src/main/java/net/mbess/popequer/ui/Editor.kt @@ -0,0 +1,24 @@ +package net.mbess.popequer.ui + +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.Card +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.input.TextFieldValue +import com.meetup.twain.MarkdownEditor + +@Composable +fun Editor() { + val textFieldValue = rememberSaveable(stateSaver = TextFieldValue.Saver) { + mutableStateOf(TextFieldValue("THe quick brown fox jump")) + } + Card { + MarkdownEditor( + value = textFieldValue.value, + onValueChange = { value -> textFieldValue.value = value.copy(text = value.text) }, + modifier = Modifier.fillMaxWidth() + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/net/mbess/popequer/ui/Notes.kt b/app/src/main/java/net/mbess/popequer/ui/Notes.kt index d73fd4c..6c7a340 100644 --- a/app/src/main/java/net/mbess/popequer/ui/Notes.kt +++ b/app/src/main/java/net/mbess/popequer/ui/Notes.kt @@ -54,7 +54,7 @@ fun NoteContainer( Surface( modifier = Modifier.padding(padding) ){ - Text(text = "Hello, world!") + Editor() } } } diff --git a/build.gradle.kts b/build.gradle.kts index 20d87a7..4b14c6b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,5 +3,28 @@ plugins { alias(libs.plugins.androidApplication) apply false alias(libs.plugins.kotlinAndroid) apply false + //id("org.mozilla.rust-android-gradle.rust-android") version "0.9.3" } -true // Needed to make the Suppress annotation work for the plugins block \ No newline at end of file + +//Cargo { +// module = "../rust-sandbox" // Or whatever directory contains your Cargo.toml +// libname = "rust-sandbox" // Or whatever matches Cargo.toml's [package] name. +// targets = listOf("arm") // See bellow for a longer list of options +//} + + +//project.afterEvaluate { +// tasks.withType(com.nishtahir.CargoBuildTask::class) +// .forEach { buildTask -> +// tasks.withType(com.android.build.gradle.tasks.MergeSourceSetFolders::class) +// .configureEach { +// this.inputs.dir( +// layout.buildDirectory.dir("rustJniLibs" + File.separatorChar + buildTask.toolchain!!.folder) +// ) +// this.dependsOn(buildTask) +// } +// } +//} + +true // Needed to make the Suppress annotation work for the plugins block + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b52c874..7924575 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,6 @@ [versions] agp = "8.2.0" +compose-markdown = "0.3.7" kotlin = "1.9.21" kotlinx-coroutines-android = "1.7.3" compose-compiler = "1.5.6" @@ -11,6 +12,7 @@ navigation-compose = "2.7.6" compose-bom = "2023.10.01" material3 = "1.1.2" org-eclipse-jgit = "6.8.0.202311291450-r" +twain = "0.2.2" [libraries] androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } @@ -21,8 +23,10 @@ androidx-material-ripple = { module = "androidx.compose.material:material-ripple androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" } androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +compose-markdown = { module = "com.github.jeziellago:compose-markdown", version.ref = "compose-markdown" } kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines-android" } org-eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "org-eclipse-jgit" } +twain = { module = "com.meetup:twain", version.ref = "twain" } [plugins] androidApplication = { id = "com.android.application", version.ref = "agp" } diff --git a/settings.gradle.kts b/settings.gradle.kts index de7e114..38f0155 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,5 @@ +import java.net.URI + pluginManagement { repositories { google { @@ -16,6 +18,7 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven { url = URI("https://jitpack.io") } } }