Fixed issue with merging around favorite management.
This commit is contained in:
parent
40117122c7
commit
b7db24ea11
|
@ -314,9 +314,7 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
now_playing_details_favorite?.let { now_playing_details_favorite ->
|
||||
now_playing_details_favorite.setOnClickListener {
|
||||
when (track.favorite) {
|
||||
true -> {
|
||||
|
@ -329,11 +327,11 @@ class MainActivity : AppCompatActivity() {
|
|||
now_playing_details_favorite.setColorFilter(getColor(R.color.colorFavorite))
|
||||
}
|
||||
}
|
||||
|
||||
track.favorite = !track.favorite
|
||||
|
||||
favoriteRepository.fetch(Repository.Origin.Network.origin)
|
||||
}
|
||||
|
||||
track.favorite = !track.favorite
|
||||
|
||||
favoriteRepository.fetch(Repository.Origin.Network.origin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,6 @@ class TracksAdapter(private val context: Context?, private val favoriteListener:
|
|||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val track = data[position]
|
||||
|
||||
log("Bind ${track.favorite}")
|
||||
|
||||
Picasso.get()
|
||||
.maybeLoad(maybeNormalizeUrl(track.album.cover.original))
|
||||
.fit()
|
||||
|
@ -144,6 +142,7 @@ class TracksAdapter(private val context: Context?, private val favoriteListener:
|
|||
}
|
||||
|
||||
notifyItemMoved(oldPosition, newPosition)
|
||||
|
||||
CommandBus.send(Command.MoveFromQueue(oldPosition, newPosition))
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,8 @@ class QueueFragment : BottomSheetDialogFragment() {
|
|||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_queue, container, false).apply {
|
||||
adapter = TracksAdapter(context, FavoriteListener(), fromQueue = true).also {
|
||||
queue.layoutManager = LinearLayoutManager(context)
|
||||
queue.adapter = it
|
||||
adapter = TracksAdapter(context, fromQueue = true).also {
|
||||
included.queue.layoutManager = LinearLayoutManager(context)
|
||||
included.queue.adapter = it
|
||||
}
|
||||
included.queue.layoutManager = LinearLayoutManager(context)
|
||||
included.queue.adapter = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +68,7 @@ class QueueFragment : BottomSheetDialogFragment() {
|
|||
private fun refresh() {
|
||||
GlobalScope.launch(Main) {
|
||||
RequestBus.send(Request.GetQueue).wait<Response.Queue>()?.let { response ->
|
||||
included?.let {
|
||||
included?.let { included ->
|
||||
adapter?.let {
|
||||
it.data = response.queue.toMutableList()
|
||||
it.notifyDataSetChanged()
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.github.apognu.otter.repositories
|
||||
|
||||
import android.content.Context
|
||||
import com.github.apognu.otter.utils.FunkwhaleResponse
|
||||
import com.github.apognu.otter.utils.Track
|
||||
import com.github.apognu.otter.utils.TracksCache
|
||||
import com.github.apognu.otter.utils.TracksResponse
|
||||
import com.github.apognu.otter.utils.*
|
||||
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
|
Loading…
Reference in New Issue