aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-05-23 20:49:26 -0700
committerAllan Wang <me@allanwang.ca>2020-05-23 20:49:26 -0700
commit0a0108e69d0e720634b1f0fdfb946fce7e714fe7 (patch)
treecca55166d7f70f7c92fa82fb903fea73fa523190 /app/src/main/kotlin
parent28c105cb0cc9593930f069584662380a7674c249 (diff)
downloadfrost-0a0108e69d0e720634b1f0fdfb946fce7e714fe7.tar.gz
frost-0a0108e69d0e720634b1f0fdfb946fce7e714fe7.tar.bz2
frost-0a0108e69d0e720634b1f0fdfb946fce7e714fe7.zip
Allow text area to fill with default min height
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt1
2 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
index 91f8aa71..b7c4bfb0 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
@@ -22,20 +22,20 @@ import androidx.annotation.VisibleForTesting
import ca.allanwang.kau.kotlin.lazyContext
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
import java.io.BufferedReader
import java.io.FileNotFoundException
import java.util.Locale
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.withContext
/**
* Created by Allan Wang on 2017-05-31.
* Mapping of the available assets
* The enum name must match the css file name
*/
-enum class JsAssets : InjectorContract {
+enum class JsAssets(private val singleLoad: Boolean = true) : InjectorContract {
MENU, CLICK_A, CONTEXT_A, MEDIA, HEADER_BADGES, TEXTAREA_LISTENER, NOTIF_MSG,
- DOCUMENT_WATCHER, HORIZONTAL_SCROLLING, AUTO_RESIZE_TEXTAREA
+ DOCUMENT_WATCHER, HORIZONTAL_SCROLLING, AUTO_RESIZE_TEXTAREA(singleLoad = false)
;
@VisibleForTesting
@@ -43,7 +43,7 @@ enum class JsAssets : InjectorContract {
private val injector = lazyContext {
try {
val content = it.assets.open("js/$file").bufferedReader().use(BufferedReader::readText)
- JsBuilder().js(content).single(name).build()
+ JsBuilder().js(content).run { if (singleLoad) single(name) else this }.build()
} catch (e: FileNotFoundException) {
L.e(e) { "JsAssets file not found" }
JsInjector(JsActions.EMPTY.function)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 657bf93e..973efc4b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -80,6 +80,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
super.doUpdateVisitedHistory(view, url, isReload)
urlSupportsRefresh = urlSupportsRefresh(url)
web.parent.swipeEnabled = urlSupportsRefresh
+ view.jsInject(JsAssets.AUTO_RESIZE_TEXTAREA, prefs = prefs)
v { "History $url; refresh $urlSupportsRefresh" }
}