A simple custom view to display song covers on Android
-- | |
- Android min SDK 24
- In gradle 7 or latest
gradle groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
//here
maven { url 'https://jitpack.io' }
}
}
gradle kotlin
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
//here
maven ( url = "https://jitpack.io" )
}
}
- gradle groovy
dependencies{
...
implementation 'com.github.hall9zeha:DiscCoverView:1.0.0'
}
- gradle kotlin
dependencies{
...
implementation ("com.github.hall9zeha:DiscCoverView:1.0.0")
}
- Example implementation
...
<com.barryzeha.library.components.DiscCoverView
android:id="@+id/albumCover"
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/sample_cover"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
...
Property | Type | Example | Default value |
---|---|---|---|
shape | enum | "circle" or "rectangle" | circle |
trackColor | color | "#FF0000" or @color/my_color | #76FFFFFF |
speedRotation | integer | "1000" (milliseconds) | 3500 |
Check the example in the app module
val ivCoverView = findViewById<DiscCoverView>(R.id.albumCover)
ivCoverView.start()
ivCoverView.pause()
ivCoverView.resume()
// Stops rotation slowly to its original position
ivCoverView.stop()
// Stops rotation quickly to its original position
ivCoverView.end()