From a94666c8bce0d5ba37e29305d21db711a2fd0730 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Thu, 26 Dec 2019 20:09:59 +0530 Subject: [PATCH] Fix plain theme controls --- .../fragments/player/normal/PlayerFragment.kt | 6 +++--- .../fragments/player/plain/PlainPlayerFragment.kt | 6 +++--- .../player/simple/SimplePlaybackControlsFragment.kt | 3 +-- .../fragments/player/simple/SimplePlayerFragment.kt | 11 ++++------- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt index b70b94ac..f31e4883 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt @@ -70,7 +70,7 @@ class PlayerFragment : AbsPlayerFragment() { lastColor = color callbacks?.onPaletteColorChanged() - ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), activity) + ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity()) if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { colorize(color) @@ -110,10 +110,10 @@ class PlayerFragment : AbsPlayerFragment() { private fun setUpPlayerToolbar() { playerToolbar.inflateMenu(R.menu.menu_player) - playerToolbar.setNavigationOnClickListener { activity!!.onBackPressed() } + playerToolbar.setNavigationOnClickListener {requireActivity().onBackPressed() } playerToolbar.setOnMenuItemClickListener(this) - ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity) + ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity()) } override fun onServiceConnected() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt index f580a236..98f09f0e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt @@ -51,7 +51,7 @@ class PlainPlayerFragment : AbsPlayerFragment() { inflateMenu(R.menu.menu_player) setNavigationOnClickListener { requireActivity().onBackPressed() } setOnMenuItemClickListener(this@PlainPlayerFragment) - ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity) + ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity()) } } @@ -83,14 +83,14 @@ class PlainPlayerFragment : AbsPlayerFragment() { } override fun toolbarIconColor(): Int { - return ATHUtil.resolveColor(requireContext(), R.attr.iconColor) + return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } override fun onColorChanged(color: Int) { plainPlaybackControlsFragment.setDark(color) lastColor = color callbacks!!.onPaletteColorChanged() - ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.iconColor), activity) + ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity()) } override fun onFavoriteToggled() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt index 7e087c9e..e100c686 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt @@ -173,8 +173,7 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() { override fun onUpdateProgressViews(progress: Int, total: Int) { - songCurrentProgress!!.text = String.format("%s / %s", MusicUtil.getReadableDurationString(progress.toLong()), - MusicUtil.getReadableDurationString(total.toLong())) + songCurrentProgress!!.text = String.format("%s / %s", MusicUtil.getReadableDurationString(progress.toLong()), MusicUtil.getReadableDurationString(total.toLong())) } override fun setDark(color: Int) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt index 267f1df7..5cb9e65c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt @@ -68,7 +68,6 @@ class SimplePlayerFragment : AbsPlayerFragment() { callbacks?.onPaletteColorChanged() simplePlaybackControlsFragment.setDark(color) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity()) - } override fun onFavoriteToggled() { @@ -83,11 +82,9 @@ class SimplePlayerFragment : AbsPlayerFragment() { } private fun setUpPlayerToolbar() { - playerToolbar.apply { - inflateMenu(R.menu.menu_player) - setNavigationOnClickListener { requireActivity().onBackPressed() } - setOnMenuItemClickListener(this@SimplePlayerFragment) - ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity()) - } + playerToolbar.inflateMenu(R.menu.menu_player) + playerToolbar.setNavigationOnClickListener { requireActivity().onBackPressed() } + playerToolbar.setOnMenuItemClickListener(this) + ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity()) } }