Skip to content

hall9zeha/DiscCoverView

Repository files navigation

DiscCoverView

A simple custom view to display song covers on Android

License

Screenshots

--

Requirements

  • Android min SDK 24

Implementation

How to use

1. Add the jitpack source in settings.gradle:

  • 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" )
    }
}

2. Add the dependency at application gradle level.

  • gradle groovy
dependencies{
    ...
    implementation 'com.github.hall9zeha:DiscCoverView:1.0.0'
}
  • gradle kotlin
dependencies{
    ...
    implementation ("com.github.hall9zeha:DiscCoverView:1.0.0")
}

Xml design

  • 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"/>
...

Properties

Property Type Example Default value
shape enum "circle" or "rectangle" circle
trackColor color "#FF0000" or @color/my_color #76FFFFFF
speedRotation integer "1000" (milliseconds) 3500

Methods

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()