Skip to content

Commit

Permalink
Done migrate NowPlayingFragment to Compose. Fixed #448, Fixed #441
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Jul 21, 2024
1 parent e3108f0 commit 905e6e0
Show file tree
Hide file tree
Showing 17 changed files with 1,319 additions and 713 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class QueueAdapter(
mSwapListener = listener
}

fun getIndexOf(videoId: String): Int? {
for (i in listTrack.indices) {
if (listTrack.getOrNull(i)?.videoId == videoId) {
return i
}
}
return null
}

interface OnOptionClickListener {
fun onOptionClick(position: Int)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ class MainRepository
} else {
searchResponse.tracks.items.firstOrNull()
}
Log.d("Lyrics", "track: $track")
if (track != null) {
YouTube.getSpotifyCanvas(
track.id,
Expand Down Expand Up @@ -1642,7 +1641,6 @@ class MainRepository
} else {
searchResponse.tracks.items.firstOrNull()
}
Log.d("Lyrics", "track: $track")
if (track != null) {
YouTube.getSpotifyCanvas(
track.id,
Expand Down Expand Up @@ -1987,9 +1985,10 @@ class MainRepository
.onFailure {
Log.e(TAG, "Fix musixmatch search" + it.message.toString())
YouTube.getLrclibLyrics(qtrack, qartist, durationInt).onSuccess {
Log.w(TAG, "Liblrc Item lyrics ${it?.lyrics?.syncType.toString()}")
it?.let { emit(Pair(id, Resource.Success<Lyrics>(it.toLyrics()))) }
}.onFailure {
it.printStackTrace()
Log.e(TAG, "Liblrc Error: ${it.message}")
emit(Pair(id, Resource.Error<Lyrics>("Not found")))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import kotlinx.coroutines.flow.cancellable
import kotlinx.coroutines.runBlocking
import javax.inject.Inject


@AndroidEntryPoint
@UnstableApi
class SimpleMediaService : MediaLibraryService() {
Expand Down Expand Up @@ -177,6 +178,11 @@ class SimpleMediaService : MediaLibraryService() {
Log.d("SimpleMediaService", "onDestroy: ")
}

override fun onTrimMemory(level: Int) {
super.onTrimMemory(level)
simpleMediaServiceHandler.mayBeSaveRecentSong()
}

@UnstableApi
override fun onTaskRemoved(rootIntent: Intent?) {
super.onTaskRemoved(rootIntent)
Expand Down
Loading

0 comments on commit 905e6e0

Please sign in to comment.