|
|
|
@ -173,7 +173,9 @@ class SearchAdapter(
@@ -173,7 +173,9 @@ class SearchAdapter(
|
|
|
|
|
albums[position - artists.size - 2] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ResultType.Track.ordinal -> tracks[position - artists.size - albums.size - sectionCount] |
|
|
|
|
ResultType.Track.ordinal -> { |
|
|
|
|
tracks[position - artists.size - albums.size - sectionCount] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else -> tracks[position] |
|
|
|
|
} |
|
|
|
@ -207,7 +209,18 @@ class SearchAdapter(
@@ -207,7 +209,18 @@ class SearchAdapter(
|
|
|
|
|
|
|
|
|
|
searchHeaderViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0) |
|
|
|
|
|
|
|
|
|
if (resultType == ResultType.Track.ordinal) { |
|
|
|
|
when (resultType) { |
|
|
|
|
ResultType.Artist.ordinal -> { |
|
|
|
|
rowTrackViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
0, 0, 0, 0 |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
ResultType.Album.ordinal -> { |
|
|
|
|
rowTrackViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
0, 0, 0, 0 |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
ResultType.Track.ordinal -> { |
|
|
|
|
(item as? Track)?.let { track -> |
|
|
|
|
context?.let { context -> |
|
|
|
|
if (track == currentTrack || track.current) { |
|
|
|
@ -238,29 +251,23 @@ class SearchAdapter(
@@ -238,29 +251,23 @@ class SearchAdapter(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
when (track.cached || track.downloaded) { |
|
|
|
|
true -> searchHeaderViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
R.drawable.downloaded, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
0 |
|
|
|
|
true -> rowTrackViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
R.drawable.downloaded, 0, 0, 0 |
|
|
|
|
) |
|
|
|
|
false -> searchHeaderViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
0 |
|
|
|
|
false -> rowTrackViewHolder?.title?.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
|
0, 0, 0, 0 |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (track.cached && !track.downloaded) { |
|
|
|
|
searchHeaderViewHolder?.title?.compoundDrawables?.forEach { |
|
|
|
|
rowTrackViewHolder?.title?.compoundDrawables?.forEach { |
|
|
|
|
it?.colorFilter = |
|
|
|
|
PorterDuffColorFilter(context.getColor(R.color.cached), PorterDuff.Mode.SRC_IN) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (track.downloaded) { |
|
|
|
|
searchHeaderViewHolder?.title?.compoundDrawables?.forEach { |
|
|
|
|
rowTrackViewHolder?.title?.compoundDrawables?.forEach { |
|
|
|
|
it?.colorFilter = |
|
|
|
|
PorterDuffColorFilter(context.getColor(R.color.downloaded), PorterDuff.Mode.SRC_IN) |
|
|
|
|
} |
|
|
|
@ -295,6 +302,7 @@ class SearchAdapter(
@@ -295,6 +302,7 @@ class SearchAdapter(
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun getPositionOf(type: ResultType, position: Int): Int { |
|
|
|
|
return when (type) { |
|
|
|
|