|
|
@ -3,7 +3,6 @@ package org.wntr.mdeditor
|
|
|
|
import android.app.Activity
|
|
|
|
import android.app.Activity
|
|
|
|
import android.app.AlertDialog
|
|
|
|
import android.app.AlertDialog
|
|
|
|
import android.content.ActivityNotFoundException
|
|
|
|
import android.content.ActivityNotFoundException
|
|
|
|
import android.content.Context
|
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
import android.net.Uri
|
|
|
|
import android.net.Uri
|
|
|
|
import android.net.Uri.parse
|
|
|
|
import android.net.Uri.parse
|
|
|
@ -37,7 +36,6 @@ import okhttp3.RequestBody.Companion.asRequestBody
|
|
|
|
import okhttp3.ResponseBody
|
|
|
|
import okhttp3.ResponseBody
|
|
|
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
|
|
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
|
|
|
import org.json.JSONObject
|
|
|
|
import org.json.JSONObject
|
|
|
|
import org.wntr.mdeditor.databinding.ActivityMainBinding
|
|
|
|
|
|
|
|
import retrofit2.Response
|
|
|
|
import retrofit2.Response
|
|
|
|
import java.io.BufferedReader
|
|
|
|
import java.io.BufferedReader
|
|
|
|
import java.io.File
|
|
|
|
import java.io.File
|
|
|
@ -52,7 +50,6 @@ import kotlin.concurrent.fixedRateTimer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainActivity : AppCompatActivity() {
|
|
|
|
class MainActivity : AppCompatActivity() {
|
|
|
|
private lateinit var binding: ActivityMainBinding
|
|
|
|
|
|
|
|
private val easyMDEscript = """
|
|
|
|
private val easyMDEscript = """
|
|
|
|
const easyMDE = new EasyMDE({
|
|
|
|
const easyMDE = new EasyMDE({
|
|
|
|
spellChecker: false,
|
|
|
|
spellChecker: false,
|
|
|
@ -112,17 +109,13 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
]
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
companion object {
|
|
|
|
const val CREATE_FILE = 1
|
|
|
|
const val CREATE_FILE = 1
|
|
|
|
const val OPEN_FILE = 2
|
|
|
|
const val OPEN_FILE = 2
|
|
|
|
const val DELETE_GHOST = 4
|
|
|
|
|
|
|
|
var deleteVisible = false
|
|
|
|
var deleteVisible = false
|
|
|
|
var mdeValue: String = ""
|
|
|
|
var mdeValue: String = ""
|
|
|
|
var metaData = mdMeta()
|
|
|
|
|
|
|
|
var mdToAppend: String = ""
|
|
|
|
var mdToAppend: String = ""
|
|
|
|
var thisFileUri: Uri? = null
|
|
|
|
|
|
|
|
var truncate = false
|
|
|
|
var truncate = false
|
|
|
|
lateinit var pickMultipleVisualMedia: ActivityResultLauncher<PickVisualMediaRequest>
|
|
|
|
lateinit var pickMultipleVisualMedia: ActivityResultLauncher<PickVisualMediaRequest>
|
|
|
|
lateinit var ghostSettings: ActivityResultLauncher<Intent>
|
|
|
|
lateinit var ghostSettings: ActivityResultLauncher<Intent>
|
|
|
@ -138,7 +131,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
setContentView(R.layout.activity_main)
|
|
|
|
setContentView(R.layout.activity_main)
|
|
|
|
|
|
|
|
|
|
|
@ -149,7 +141,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
|
Log.i(javaClass.simpleName, "intent data on start: ${intent.data.toString()}\nIntent action: ${intent.action}")
|
|
|
|
Log.i(javaClass.simpleName, "intent data on start: ${intent.data.toString()}\nIntent action: ${intent.action}")
|
|
|
|
|
|
|
|
|
|
|
|
credManager = CredentialManager(applicationContext)
|
|
|
|
credManager = CredentialManager(applicationContext)
|
|
|
|
webView = findViewById<WebView>(R.id.mde_webview)
|
|
|
|
val webView = findViewById<WebView>(R.id.mde_webview)
|
|
|
|
webView.settings.javaScriptEnabled = true
|
|
|
|
webView.settings.javaScriptEnabled = true
|
|
|
|
webView.setLongClickable(true);
|
|
|
|
webView.setLongClickable(true);
|
|
|
|
|
|
|
|
|
|
|
|