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
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() {

View File

@ -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() {

View File

@ -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) {

View File

@ -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())
}
}