Fix linting issues
This commit is contained in:
parent
a77d3c0222
commit
b380639143
|
@ -12,7 +12,6 @@ import com.github.apognu.otter.adapters.PlaylistTracksAdapter
|
|||
import com.github.apognu.otter.repositories.FavoritesRepository
|
||||
import com.github.apognu.otter.repositories.ManagementPlaylistsRepository
|
||||
import com.github.apognu.otter.repositories.PlaylistTracksRepository
|
||||
import com.github.apognu.otter.repositories.Repository
|
||||
import com.github.apognu.otter.utils.*
|
||||
import com.squareup.picasso.Picasso
|
||||
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation
|
||||
|
@ -198,4 +197,4 @@ class PlaylistTracksFragment : OtterFragment<PlaylistTrack, PlaylistTracksAdapte
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.github.apognu.otter.fragments
|
|||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
@ -226,4 +225,4 @@ class TracksFragment : OtterFragment<Track, TracksAdapter>() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,11 @@ data class PlaylistAdd(val tracks: List<Int>, val allow_duplicates: Boolean)
|
|||
|
||||
class PlaylistsRepository(override val context: Context?) : Repository<Playlist, PlaylistsCache>() {
|
||||
override val cacheId = "tracks-playlists"
|
||||
override val upstream = HttpUpstream<Playlist, OtterResponse<Playlist>>(HttpUpstream.Behavior.Progressive, "/api/v1/playlists/?playable=true&ordering=name", object : TypeToken<PlaylistsResponse>() {}.type)
|
||||
override val upstream = HttpUpstream<Playlist, OtterResponse<Playlist>>(
|
||||
HttpUpstream.Behavior.Progressive,
|
||||
"/api/v1/playlists/?playable=true&ordering=name",
|
||||
object : TypeToken<PlaylistsResponse>() {}.type
|
||||
)
|
||||
|
||||
override fun cache(data: List<Playlist>) = PlaylistsCache(data)
|
||||
override fun uncache(reader: BufferedReader) = gsonDeserializerOf(PlaylistsCache::class.java).deserialize(reader)
|
||||
|
@ -24,7 +28,11 @@ class PlaylistsRepository(override val context: Context?) : Repository<Playlist,
|
|||
|
||||
class ManagementPlaylistsRepository(override val context: Context?) : Repository<Playlist, PlaylistsCache>() {
|
||||
override val cacheId = "tracks-playlists-management"
|
||||
override val upstream = HttpUpstream<Playlist, OtterResponse<Playlist>>(HttpUpstream.Behavior.AtOnce, "/api/v1/playlists/?scope=me&ordering=name", object : TypeToken<PlaylistsResponse>() {}.type)
|
||||
override val upstream = HttpUpstream<Playlist, OtterResponse<Playlist>>(
|
||||
HttpUpstream.Behavior.AtOnce,
|
||||
"/api/v1/playlists/?scope=me&ordering=name",
|
||||
object : TypeToken<PlaylistsResponse>() {}.type
|
||||
)
|
||||
|
||||
override fun cache(data: List<Playlist>) = PlaylistsCache(data)
|
||||
override fun uncache(reader: BufferedReader) = gsonDeserializerOf(PlaylistsCache::class.java).deserialize(reader)
|
||||
|
@ -51,7 +59,7 @@ class ManagementPlaylistsRepository(override val context: Context?) : Repository
|
|||
fun add(id: Int, tracks: List<Track>) {
|
||||
val body = PlaylistAdd(tracks.map { it.id }, false)
|
||||
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/${id}/add/")).apply {
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/$id/add/")).apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
header("Authorization", "Bearer ${Settings.getAccessToken()}")
|
||||
}
|
||||
|
@ -68,7 +76,7 @@ class ManagementPlaylistsRepository(override val context: Context?) : Repository
|
|||
suspend fun remove(id: Int, track: Track, index: Int) {
|
||||
val body = mapOf("index" to index)
|
||||
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/${id}/remove/")).apply {
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/$id/remove/")).apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
header("Authorization", "Bearer ${Settings.getAccessToken()}")
|
||||
}
|
||||
|
@ -83,7 +91,7 @@ class ManagementPlaylistsRepository(override val context: Context?) : Repository
|
|||
fun move(id: Int, from: Int, to: Int) {
|
||||
val body = mapOf("from" to from, "to" to to)
|
||||
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/${id}/move/")).apply {
|
||||
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/$id/move/")).apply {
|
||||
if (!Settings.isAnonymous()) {
|
||||
header("Authorization", "Bearer ${Settings.getAccessToken()}")
|
||||
}
|
||||
|
@ -96,4 +104,4 @@ class ManagementPlaylistsRepository(override val context: Context?) : Repository
|
|||
.awaitByteArrayResponseResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.util.AttributeSet
|
|||
import android.view.MotionEvent
|
||||
import android.widget.FrameLayout
|
||||
|
||||
class DisableableFrameLayout : FrameLayout {
|
||||
class DisableableFrameLayout : FrameLayout {
|
||||
var callback: ((MotionEvent?) -> Boolean)? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
@ -23,4 +23,4 @@ class DisableableFrameLayout : FrameLayout {
|
|||
fun setShouldRegisterTouch(callback: (event: MotionEvent?) -> Boolean) {
|
||||
this.callback = callback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue