介绍
轻松显示加载错误,加载中,以及空布局等。
public class LoadingActivity extends BaseActivity {
@BindView(R.id.loadingLayout)LoadingLayout loadingLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadingLayout.setEmptyClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
toast("空视图点击事件");
}
});
loadingLayout.setErrorClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
toast("错误按钮,点击刷新时,触发");
}
});
// requestPermisstion(200,new String[]{Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION});
}
// @Override
// public void onPermissionSuccess() {
// toast("权限申请成功");
// }
//
// @Override
// public void onPermissionError(String[] deniedPermissions) {
// toast("权限申请失败");
// }
@Override
public int setContentView() {
return R.layout.activity_loading;
}
@OnClick({R.id.btn_showContent,R.id.btn_showEmpty,R.id.btn_showError,R.id.btn_showLoading})
public void onClick(View view){
switch (view.getId()){
case R.id.btn_showContent:
toast("显示内容");
loadingLayout.showContent();
break;
case R.id.btn_showEmpty:
toast("显示空视图");
loadingLayout.showEmpty("我是空视图",R.drawable.ic_launcher);
break;
case R.id.btn_showError:
toast("显示错误信息");
loadingLayout.showError("我是错误信息",R.drawable.ic_launcher);
break;
case R.id.btn_showLoading:
toast("显示加载中");
loadingLayout.showLoading("正在加载数据");
break;
}
}
}
TIM图片20180706203203.jpg
网友评论