Browse Source

Added copyright and license information (#58).

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
57692f2e42
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 2
      app/src/main/java/com/github/apognu/otter/adapters/DownloadsAdapter.kt
  2. 4
      app/src/main/java/com/github/apognu/otter/fragments/TrackInfoDetailsFragment.kt
  3. 18
      app/src/main/java/com/github/apognu/otter/utils/Models.kt
  4. 2
      app/src/main/res/values-fr/strings.xml
  5. 2
      app/src/main/res/values/strings.xml

2
app/src/main/java/com/github/apognu/otter/adapters/DownloadsAdapter.kt

@ -79,7 +79,7 @@ class DownloadsAdapter(private val context: Context, private val listener: OnDow @@ -79,7 +79,7 @@ class DownloadsAdapter(private val context: Context, private val listener: OnDow
Download.STATE_QUEUED, Download.STATE_DOWNLOADING -> DownloadService.sendSetStopReason(context, PinService::class.java, download.contentId, 1, false)
Download.STATE_FAILED -> {
Track(download.id, download.title, Artist(0, download.artist, listOf()), Album(0, Album.Artist(""), "", Covers(""), ""), 0, listOf(Track.Upload(download.contentId, 0, 0))).also {
Track.fromDownload(download).also {
PinService.download(context, it)
}
}

4
app/src/main/java/com/github/apognu/otter/fragments/TrackInfoDetailsFragment.kt

@ -24,6 +24,8 @@ class TrackInfoDetailsFragment : DialogFragment() { @@ -24,6 +24,8 @@ class TrackInfoDetailsFragment : DialogFragment() {
"artistName" to track.artist.name,
"albumTitle" to track.album.title,
"trackTitle" to track.title,
"trackCopyright" to track.copyright,
"trackLicense" to track.license,
"trackPosition" to track.position,
"trackDuration" to track.bestUpload()?.duration?.toLong()?.let { toDurationString(it, showSeconds = true) },
"trackBitrate" to track.bestUpload()?.bitrate?.let { "${it / 1000} Kbps" },
@ -48,6 +50,8 @@ class TrackInfoDetailsFragment : DialogFragment() { @@ -48,6 +50,8 @@ class TrackInfoDetailsFragment : DialogFragment() {
properties.add(Pair(R.string.track_info_details_artist, getString("artistName")))
properties.add(Pair(R.string.track_info_details_album, getString("albumTitle")))
properties.add(Pair(R.string.track_info_details_track_title, getString("trackTitle")))
properties.add(Pair(R.string.track_info_details_track_copyright, getString("trackCopyright")))
properties.add(Pair(R.string.track_info_details_track_license, getString("trackLicense")))
properties.add(Pair(R.string.track_info_details_track_duration, getString("trackDuration")))
properties.add(Pair(R.string.track_info_details_track_position, getString("trackPosition")))
properties.add(Pair(R.string.track_info_details_track_bitrate, getString("trackBitrate")))

18
app/src/main/java/com/github/apognu/otter/utils/Models.kt

@ -96,18 +96,30 @@ data class Artist( @@ -96,18 +96,30 @@ data class Artist(
}
data class Track(
val id: Int,
val id: Int = 0,
val title: String,
val artist: Artist,
val album: Album,
val position: Int,
val uploads: List<Upload>
val position: Int = 0,
val uploads: List<Upload> = listOf(),
val copyright: String? = null,
val license: String? = null
) : SearchResult {
var current: Boolean = false
var favorite: Boolean = false
var cached: Boolean = false
var downloaded: Boolean = false
companion object {
fun fromDownload(download: DownloadInfo): Track = Track(
id = download.id,
title = download.title,
artist = Artist(0, download.artist, listOf()),
album = Album(0, Album.Artist(""), "", Covers(""), ""),
uploads = listOf(Upload(download.contentId, 0, 0))
)
}
data class Upload(
val listen_url: String,
val duration: Int,

2
app/src/main/res/values-fr/strings.xml

@ -84,6 +84,8 @@ @@ -84,6 +84,8 @@
<string name="track_info_details_artist">Artiste</string>
<string name="track_info_details_album">Album</string>
<string name="track_info_details_track_title">Nom de piste</string>
<string name="track_info_details_track_copyright">Copyright</string>
<string name="track_info_details_track_license">Licence</string>
<string name="track_info_details_track_duration">Durée</string>
<string name="track_info_details_track_position">Position dans l\'album</string>
<string name="track_info_details_track_bitrate">Bitrate</string>

2
app/src/main/res/values/strings.xml

@ -85,6 +85,8 @@ @@ -85,6 +85,8 @@
<string name="track_info_details_artist">Artist</string>
<string name="track_info_details_album">Album</string>
<string name="track_info_details_track_title">Track title</string>
<string name="track_info_details_track_copyright">Copyright</string>
<string name="track_info_details_track_license">License</string>
<string name="track_info_details_track_duration">Duration</string>
<string name="track_info_details_track_position">Album position</string>
<string name="track_info_details_track_bitrate">Bitrate</string>

Loading…
Cancel
Save