songdataprovider

A simple library to grab song data to build a music library app

Лицензия

Лицензия

Категории

Категории

IDE Инструменты разработки Данные
Группа

Группа

com.ericchee
Идентификатор

Идентификатор

songdataprovider
Последняя версия

Последняя версия

1.0.8
Дата

Дата

Тип

Тип

aar
Описание

Описание

songdataprovider
A simple library to grab song data to build a music library app
Ссылка на сайт

Ссылка на сайт

https://github.com/echeeUW/SongDataProvider
Система контроля версий

Система контроля версий

https://github.com/echeeUW/SongDataProvider

Скачать songdataprovider

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.ericchee/songdataprovider/ -->
<dependency>
    <groupId>com.ericchee</groupId>
    <artifactId>songdataprovider</artifactId>
    <version>1.0.8</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.ericchee/songdataprovider/
implementation 'com.ericchee:songdataprovider:1.0.8'
// https://jarcasting.com/artifacts/com.ericchee/songdataprovider/
implementation ("com.ericchee:songdataprovider:1.0.8")
'com.ericchee:songdataprovider:aar:1.0.8'
<dependency org="com.ericchee" name="songdataprovider" rev="1.0.8">
  <artifact name="songdataprovider" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.ericchee', module='songdataprovider', version='1.0.8')
)
libraryDependencies += "com.ericchee" % "songdataprovider" % "1.0.8"
[com.ericchee/songdataprovider "1.0.8"]

Зависимости

compile (5)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-parcelize-runtime jar 1.4.32
» unspecified jar
org.jetbrains.kotlin : kotlin-stdlib-jdk7 jar 1.4.32
androidx.appcompat » appcompat jar 1.2.0
androidx.core » core-ktx jar 1.3.2

Модули Проекта

Данный проект не имеет модулей.

SongDataProvider

This library provides simple classes & functions to show basic Song data.

Usage

To use this library, add this implementation line to your build.gradle (app) dependencies block:

dependencies {
    ...
    implementation("com.ericchee:songdataprovider:1.0.8@aar")
}

Documentation

Song

Song is a data model class that contains info about an individual song

data class Song(
    val id: String,
    val title: String,
    val artist: String,
    val durationMillis: Long,
    val smallImageID: Int,
    val largeImageID: Int
): Parcelable

smallImageID and largeImageID are drawable resource ID's. Use ImageView.setImageResource() to set drawable as imageView's source.

Note: This class Song is Parcelable meaning it can be passed through Intents

SongDataProvider.getAllSongs()

Use SongDataProvider.getAllSongs() to get a list of Songs

val allSongs: List<Song> = SongDataProvider.getAllSongs()

val firstSong: Song = allSongs[1]
val artistName: String = firstSong.artist

SongDataProvider.createRandomSong()

The method createRandomSong() can be used to create a quick song with generic song info.

val randomSong: Song = SongDataProvider.createRandomSong()

SongDataProvider.createSong()

The method createSong() can be used to create a quick song where the ID, & duration will be auto generated for you

Definition:

fun createSong(
    title: String,
    artist: String,
    id: String = "${System.currentTimeMillis()}$title:$artist",
    durationMillis: Long = Random.nextLong(
        60000,
        300000
    )
): Song

Usage):

val thrillerSong: Song = SongDataProvider.createSong("Thriller", "Michael Jackson")

Notice how a song id & duration are optional. They will be auto-generatoed upon creation

Версии библиотеки

Версия
1.0.8
1.0.7
1.0.6