diff options
author | Allan Wang <me@allanwang.ca> | 2019-08-06 00:52:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-06 00:52:23 -0700 |
commit | d500d1dd6e05c6128dcb15fe8e15acb2aaf979cd (patch) | |
tree | 98caedbfd7a6b154ca6401c6a389cb5a08bdee3d /app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt | |
parent | c78e670c2ac74e0c1b1fda4259cdcf69949e0d95 (diff) | |
parent | 59a462e6f23d046236bc20e6ac9c9464ed670f58 (diff) | |
download | frost-d500d1dd6e05c6128dcb15fe8e15acb2aaf979cd.tar.gz frost-d500d1dd6e05c6128dcb15fe8e15acb2aaf979cd.tar.bz2 frost-d500d1dd6e05c6128dcb15fe8e15acb2aaf979cd.zip |
Merge pull request #1503 from AllanWang/format
Format
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.kt | 19 |
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() { |