Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaiiDango committed Mar 27, 2024
1 parent e3a364c commit be13491
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ object ScrobbleEverywhere {

// track player
val scrobbleSource = ScrobbleSource(
timeMillis = scrobbleData.timestamp * 1000L,
timeMillis = scrobbleData.timestamp,
pkg = trackInfo.packageName
)
PanoDb.db
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ abstract class ChartsPeriodFragment : Fragment(), MusicEntryItemClickListener {

val timePeriods = viewModel.timePeriods.value.keys

val startTime = Stuff.timeToUTC(timePeriods.first().start)
val endTime = Stuff.timeToUTC(timePeriods.last().end)
val startTime = Stuff.timeToUTC(timePeriods.last().start)
val endTime = Stuff.timeToUTC(timePeriods.first().end)
var openAtTime = Stuff.timeToUTC(
viewModel.selectedPeriod.value.start
)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/arn/scrobble/info/InfoExtraFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class InfoExtraFragment : BottomSheetDialogFragment(), MusicEntryItemClickListen
val features =
spotifyTrackWithFeatures.features ?: return@collectLatestLifecycleFlow

_binding ?: return@collectLatestLifecycleFlow

this@InfoExtraFragment.scheduleTransition()
val spotifyFeaturesBinding = LayoutSpotifyTrackFeaturesBinding.bind(
binding.infoSpotifyFeatures.inflate()
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/arn/scrobble/recents/ScrobblesAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class ScrobblesAdapter(
}

private fun setPlayerIcon(track: Track) {
val timeSecs = track.date
val time = track.date
binding.playerIcon.visibility = View.VISIBLE

fun fetchIcon(pkgName: String) {
Expand All @@ -329,19 +329,19 @@ class ScrobblesAdapter(
}
}

if (timeSecs != null && viewModel.pkgMap[timeSecs] != null) {
fetchIcon(viewModel.pkgMap[timeSecs]!!)
if (time != null && viewModel.pkgMap[time] != null) {
fetchIcon(viewModel.pkgMap[time]!!)
} else {
binding.playerIcon.dispose()
binding.playerIcon.load(null)
binding.playerIcon.contentDescription = null
job?.cancel()

if (timeSecs != null) {
if (time != null) {
job = viewModel.viewModelScope.launch(Dispatchers.IO) {
delay(100)
playerDao.findPlayer(timeSecs)?.pkg?.let { pkgName ->
viewModel.pkgMap[timeSecs] = pkgName
playerDao.findPlayer(time)?.pkg?.let { pkgName ->
viewModel.pkgMap[time] = pkgName
fetchIcon(pkgName)
}
}
Expand Down

0 comments on commit be13491

Please sign in to comment.