baso
来源:互联网 发布:mac版spss 如何安装 编辑:程序博客网 时间:2024/05/22 03:35
baso
ProgressBar with button and text below it.
Sample Usage
XML Layout
Without styles.xml
<id.gits.baso.BasoProgressView android:id="@+id/baso_ProgressView" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFF" android:gravity="center" app:baso_finishButtonText="Retry" app:baso_finishSrc="@drawable/baso_sample_error" app:baso_finishSrcWidth="160dp" app:baso_finishText="Something happened" app:baso_finishTextSize="18sp" app:baso_progressText="Loading"/>
With styles.xml
<id.gits.baso.BasoProgressView android:id="@+id/baso_ProgressView" style="@style/BasoCustom" android:layout_width="match_parent" android:layout_height="match_parent"/>
<style name="BasoCustom"> <item name="android:background">#FFF</item> <item name="baso_finishText">Something happened</item> <item name="baso_finishTextSize">18sp</item> <item name="baso_finishButtonText">Try Again</item> <item name="baso_progressText">Loading</item> <item name="baso_finishSrc">@drawable/baso_sample_error</item> <item name="baso_finishSrcWidth">160dp</item></style>
How to start and stop the progress
Start the progress
final BasoProgressView basoProgressView = (BasoProgressView) findViewById(R.id.baso_ProgressView); basoProgressView.startProgress();
Stop progress and show the button
The button will be automatically visible if you had written baso_finishButtonText
on xml layout. Once you have completed the action and you wanted to stop the progress and show a message (or error message), you can just call stop
or stopAndError
method.
// set message on the TextView or you can set baso_finishText on your xml layout.basoProgressView.setFinishedText("Something happened");// stop the progressbasoProgressView.stop();
Or you can simply call stopAndError
.
basoProgressView.stopAndError("Oops. Something happened.");
Stop progress and show both image and button
You have to declare baso_finishSrc
either on your xml layout or programmatically withsetFinishedImageResource
method.
basoProgressView.setFinishedImageResource(R.drawable.baso_sample_error);basoProgressView.stopAndError("Oops. Something happened.");
Complete the progress and make it invisible
Once you have completed the action and you wanted to hide BasoProgressView, you can just call stopAndGone
and use startProgress
to start progressing again.
basoProgressView.stopAndGone();
Set the button click listener
Don't forget to create click listener for the button.
basoProgressView.setOnButtonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { basoProgressView.startProgress(); //TODO: your action here such as call api }});
For complete sample usage, you can take a look at the sample project.
Install
dependencies { compile 'id.gits:baso:1.0'}
About GITS Indonesia
GITS Indonesia has been active in IT Industry since 2010. Since then, we have developed a lot of applications, both initiative projects and client requests. Our developers are familiar with desktop, website, and mobile programming, but we are currently focusing in mobile.
http://gits.co.id
- baso
- ArcEngine标注显示比率
- [LeetCode] 398. Random Pick Index
- Mybatis使用generator自动生成映射配置文件信息
- 关于s7 300的中值滤波
- ZooKeeper之(五)集群管理
- baso
- Spring MVC 教程,快速入门,深入分析
- 16.10.27
- 金额小数转换成中文大写金额
- 学生信息管理
- 虚函数、消息传递、this指针、构造函数、模板类3个
- 快速定位解决Android内存泄漏
- SuperPlayer 是一个基于 IjkPlayer 的控制器,支持手势操作,滑动快进,快退,支持,上滑音量亮度的变化,支持指点位置播放,播放源的切换
- java--swing--鼠标小手样式