android 关于音乐进度 circular-music-progressbar

circular-music-progressbar

简介:Beautiful Circular Progress Bar with album art for android

Hero Image

Description

This Circular Progress bar is a designed and made for music players that need beautiful music progress bar.

Usage

To use Circular Music ProgressBar you must add it as a dependency in your Gradle build:

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }

Step 2. Add the dependency

dependencies {
    compile 'com.github.aliab:circular-music-progressbar:v1.0'
}

Then add the view to your layout:

    <info.abdolahi.CircularMusicProgressBar
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/album_art"
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_gravity="center"
        android:src="@drawable/maron5"
        app:border_color="#00796B"
        app:border_width="2dp"
        app:centercircle_diammterer="1"
        app:progress_color="#80CBC4"
        app:progress_startAngle="40" />

XML attributes

    <info.abdolahi.CircularMusicProgressBar
        ...
        app:border_color="#00796B"
        app:border_width="2dp"
        app:centercircle_diammterer="1"
        app:progress_color="#80CBC4"
        app:progress_startAngle="40"
        ...
         />

XML attributes

NameTypeDefaultDescription
border_colorColorColor.BLACKProgressBar background color
border_widthdimen2Thicknes of progress bar
centercircle_diammtererFloat0.805fNumber between 0 and 1, that change diammeter of album art image
progress_colorColorColor.BLUEProgressBar active state color
progress_startAngleFloat0Number between 0 and 360 that describe Start angle of progress bar active state

Public Methods

NameDescription
setValue(float)change value of progress with animation
setBorderProgressColor(Color)set progressbar active state color
setBorderColor(Color)set progressbar non-active state color

Note: Because I extended ImageView you can use all ImageView public methods too.

Limitations

  • The ScaleType is always CENTER_CROP and you'll get an exception if you try to change it. This is (currently) by design as it's perfectly fine for music album art.
  • Enabling adjustViewBounds is not supported as this requires an unsupported ScaleType
  • If you use an image loading library like Picasso or Glide, you need to disable their fade animations to avoid messed up images. For Picasso use the noFade() option, for Glide use dontAnimate(). If you want to keep the fadeIn animation, you have to fetch the image into a Target and apply a custom animation yourself when receiving the Bitmap.
  • Using a TransitionDrawable with CircleImageView doesn't work properly and leads to messed up images.

Todo

  • Animation interpolator setter
  • Animation disable/enable method
  • Buffering mode animation
  • Drag to seek listener
  • change thickness of borderes independently
  • support shadow/glow

Changelog

v1.0.0

  • Initial release

CREDITS

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值