Fix plain theme controls

main
h4h13 2019-12-26 20:09:59 +05:30
parent fa83e809aa
commit a94666c8bc
4 changed files with 11 additions and 15 deletions

View File

@ -70,7 +70,7 @@ class PlayerFragment : AbsPlayerFragment() {
lastColor = color lastColor = color
callbacks?.onPaletteColorChanged() 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) { if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
colorize(color) colorize(color)
@ -110,10 +110,10 @@ class PlayerFragment : AbsPlayerFragment() {
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
playerToolbar.inflateMenu(R.menu.menu_player) playerToolbar.inflateMenu(R.menu.menu_player)
playerToolbar.setNavigationOnClickListener { activity!!.onBackPressed() } playerToolbar.setNavigationOnClickListener {requireActivity().onBackPressed() }
playerToolbar.setOnMenuItemClickListener(this) 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() { override fun onServiceConnected() {

View File

@ -51,7 +51,7 @@ class PlainPlayerFragment : AbsPlayerFragment() {
inflateMenu(R.menu.menu_player) inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { requireActivity().onBackPressed() } setNavigationOnClickListener { requireActivity().onBackPressed() }
setOnMenuItemClickListener(this@PlainPlayerFragment) 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 { override fun toolbarIconColor(): Int {
return ATHUtil.resolveColor(requireContext(), R.attr.iconColor) return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
} }
override fun onColorChanged(color: Int) { override fun onColorChanged(color: Int) {
plainPlaybackControlsFragment.setDark(color) plainPlaybackControlsFragment.setDark(color)
lastColor = color lastColor = color
callbacks!!.onPaletteColorChanged() 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() { override fun onFavoriteToggled() {

View File

@ -173,8 +173,7 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
override fun onUpdateProgressViews(progress: Int, total: Int) { override fun onUpdateProgressViews(progress: Int, total: Int) {
songCurrentProgress!!.text = String.format("%s / %s", MusicUtil.getReadableDurationString(progress.toLong()), songCurrentProgress!!.text = String.format("%s / %s", MusicUtil.getReadableDurationString(progress.toLong()), MusicUtil.getReadableDurationString(total.toLong()))
MusicUtil.getReadableDurationString(total.toLong()))
} }
override fun setDark(color: Int) { override fun setDark(color: Int) {

View File

@ -68,7 +68,6 @@ class SimplePlayerFragment : AbsPlayerFragment() {
callbacks?.onPaletteColorChanged() callbacks?.onPaletteColorChanged()
simplePlaybackControlsFragment.setDark(color) simplePlaybackControlsFragment.setDark(color)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity()) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity())
} }
override fun onFavoriteToggled() { override fun onFavoriteToggled() {
@ -83,11 +82,9 @@ class SimplePlayerFragment : AbsPlayerFragment() {
} }
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
playerToolbar.apply { playerToolbar.inflateMenu(R.menu.menu_player)
inflateMenu(R.menu.menu_player) playerToolbar.setNavigationOnClickListener { requireActivity().onBackPressed() }
setNavigationOnClickListener { requireActivity().onBackPressed() } playerToolbar.setOnMenuItemClickListener(this)
setOnMenuItemClickListener(this@SimplePlayerFragment) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity())
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity())
}
} }
} }