diff options
author | Allan Wang <me@allanwang.ca> | 2020-02-23 17:50:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 17:50:22 -0800 |
commit | 654cc6b943177120dc1a0a22a0d68d5cbfde2b5e (patch) | |
tree | 3bba2feb0cf99ae222693a4d564d9acf624322e2 /app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt | |
parent | 4d5aaf541dbfa7d521ebbc5f011a642c83c4b9c5 (diff) | |
parent | 1686de0d71d687990ca6f0d4b621bc4d52dee146 (diff) | |
download | frost-654cc6b943177120dc1a0a22a0d68d5cbfde2b5e.tar.gz frost-654cc6b943177120dc1a0a22a0d68d5cbfde2b5e.tar.bz2 frost-654cc6b943177120dc1a0a22a0d68d5cbfde2b5e.zip |
Merge pull request #1647 from AllanWang/kpref
Remove stateful singletons
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 | 12 |
1 files changed, 8 insertions, 4 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 bc565527..16df7f8e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt @@ -47,6 +47,8 @@ import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.ctxCoroutine import com.pitchedapps.frost.utils.frostDownload +import org.koin.core.KoinComponent +import org.koin.core.inject /** * Created by Allan Wang on 2017-10-13. @@ -55,7 +57,7 @@ class FrostVideoViewer @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr), FrostVideoViewerContract { +) : FrameLayout(context, attrs, defStyleAttr), FrostVideoViewerContract, KoinComponent { companion object { /** @@ -85,6 +87,8 @@ class FrostVideoViewer @JvmOverloads constructor( } } + private val prefs: Prefs by inject() + private val binding: ViewVideoBinding = ViewVideoBinding.inflate(LayoutInflater.from(context), this, true) @@ -95,8 +99,8 @@ class FrostVideoViewer @JvmOverloads constructor( fun ViewVideoBinding.init() { alpha = 0f videoBackground.setBackgroundColor( - if (!Prefs.blackMediaBg && Prefs.bgColor.isColorDark) - Prefs.bgColor.withMinAlpha(200) + if (!prefs.blackMediaBg && prefs.bgColor.isColorDark) + prefs.bgColor.withMinAlpha(200) else Color.BLACK ) @@ -104,7 +108,7 @@ class FrostVideoViewer @JvmOverloads constructor( video.pause() videoToolbar.inflateMenu(R.menu.menu_video) context.setMenuIcons( - videoToolbar.menu, Prefs.iconColor, + videoToolbar.menu, prefs.iconColor, R.id.action_pip to GoogleMaterial.Icon.gmd_picture_in_picture_alt, R.id.action_download to GoogleMaterial.Icon.gmd_file_download ) |