|
|
|
@ -38,7 +38,6 @@ import okhttp3.ResponseBody.Companion.toResponseBody
|
|
|
|
|
import org.json.JSONObject
|
|
|
|
|
import retrofit2.Response
|
|
|
|
|
import java.io.BufferedReader
|
|
|
|
|
import java.io.File
|
|
|
|
|
import java.io.FileOutputStream
|
|
|
|
|
import java.io.IOException
|
|
|
|
|
import java.io.InputStreamReader
|
|
|
|
@ -51,7 +50,8 @@ import kotlin.concurrent.fixedRateTimer
|
|
|
|
|
|
|
|
|
|
class MainActivity : AppCompatActivity() {
|
|
|
|
|
private val easyMDEscript = """
|
|
|
|
|
const easyMDE = new EasyMDE({
|
|
|
|
|
if (typeof easyMDE != 'undefined') throw new Error("easyMDE already loaded");
|
|
|
|
|
easyMDE = new EasyMDE({
|
|
|
|
|
spellChecker: false,
|
|
|
|
|
nativeSpellcheck: false,
|
|
|
|
|
maxHeight: String(windowHeight-120)+"px",
|
|
|
|
@ -108,6 +108,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
easyMDE.codemirror.getScrollerElement().style.minHeight="100px";
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
@ -161,6 +162,11 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
webView.viewTreeObserver.addOnGlobalLayoutListener {
|
|
|
|
|
webView.evaluateJavascript("easyMDE.codemirror.getScrollerElement().style.height=String(window.innerHeight-120) +\"px\"", {
|
|
|
|
|
Log.d(javaClass.simpleName, "js window innerheight set to: $it")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
webView.loadUrl("file:///android_res/raw/index.html")
|
|
|
|
|
|
|
|
|
|
val jsi = object {
|
|
|
|
@ -479,7 +485,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
saveFile()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true
|
|
|
|
@ -654,7 +659,17 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
fun checkGhostConnection(): Boolean {
|
|
|
|
|
if (ghostConnection) return true
|
|
|
|
|
if (SharedPrefsCookiePersistor(applicationContext).loadAll().size == 0) {
|
|
|
|
|
ghostSettings.launch(Intent(this, LoginActivity::class.java))
|
|
|
|
|
this.runOnUiThread({
|
|
|
|
|
with(AlertDialog.Builder(this)){
|
|
|
|
|
setTitle("No ghost CMS login defined. Edit credentials?")
|
|
|
|
|
setPositiveButton("Yes", { dialog, id ->
|
|
|
|
|
ghostSettings.launch(Intent(this@MainActivity, LoginActivity::class.java))
|
|
|
|
|
})
|
|
|
|
|
setNeutralButton("No", { dialog, id ->
|
|
|
|
|
})
|
|
|
|
|
show()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// we have a cookie
|
|
|
|
@ -1051,6 +1066,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
|
} catch (e: UninitializedPropertyAccessException) {
|
|
|
|
|
Log.d(javaClass.simpleName, "Webview not yet loaded.\n$e")
|
|
|
|
|
}
|
|
|
|
|
easyMDELoaded = false
|
|
|
|
|
Log.i(javaClass.simpleName, "\"onPause\" durchlaufen")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|