App.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:QMark 作者:
/**
 * 返回是否应该加载数据
 * 
 * @param empty 页面是否为空
 * @param showLoading 如果为空,且有网络的情况下是否显示正在加载,若为false则显示点击重新加载
 * @param 用来显示这些图片的ImageView
 **/
public static boolean showLoadingOrNoNet(boolean empty, boolean showLoading, boolean feedbackIfNoNet, ImageView imgState) {
    if (empty) {
        if (feedbackIfNoNet ? checkNetStateAndFeedbackUser() : Network.isNetConnected(get())) {
            if (showLoading) {
                imgState.setVisibility(View.VISIBLE);
                imgState.setImageResource(R.drawable.anim_list_i_pull_2_refresh_header);
                AnimationDrawable anim = (AnimationDrawable)imgState.getDrawable();
                anim.start();
                return true;
            } else {
                imgState.setVisibility(View.VISIBLE);
                imgState.setImageResource(R.drawable.img_common_click_reload);
            }
        } else {
            imgState.setVisibility(View.VISIBLE);
            imgState.setImageResource(R.drawable.img_common_no_net);
        }
    } else {
        imgState.setImageResource(0);
        imgState.setVisibility(View.GONE);
    }
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号