feat: add basic text editor
This commit is contained in:
parent
bbea101acd
commit
a29ebe422f
6 changed files with 58 additions and 2 deletions
|
@ -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")
|
||||
}
|
24
app/src/main/java/net/mbess/popequer/ui/Editor.kt
Normal file
24
app/src/main/java/net/mbess/popequer/ui/Editor.kt
Normal file
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ fun NoteContainer(
|
|||
Surface(
|
||||
modifier = Modifier.padding(padding)
|
||||
){
|
||||
Text(text = "Hello, world!")
|
||||
Editor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
//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
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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") }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue