From 1bd8b15aad1dfad0b1dae1d1ba99b7f6d6cca73c Mon Sep 17 00:00:00 2001 From: h4h13 Date: Tue, 12 Nov 2019 23:05:17 +0530 Subject: [PATCH] Added color to fast scroller --- .../monkey/retromusic/activities/GenreDetailsActivity.kt | 3 +-- .../monkey/retromusic/activities/PlayingQueueActivity.kt | 2 ++ .../monkey/retromusic/activities/PlaylistDetailActivity.kt | 5 ++--- .../fragments/base/AbsLibraryPagerRecyclerViewFragment.kt | 3 +-- .../main/java/code/name/monkey/retromusic/util/ViewUtil.kt | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt index 9148b9b7..763c9950 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt @@ -8,7 +8,6 @@ import android.view.View import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.retromusic.App @@ -109,7 +108,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet } private fun setupRecyclerView() { - ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView, ThemeStore.accentColor(this)) + ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView ) songAdapter = ShuffleButtonSongAdapter(this, ArrayList(), R.layout.item_list, false, this) recyclerView.apply { itemAnimator = DefaultItemAnimator() diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt index ce67481c..6cb70c83 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt @@ -16,6 +16,7 @@ import code.name.monkey.retromusic.extensions.applyToolbar import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.ViewUtil import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils @@ -101,6 +102,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() { } } }) + ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView) } private fun checkForPadding() { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt index 19930a4a..ff7bd51b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt @@ -7,7 +7,6 @@ import android.view.MenuItem import android.view.View import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.retromusic.App @@ -78,7 +77,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli } private fun setUpRecyclerView() { - ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView, ThemeStore.accentColor(this)) + ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView) recyclerView.layoutManager = LinearLayoutManager(this) if (playlist is AbsCustomPlaylist) { adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this) @@ -182,7 +181,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli private fun checkForPadding() { val height = DensityUtil.dip2px(this, 52f) - recyclerView.setPadding(0, 0, 0, (height )) + recyclerView.setPadding(0, 0, 0, (height)) } private fun checkIsEmpty() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsLibraryPagerRecyclerViewFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsLibraryPagerRecyclerViewFragment.kt index 7fa55da7..f600f77d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsLibraryPagerRecyclerViewFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsLibraryPagerRecyclerViewFragment.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import androidx.annotation.NonNull import androidx.annotation.StringRes import androidx.recyclerview.widget.RecyclerView -import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.util.DensityUtil @@ -37,7 +36,7 @@ abstract class AbsLibraryPagerRecyclerViewFragment, private fun setUpRecyclerView() { if (recyclerView is FastScrollRecyclerView) { - ViewUtil.setUpFastScrollRecyclerViewColor(activity!!, recyclerView as FastScrollRecyclerView, ThemeStore.accentColor(activity!!)) + ViewUtil.setUpFastScrollRecyclerViewColor(requireActivity(), recyclerView as FastScrollRecyclerView) } recyclerView.layoutManager = layoutManager recyclerView.adapter = adapter diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt index 88436616..5d0c2539 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt @@ -30,6 +30,7 @@ import android.widget.ProgressBar import android.widget.SeekBar import androidx.annotation.ColorInt import androidx.core.view.ViewCompat +import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper @@ -92,7 +93,7 @@ object ViewUtil { } fun setUpFastScrollRecyclerViewColor(context: Context, - recyclerView: FastScrollRecyclerView, accentColor: Int) { + recyclerView: FastScrollRecyclerView, accentColor: Int = ThemeStore.accentColor(context)) { recyclerView.setPopupBgColor(accentColor) recyclerView.setPopupTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(accentColor))) recyclerView.setThumbColor(accentColor)