diff --git a/README.md b/README.md index c605b18..bf23e80 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,64 @@ # KodeEditor A simple code editor with syntax highlighting and pinch to zoom + +# Build Status + +| Master | Dev | +|--------|-----| +| [![Master](https://travis-ci.org/markusressel/KodeEditor.svg?branch=master)](https://travis-ci.org/markusressel/KutePreferences/branches) | [![Master](https://travis-ci.org/markusressel/KutePreferences.svg?branch=dev)](https://travis-ci.org/markusressel/KodeEditor/branches) | +| [![codebeat badge](https://codebeat.co/badges/f7fa8602-1d15-457e-904d-cb585e984952)](https://codebeat.co/projects/github-com-markusressel-kodeeditor-master) | [![codebeat badge](https://codebeat.co/badges/19447977-bc96-4519-90b1-e532139ae1a5)](https://codebeat.co/projects/github-com-markusressel-kodeeditor-dev) | + +# Features +* Pinch-To-Zoom +* Line numbers +* Syntax highlighting + * import languages you need + * or simply create your own highlighter using **regex** or other techniques +* Written entirely in Kotlin + +# How to use +Have a look at the demo app (`app` module) for a complete sample. + +## Gradle +To use this library just include it in your dependencies using + + repositories { + ... + maven { url "https://jitpack.io" } + } + +in your project build.gradle file and + + dependencies { + implementation("com.github.markusressel.KodeEditor:library:+") { + transitive = true + } + } + +in your desired module ```build.gradle``` file. + +# License + +``` +MIT License + +Copyright (c) 2018 Markus Ressel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` \ No newline at end of file diff --git a/app/src/main/java/de/markusressel/kodeeditor/MainActivity.kt b/app/src/main/java/de/markusressel/kodeeditor/MainActivity.kt index a4f9b32..3057374 100644 --- a/app/src/main/java/de/markusressel/kodeeditor/MainActivity.kt +++ b/app/src/main/java/de/markusressel/kodeeditor/MainActivity.kt @@ -1,6 +1,5 @@ package de.markusressel.kodeeditor -import android.os.AsyncTask import android.os.Bundle import android.support.v7.app.AppCompatActivity import de.markusressel.kodeeditor.library.markdown.MarkdownSyntaxHighlighter @@ -15,42 +14,11 @@ class MainActivity : AppCompatActivity() { codeEditorView .setSyntaxHighlighter(MarkdownSyntaxHighlighter()) -// codeEditorView -// .setText("# Topic 1\n" + "\n" + "This is a *simple* demo ~~text~~ written in **Markdown**") codeEditorView - .setText(getString(R.string.huge_text)) - codeEditorView.zoomTo(codeEditorView.realZoom, false) - -// doAsync { -// Thread -// .sleep(5000) -// -// runOnUiThread { -// codeEditorView -// .setSyntaxHighlighter(JavaSyntaxHighlighter()) -// codeEditorView -// .setText("package de.markusressel.kodeeditor.libary.java;\n" + "\n" + "import android.content.Context;\n" + "import android.support.test.InstrumentationRegistry;\n" + "import android.support.test.runner.AndroidJUnit4;\n" + "\n" + "import org.junit.Test;\n" + "import org.junit.runner.RunWith;\n" + "\n" + "import static org.junit.Assert.*;\n" + "\n" + "/**\n" + " * Instrumented test, which will execute on an Android device.\n" + " *\n" + " * @see Testing documentation\n" + " */\n" + "@RunWith(AndroidJUnit4.class)\n" + "public class ExampleInstrumentedTest {\n" + " @Test\n" + " public void useAppContext() {\n" + " // Context of the app under test.\n" + " Context appContext = InstrumentationRegistry.getTargetContext();\n" + "\n" + " assertEquals(\"de.markusressel.kodeeditor.libarry.java.test\", appContext.getPackageName());\n" + " }\n" + "}\n") -// } -// -// Thread -// .sleep(5000) -// runOnUiThread { -// codeEditorView -// .setSyntaxHighlighter(KotlinSyntaxHighlighter()) -// codeEditorView -// .setText("package de.markusressel.mkdocseditor.data.persistence.entity\n" + "\n" + "import de.markusressel.mkdocseditor.data.persistence.IdentifiableListItem\n" + "import de.markusressel.mkdocsrestclient.document.DocumentModel\n" + "import io.objectbox.annotation.Entity\n" + "import io.objectbox.annotation.Id\n" + "import io.objectbox.relation.ToOne\n" + "import java.util.*\n" + "\n" + "/**\n" + " * Created by Markus on 04.06.2018.\n" + " */\n" + "@Entity\n" + "data class DocumentEntity(@Id var entityId: Long = 0, val type: String = \"Document\", val id: String = \"\", val name: String = \"\", val filesize: Long = -1L, val modtime: Date = Date(), val url: String = \"\") : IdentifiableListItem {\n" + " override fun getItemId(): String = id\n" + "\n" + " lateinit var parentSection: ToOne\n" + "\n" + "}\n" + "\n" + "fun DocumentModel.asEntity(parentSection: SectionEntity): DocumentEntity {\n" + " val d = DocumentEntity(0, this.type, this.id, this.name, this.filesize, this.modtime, this.url)\n" + " d\n" + " .parentSection\n" + " .target = parentSection\n" + " return d\n" + "}") -// } -// } + .setText(getString(R.string.demo_text)) + codeEditorView + .zoomTo(codeEditorView.realZoom, false) } - fun Any.doAsync(handler: () -> Unit) { - object : AsyncTask() { - override fun doInBackground(vararg p0: Void?): Void? { - handler() - return null - } - } - .execute() - } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0e2c527..ebe81d1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,74 @@ KodeEditor + +