Code Monkey home page Code Monkey logo

demoloadview's Introduction

LoadViewHelper

#切换加载中,加载失败,加载成功布局,支持全局和局部之自定义布局 定义一个LoadViewHelper所有界面通用,无需添加布局中view, 大大降低耦合性。

LoadViewHelper

通过Gradle抓取:

compile 'com.ycjiang:loadviewhelper:1.1.0'
<dependency>
  <groupId>com.ycjiang</groupId>
  <artifactId>loadviewhelper</artifactId>
  <version>1.1.0/version>
  <type>pom</type>
</dependency>

更新日志

1.1.0

  • 1.优化内部处理,代码更简洁
    * 1.增加弹打入染出效果。

在你Framgment 或者ACtivity

    LoadViewHelper helper = new LoadViewHelper(listView);  
	    //将listview切换成显示加载中布局

		helper.showLoading("加载中...");

		//将listview切换成显示空数据布局
		helper.showEmpty("暂无数据", "重试");
		//或者
		helper.showEmpty();
	//	监听重试按钮
		  helper.setListener(new OnLoadViewListener() {
                    @Override
                    public void onRetryClick() {
                        Toast.makeText(getApplicationContext(), "点击了重试", Toast.LENGTH_SHORT).show();
                    }
      });

可以 自定义 加载中,加载失败,加载为空 布局 实现自己加载效果

使用全部自定义布局

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
            LoadViewHelper.getBuilder()
                .setLoadEmpty(R.layout.this_empty)
                .setLoadError(R.layout.this_error)
                .setLoadIng(R.layout.this_load_ing);
    }
}

使用局部自定义布局

  helper.setLoadEmpty(view)
  helper.setLoadEmpty(resId);
  helper.getLoadIng(view);
  helper.getLoadIng(resId);

demoloadview's People

Contributors

yangchaojiang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.