【开源】ElasticDownload

ElasticDownload

  •  https://github.com/Tibolte/ElasticDownload

    介绍:

    "最近我的一个朋友在Dribble上发现了一个下载动画, 我们发现这个动画很有趣于是决定为android开发一个。 我们的实现方式是用自定义的view,旋转canvas和绘制path。"

    运行效果:

使用说明:

Dribble上的地址 https://dribbble.com/shots/1887815-Download?list=users&offset=4  

 

在布局中声明如下view,也可以手动的inflate(应该是指在java代码中吧)

1
2
3
4
5
    <is.arontibo.library.ElasticDownloadView
        android:id="@+id/elastic_download_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"/>

首先调用 startIntro() 让view可以显示百分比:

1
2
3
   @InjectView(R.id.elastic_download_view) ElasticDownloadView mElasticDownloadView;
 
    mElasticDownloadView.startIntro();

设置进度

1
    mElasticDownloadView.setProgress(25);

通知下载是否成功:

1
2
3
   mElasticDownloadView.success(); //This function moves the cursor to 100 if the progress has not been set already
 
    mElasticDownloadView.fail();

 

posted on 2015-05-08 13:27  wasdchenhao  阅读(111)  评论(0)    收藏  举报

导航