Compare commits

...

4 Commits

@ -12,7 +12,7 @@ android {
minSdk 26
targetSdk 33
versionCode 1
versionName "hauntED 0.22"
versionName "hauntED 0.23"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {

Binary file not shown.

@ -12,7 +12,7 @@
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "hauntED 0.22",
"versionName": "hauntED 0.23",
"outputFile": "app-release.apk"
}
],

@ -25,17 +25,20 @@
<activity
android:name=".MetadataActivity"
android:exported="false"
android:label="Metadata"/>
android:label="Metadata"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".LoginActivity"
android:exported="false"
android:label="ghost CMS login" />
android:label="ghost CMS login"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.MDEditor"
android:launchMode="singleInstance">
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -65,5 +68,4 @@
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

@ -28,7 +28,6 @@ class CredentialManager(applicationContext: Context) {
val username = sharedPrefs.getString("username", "nobody")!!
return (Credentials(instance!!, username!!, "nothing"))
}
}

@ -27,8 +27,9 @@ class LoginActivity : AppCompatActivity() {
val creds = MainActivity.credManager.loadCredentialsFromSharedPrefs()
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.instance.setText(creds.instance)
binding.username.setText(creds.username)
if (creds.instance != "nowhere") binding.instance.setText(creds.instance)
if (creds.username != "nobody") binding.username.setText(creds.username)
}
fun onButtonLoginClick(view: View) {

@ -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")
}

@ -7,6 +7,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true"
tools:context="LoginActivity">
<EditText
@ -16,7 +18,6 @@
android:hint="Ghost instance"
android:inputType="textUri"
android:selectAllOnFocus="true"
android:text="@{entry.fakeTitle ?? entry.printTitle}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

@ -5,7 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true">
<WebView
android:id="@+id/mde_webview"

@ -5,6 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true"
tools:context="MetadataActivity">
<TextView

@ -40,11 +40,6 @@ function pasteText() {
windowHeight = window.innerHeight
function toggleBar() {
if (Android.isFullscreen()) {
easyMDE.codemirror.getScrollerElement().style.height=String(windowHeight-40)+"px"
} else {
easyMDE.codemirror.getScrollerElement().style.height=String(windowHeight-120)+"px"
}
Android.toggleBar()
easyMDE.codemirror.focus()
}

Loading…
Cancel
Save