diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt index b3f374e4..f78402ac 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt @@ -128,7 +128,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() { val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { color } else { - ThemeStore.accentColor(context!!) + ThemeStore.accentColor(requireContext()) }.ripAlpha() TintHelper.setTintAuto( diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt index 6c5002b5..e750c573 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt @@ -55,7 +55,7 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer private fun setUpPlayerToolbar() { playerToolbar.apply { inflateMenu(R.menu.menu_player) - setNavigationOnClickListener { activity!!.onBackPressed() } + setNavigationOnClickListener { requireActivity().onBackPressed() } ToolbarContentTintHelper.colorizeToolbar(this, Color.WHITE, activity) }.setOnMenuItemClickListener(this) } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt index d347f81b..f4f3b2c7 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt @@ -87,7 +87,7 @@ class CardFragment : AbsPlayerFragment() { private fun setUpPlayerToolbar() { playerToolbar.inflateMenu(R.menu.menu_player) - playerToolbar.setNavigationOnClickListener { activity!!.onBackPressed() } + playerToolbar.setNavigationOnClickListener { requireActivity().onBackPressed() } playerToolbar.setOnMenuItemClickListener(this) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt index e2bdf4cd..0d3df1bf 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt @@ -136,7 +136,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() { val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { color } else { - ThemeStore.accentColor(context!!).ripAlpha() + ThemeStore.accentColor(requireContext()).ripAlpha() } image.setColorFilter(colorFinal, PorterDuff.Mode.SRC_IN) TintHelper.setTintAuto( diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt index 05ce400c..45f41775 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt @@ -98,7 +98,7 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen private fun setUpPlayerToolbar() { playerToolbar.apply { inflateMenu(R.menu.menu_player) - setNavigationOnClickListener { activity!!.onBackPressed() } + setNavigationOnClickListener { requireActivity().onBackPressed() } setTitleTextColor(Color.WHITE) setSubtitleTextColor(Color.WHITE) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt index e02089b8..d21e0401 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt @@ -94,7 +94,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback { val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { color } else { - ThemeStore.accentColor(context!!).ripAlpha() + ThemeStore.accentColor(requireContext()).ripAlpha() } updateTextColors(colorFinal) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt index 3b63a541..8b56badd 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt @@ -95,12 +95,13 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), override fun setDark(color: Int) { lastPlaybackControlsColor = Color.WHITE - lastDisabledPlaybackControlsColor = ContextCompat.getColor(context!!, R.color.md_grey_500) + lastDisabledPlaybackControlsColor = + ContextCompat.getColor(requireContext(), R.color.md_grey_500) val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { color } else { - ThemeStore.accentColor(context!!).ripAlpha() + ThemeStore.accentColor(requireContext()).ripAlpha() } volumeFragment?.setTintableColor(colorFinal) text.setTextColor(colorFinal) @@ -180,7 +181,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), private fun setupMenu() { playerMenu.setOnClickListener { - val popupMenu = PopupMenu(context!!, it) + val popupMenu = PopupMenu(requireContext(), it) popupMenu.setOnMenuItemClickListener(this) popupMenu.inflate(R.menu.menu_player) popupMenu.show() @@ -277,7 +278,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), } private fun toggleFavorite(song: Song) { - MusicUtil.toggleFavorite(activity!!, song) + MusicUtil.toggleFavorite(requireContext(), song) if (song.id == MusicPlayerRemote.currentSong.id) { updateIsFavorite() } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt index b0c8672d..303f0d0a 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt @@ -77,12 +77,12 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() { override fun onResume() { super.onResume() - progressViewUpdateHelper!!.start() + progressViewUpdateHelper?.start() } override fun onPause() { super.onPause() - progressViewUpdateHelper!!.stop() + progressViewUpdateHelper?.stop() } override fun onServiceConnected() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt index ec68c0ee..c8229d42 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt @@ -9,7 +9,10 @@ import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.extensions.* +import code.name.monkey.retromusic.extensions.hide +import code.name.monkey.retromusic.extensions.ripAlpha +import code.name.monkey.retromusic.extensions.show +import code.name.monkey.retromusic.extensions.textColorSecondary import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper