|
|
|
@ -59,53 +59,53 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
autoDownloadFontAwesome: false,
|
|
|
|
|
theme: "solarized",
|
|
|
|
|
status: [
|
|
|
|
|
{
|
|
|
|
|
className: "editor-statusbar-left",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = saveStatus()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
className: "displayName",
|
|
|
|
|
defaultValue: "None",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = displayName()
|
|
|
|
|
},
|
|
|
|
|
}, "lines", "words", "cursor",
|
|
|
|
|
{
|
|
|
|
|
className: "editor-statusbar-right",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = "<i class=\"fa fa-square\"></i>"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
className: "editor-statusbar-left",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = saveStatus()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
className: "displayName",
|
|
|
|
|
defaultValue: "None",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = displayName()
|
|
|
|
|
},
|
|
|
|
|
}, "lines", "words", "cursor",
|
|
|
|
|
{
|
|
|
|
|
className: "editor-statusbar-right",
|
|
|
|
|
onUpdate: (el) => {
|
|
|
|
|
el.innerHTML = "<i class=\"fa fa-square\"></i>"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
toolbar: [
|
|
|
|
|
{
|
|
|
|
|
name: "toggleTheme",
|
|
|
|
|
action: toggleTheme,
|
|
|
|
|
className: "fa fa-moon",
|
|
|
|
|
title: "Toggle Theme"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "share",
|
|
|
|
|
action: shareText,
|
|
|
|
|
className: "fa fa-share-nodes",
|
|
|
|
|
title: "Share"
|
|
|
|
|
},"strikethrough", "horizontal-rule","undo",
|
|
|
|
|
{
|
|
|
|
|
name: "preview",
|
|
|
|
|
action: myPreview,
|
|
|
|
|
className: "fa fa-eye",
|
|
|
|
|
title: "Preview",
|
|
|
|
|
noDisable: true
|
|
|
|
|
},"redo",
|
|
|
|
|
"bold", "italic","link","code",
|
|
|
|
|
{
|
|
|
|
|
name: "toggle",
|
|
|
|
|
action: toggleBar,
|
|
|
|
|
className: "fa fa-expand",
|
|
|
|
|
title: "Toggle Bar",
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
name: "toggleTheme",
|
|
|
|
|
action: toggleTheme,
|
|
|
|
|
className: "fa fa-moon",
|
|
|
|
|
title: "Toggle Theme"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "share",
|
|
|
|
|
action: shareText,
|
|
|
|
|
className: "fa fa-share-nodes",
|
|
|
|
|
title: "Share"
|
|
|
|
|
},"strikethrough", "horizontal-rule","undo",
|
|
|
|
|
{
|
|
|
|
|
name: "preview",
|
|
|
|
|
action: myPreview,
|
|
|
|
|
className: "fa fa-eye",
|
|
|
|
|
title: "Preview",
|
|
|
|
|
noDisable: true
|
|
|
|
|
},"redo",
|
|
|
|
|
"bold", "italic","link","code",
|
|
|
|
|
{
|
|
|
|
|
name: "toggle",
|
|
|
|
|
action: toggleBar,
|
|
|
|
|
className: "fa fa-expand",
|
|
|
|
|
title: "Toggle Bar",
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
"""
|
|
|
|
@ -141,7 +141,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
Log.i(javaClass.simpleName, "intent data on start: ${intent.data.toString()}\nIntent action: ${intent.action}")
|
|
|
|
|
|
|
|
|
|
credManager = CredentialManager(applicationContext)
|
|
|
|
|
val webView = findViewById<WebView>(R.id.mde_webview)
|
|
|
|
|
webView = findViewById<WebView>(R.id.mde_webview)
|
|
|
|
|
webView.settings.javaScriptEnabled = true
|
|
|
|
|
webView.setLongClickable(true);
|
|
|
|
|
|
|
|
|
@ -164,19 +164,9 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
webView.loadUrl("file:///android_res/raw/index.html")
|
|
|
|
|
|
|
|
|
|
val jsi = object {
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun getValue(): String {
|
|
|
|
|
return mdeValue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun reportChange(value: String) {
|
|
|
|
|
Log.i(javaClass.simpleName, value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun triggerSaveFile(value: String) {
|
|
|
|
|
mdeValue = value
|
|
|
|
|
fun triggerSaveFile() {
|
|
|
|
|
saveFile()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -189,11 +179,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
return height
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun refresh() {
|
|
|
|
|
readFile(thisFileUri!!)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun triggerDisplayName(): String {
|
|
|
|
|
return getDisplayName(applicationContext, thisFileUri)
|
|
|
|
@ -214,11 +199,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun triggerGhost(sharedText: String) {
|
|
|
|
|
shareGhost(sharedText, ::sendPost)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun getMdToAppend(): String {
|
|
|
|
|
val md = mdToAppend
|
|
|
|
@ -226,13 +206,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
return md
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun getCursor(): String {
|
|
|
|
|
val cursor = JSONObject(JSONObject(metaData.cursor), arrayOf("ch", "line"))
|
|
|
|
|
Log.i(javaClass.simpleName,"delivering cursor: $cursor")
|
|
|
|
|
return cursor.toString()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
|
|
|
fun isFullscreen() : Boolean{
|
|
|
|
|
return supportActionBar!!.isShowing
|
|
|
|
|