aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
committerAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
commit55bf3e4b5b4af5baa3c230ca82f74988608971a3 (patch)
tree3db856e037b70257aaef19e34db6b0856bda6412 /app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
parent99953f087f2c363dad05ae3f86b5bcba22484e43 (diff)
downloadfrost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.gz
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.bz2
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.zip
Format kotlin
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt19
1 files changed, 14 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
index 4d88ad3d..8d433c9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
@@ -68,14 +68,19 @@ class FrostVideoViewer @JvmOverloads constructor(
* This is under the assumption that the container allows for overlays,
* such as a FrameLayout
*/
- fun showVideo(url: String, repeat: Boolean, contract: FrostVideoContainerContract): FrostVideoViewer {
+ fun showVideo(
+ url: String,
+ repeat: Boolean,
+ contract: FrostVideoContainerContract
+ ): FrostVideoViewer {
val container = contract.videoContainer
val videoViewer = FrostVideoViewer(container.context)
container.addView(videoViewer)
videoViewer.bringToFront()
videoViewer.setVideo(url, repeat)
videoViewer.video.containerContract = contract
- videoViewer.video.onFinishedListener = { container.removeView(videoViewer); contract.onVideoFinished() }
+ videoViewer.video.onFinishedListener =
+ { container.removeView(videoViewer); contract.onVideoFinished() }
return videoViewer
}
}
@@ -101,7 +106,8 @@ class FrostVideoViewer @JvmOverloads constructor(
when (it.itemId) {
R.id.action_pip -> video.isExpanded = false
R.id.action_download -> context.ctxCoroutine.launchMain {
- val cookie = FrostDatabase.get().cookieDao().currentCookie() ?: return@launchMain
+ val cookie =
+ FrostDatabase.get().cookieDao().currentCookie() ?: return@launchMain
context.frostDownload(cookie, video.videoUri)
}
}
@@ -162,7 +168,8 @@ class FrostVideoViewer @JvmOverloads constructor(
}
fun updateLocation() {
- viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
+ viewTreeObserver.addOnGlobalLayoutListener(object :
+ ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
video.updateLocation()
viewTreeObserver.removeOnGlobalLayoutListener(this)
@@ -172,7 +179,9 @@ class FrostVideoViewer @JvmOverloads constructor(
override fun onControlsShown() {
if (video.isExpanded)
- video_toolbar.fadeIn(duration = CONTROL_ANIMATION_DURATION, onStart = { video_toolbar.visible() })
+ video_toolbar.fadeIn(
+ duration = CONTROL_ANIMATION_DURATION,
+ onStart = { video_toolbar.visible() })
}
override fun onControlsHidden() {