Browse Source

Lint.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
e50a43a812
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 6
      app/src/main/java/com/github/apognu/otter/Otter.kt
  2. 9
      app/src/main/java/com/github/apognu/otter/playback/MediaControlsManager.kt
  3. 4
      app/src/main/java/com/github/apognu/otter/repositories/ArtistTracksRepository.kt

6
app/src/main/java/com/github/apognu/otter/Otter.kt

@ -2,13 +2,15 @@ package com.github.apognu.otter @@ -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() {

9
app/src/main/java/com/github/apognu/otter/playback/MediaControlsManager.kt

@ -52,8 +52,7 @@ class MediaControlsManager(val context: Service, private val mediaSession: Media @@ -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 @@ -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)

4
app/src/main/java/com/github/apognu/otter/repositories/ArtistTracksRepository.kt

@ -10,8 +10,8 @@ import com.google.gson.reflect.TypeToken @@ -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…
Cancel
Save