Lint.
This commit is contained in:
parent
a4b2907c07
commit
e50a43a812
|
@ -2,13 +2,15 @@ package com.github.apognu.otter
|
|||
|
||||
import android.app.Application
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.github.apognu.otter.utils.*
|
||||
import com.github.apognu.otter.utils.Cache
|
||||
import com.github.apognu.otter.utils.Command
|
||||
import com.github.apognu.otter.utils.Event
|
||||
import com.github.apognu.otter.utils.Request
|
||||
import com.preference.PowerPreference
|
||||
import kotlinx.coroutines.channels.BroadcastChannel
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.channels.ConflatedBroadcastChannel
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
|
||||
class Otter : Application() {
|
||||
|
|
|
@ -52,8 +52,7 @@ class MediaControlsManager(val context: Service, private val mediaSession: Media
|
|||
putLong(MediaMetadata.METADATA_KEY_DURATION, (track.bestUpload()?.duration?.toLong() ?: 0L) * 1000)
|
||||
|
||||
cover?.let {
|
||||
try { putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, it.get()) }
|
||||
catch (_: Exception) {}
|
||||
try { putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, it.get()) } catch (_: Exception) {}
|
||||
}
|
||||
}.build())
|
||||
|
||||
|
@ -71,12 +70,10 @@ class MediaControlsManager(val context: Service, private val mediaSession: Media
|
|||
.setSmallIcon(R.drawable.ottericon)
|
||||
.run {
|
||||
if (cover != null) {
|
||||
try { setLargeIcon(cover.get()) }
|
||||
catch (_: Exception) {}
|
||||
try { setLargeIcon(cover.get()) } catch (_: Exception) {}
|
||||
|
||||
this
|
||||
}
|
||||
else this
|
||||
} else this
|
||||
}
|
||||
.setContentTitle(track.title)
|
||||
.setContentText(track.artist.name)
|
||||
|
|
|
@ -10,8 +10,8 @@ import com.google.gson.reflect.TypeToken
|
|||
import java.io.BufferedReader
|
||||
|
||||
class ArtistTracksRepository(override val context: Context?, private val artistId: Int) : Repository<Track, TracksCache>() {
|
||||
override val cacheId = "tracks-artist-${artistId}"
|
||||
override val upstream = HttpUpstream<Track, FunkwhaleResponse<Track>>(HttpUpstream.Behavior.AtOnce, "/api/v1/tracks/?playable=true&artist=${artistId}", object : TypeToken<TracksResponse>() {}.type)
|
||||
override val cacheId = "tracks-artist-$artistId"
|
||||
override val upstream = HttpUpstream<Track, FunkwhaleResponse<Track>>(HttpUpstream.Behavior.AtOnce, "/api/v1/tracks/?playable=true&artist=$artistId", object : TypeToken<TracksResponse>() {}.type)
|
||||
|
||||
override fun cache(data: List<Track>) = TracksCache(data)
|
||||
override fun uncache(reader: BufferedReader) = gsonDeserializerOf(TracksCache::class.java).deserialize(reader)
|
||||
|
|
Loading…
Reference in New Issue