diff options
author | Allan Wang <me@allanwang.ca> | 2017-11-13 05:09:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 05:09:24 -0500 |
commit | 63d8779ad4fab7d2eb762be34eeca04c7debc6f3 (patch) | |
tree | 334f3c0c4c6a717d7c0b0872574cb65b3b50166c /app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt | |
parent | 4aed05a8923a7f76799bbaa254f407f7e11fef0b (diff) | |
download | frost-63d8779ad4fab7d2eb762be34eeca04c7debc6f3.tar.gz frost-63d8779ad4fab7d2eb762be34eeca04c7debc6f3.tar.bz2 frost-63d8779ad4fab7d2eb762be34eeca04c7debc6f3.zip |
Enhancement/video (#484)v1.6.4
* Fix more parsing issues
* Try catch decoder resolves #456
* Fix unit test and add null check for images, resolves #458
* Remove downloadservice, resolves #459
* Clean up progress animator
* Check for download manager before download attempt
* Update strings
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt index ca88a23e..e8f9fee9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt @@ -3,11 +3,13 @@ package com.pitchedapps.frost.web import com.pitchedapps.frost.activities.WebOverlayActivity import com.pitchedapps.frost.activities.WebOverlayActivityBase import com.pitchedapps.frost.activities.WebOverlayBasicActivity + import com.pitchedapps.frost.contracts.VideoViewHolder import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.USER_AGENT_BASIC import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.utils.* +import org.jetbrains.anko.runOnUiThread /** * Created by Allan Wang on 2017-08-15. @@ -18,6 +20,9 @@ import com.pitchedapps.frost.utils.* * This helper method will collect all known cases and launch the overlay accordingly * Returns {@code true} (default) if action is consumed, {@code false} otherwise * + * Note that this is not always called on the main thread! + * UI related methods should always be posted or they may not be properly executed. + * * If the request already comes from an instance of [WebOverlayActivity], we will then judge * whether the user agent string should be changed. All propagated results will return false, * as we have no need of sending a new intent to the same activity @@ -26,7 +31,7 @@ fun FrostWebViewCore.requestWebOverlay(url: String): Boolean { if (url == "#") return false if (url.isVideoUrl && context is VideoViewHolder) { L.i("Found video", url) - (context as VideoViewHolder).showVideo(url) + context.runOnUiThread { (context as VideoViewHolder).showVideo(url) } return true } if (!Prefs.overlayEnabled) return false |