improve auto layout adjustements

hauntED
yova 3 months ago
parent 3b0b00d89c
commit b9ffe73652

@ -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" />

@ -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
@ -109,6 +108,7 @@ class MainActivity : AppCompatActivity() {
}
]
});
easyMDE.codemirror.getScrollerElement().style.minHeight="100px";
"""
companion object {
@ -162,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 {
@ -269,7 +274,6 @@ class MainActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
if (!readOnResume) {
readOnResume = true
autosaveTimer = fixedRateTimer("timer",true,0,5000){

@ -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

@ -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