All Projects → xiandanin → Loadingbar

xiandanin / Loadingbar

极简使用的解耦Loading组件 - http://blog.csdn.net/aa464971/article/details/70197394

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Loadingbar

android-blog-samples
source code for my blog~
Stars: ✭ 32 (-82.12%)
Mutual labels:  dialog, loading
Vue Ui For Pc
基于Vue2.x的一套PC端UI组件,包括了Carousel 跑马灯、Cascader 级联、Checkbox 多选框、Collapse 折叠面板、DatePicker 日期选择、Dialog 对话框、Form 表单、Input 输入框、InputNumber 数字输入框、Layer 弹窗层、Loading 加载、Menu 菜单、Page 分页、Progress 进度条、Radio 单选框、SelectDropDown 仿select、Switch 开关、Table 表格、Tabs 标签页、Textarea 文本框、Tooltip 文字提示、BackTop 返回顶部、steps 步骤条、Transfer 穿梭框、Tree 树形、Upload 文件上传、Lazy 图片懒加载、Loading 加载、Pagination 分页等等
Stars: ✭ 156 (-12.85%)
Mutual labels:  dialog, loading
Dialogutil
common used dialog with material style ( in support v7),ios style,get top activity automatically, invoke everywhere (any thread , any window)
Stars: ✭ 948 (+429.61%)
Mutual labels:  dialog, loading
TipDialog
flutter tip dialog
Stars: ✭ 78 (-56.42%)
Mutual labels:  dialog, loading
Android Loading Dialog
这个是我在泡网看见的一个等待的dialog
Stars: ✭ 297 (+65.92%)
Mutual labels:  dialog, loading
Android Circledialog
仿IOS圆角对话框、进度条、列表框、输入框,ad广告框,支持横竖屏切换
Stars: ✭ 880 (+391.62%)
Mutual labels:  dialog, loading
Aiforms.dialogs
AiForms.Dialogs for Xamarin.Forms
Stars: ✭ 143 (-20.11%)
Mutual labels:  dialog, loading
Scriptui Dialog Builder Joonas
A web app for designing and building Adobe ScriptUI javascript dialogs (Illustrator, Indesign, Photoshop, After Effects, Bridge). Design your dialog using a graphical interface and export as .jsx
Stars: ✭ 161 (-10.06%)
Mutual labels:  dialog
Notiflix
Notiflix is a JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.
Stars: ✭ 172 (-3.91%)
Mutual labels:  loading
Dialog
👻 A simple to use, highly customizable, and powerful modal for Angular Applications
Stars: ✭ 158 (-11.73%)
Mutual labels:  dialog
Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+973.74%)
Mutual labels:  dialog
Androidmaterialdialog
Provides builders, which allow to create various "Material Design"-styled dialogs
Stars: ✭ 161 (-10.06%)
Mutual labels:  dialog
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-3.35%)
Mutual labels:  loading
Discovery
Discoveries on Sustainable Loading research
Stars: ✭ 174 (-2.79%)
Mutual labels:  loading
React Native Android Location Services Dialog Box
React Native Android Location Services Dialog Box
Stars: ✭ 175 (-2.23%)
Mutual labels:  dialog
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-2.79%)
Mutual labels:  dialog
Chatbot Watson Android
An Android ChatBot powered by Watson Services - Assistant, Speech-to-Text and Text-to-Speech on IBM Cloud.
Stars: ✭ 169 (-5.59%)
Mutual labels:  dialog
Alerttoast
Create Apple-like alerts & toasts using SwiftUI
Stars: ✭ 151 (-15.64%)
Mutual labels:  dialog
Hgplaceholders
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project
Stars: ✭ 2,048 (+1044.13%)
Mutual labels:  loading
Flash
⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter.
Stars: ✭ 174 (-2.79%)
Mutual labels:  dialog

LoadingBar

English Document

LoadingBar已升级2.01.x版本无法迁移2.0,但1.x会持续维护

下载示例

Gralde引入

implementation 'com.dyhdyh.loadingbar2:loadingbar:2.0.1'

简单用法(默认样式)

LoadingView

//以View的形式显示loading
//这里的parent需要是可覆盖的布局,如果传的不是可覆盖的布局,会一直随着层级往上找
//FrameLayout/RelativeLayout/ConstraintLayout/DrawerLayout/CoordinatorLayout/CardView
LoadingBar.view(parent).show();

//需要跟show方法传的是同一个parent 才能正确取消
LoadingBar.view(parent).cancel();

LoadingDialog

//以Dialog的形式显示Loading
//注意这里context不能用ApplicationContext
LoadingBar.dialog(context).show();

//取消Dialog
//需要跟show方法传的是同一个context 才能正确取消
LoadingBar.dialog(context).cancel();

进阶用法

LoadingView

LoadingBar.view(parent)
        //通过工厂设置样式
        //.setFactory(new CustomViewFactory())
        //通过View设置样式
        //.setFactoryFromView(view)
        //通过布局ID设置样式
        .setFactoryFromResource(R.layout.layout_custom)
        //携带参数
        .extras(new Object[]{})
        .show();

//通过工厂设置样式
public class CustomViewFactory implements LoadingFactory<ViewGroup, View> {

    /**
     * 工厂类的标识符
     * 在cancel()之前多次调用show()时,当key相同时不会重新调用onCreate
     * @return
     */
    @Override
    public String getKey() {
        return getClass().getName();
    }

    @Override
    public View onCreate(ViewGroup parent) {
        //这里return的View就是Loading的样式
        return LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_custom, parent, false);;
    }

    @Override
    public void updateStatus(Object[] extras) {
    	//每次调用show会回调这里  还有携带的参数
    }
}

LoadingDialog

LoadingBar.dialog(context)
        //通过工厂设置样式
        //.setFactory(new CustomDialogFactory())
        //通过View设置样式
        //.setFactoryFromView(view)
        //通过布局ID设置样式
        .setFactoryFromResource(R.layout.layout_custom)
        //携带参数
        .extras(new Object[]{})
        .show();

//通过工厂设置样式
public class CustomDialogFactory implements LoadingFactory<Context, Dialog> {
    /**
     * 工厂类的标识符
     * 在cancel()之前多次调用show()时,当key相同时不会重新调用onCreate
     * @return
     */
    @Override
    public String getKey() {
        return getClass().getName();
    }

    @Override
    public Dialog onCreate(Context params) {
        //这里return的dialog就是Loading的样式
        return new AlertDialog.Builder(params)
                .setView(R.layout.layout_custom)
                .setCancelable(false)
                .create();
    }

    @Override
    public void updateStatus(Object[] extras) {
    	//每次调用show会回调这里  还有携带的参数
    }
}

如果是通过匿名内部类创建的FactorygetKey()需要自定义以保证可以区分样式,例如用layoutId区分

private LoadingFactory<ViewGroup, View> createViewFactoryFromResource(@LayoutRes int layoutId) {
        return new LoadingFactory<ViewGroup, View>() {

            @Override
            public String getKey() {
                return String.format(Locale.getDefault(), "[email protected]%d", layoutId);
            }

            @Override
            public View onCreate(ViewGroup parent) {
                return LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
            }

            @Override
            public void updateStatus(Object[] extras) {

            }
        };
    }

其它API

ControllerHandler

//使用ControllerHandler可以更进一步定制
//下面的例子演示了 更换LoadingView的Parent查找策略
LoadingBar.view(loadingContainer)
        .setControllerHandler(new ControllerHandler() {
            @Override
            public void handle(LoadingController controller) {
                //调整Parent查找策略
                if (controller instanceof LoadingViewController) {
                    ((LoadingViewController) controller).setParentStrategy(new SimpleParentStrategy());
                }
            }
        }).show();

手动释放

当调用cancel()的时候,LoadingBar会自动释放,如果有不正常cancel的情况,可以调用release手动释放。

LoadingBar.release();

可以通过getPoolCount查看当前没有释放的资源数量。

LoadingBar.getPoolCount();

截图

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].