AutoRefreshListView
public class AutoRefreshListView extends ListView implements OnScrollListener {
private static final String TAG = "AutoRefreshListView";
private final static int RELEASE_To_REFRESH = 0;
private final static int PULL_To_REFRESH = 1;
private final static int REFRESHING = 2;
private final static int DONE = 3;
private final static int LOADING = 4;
private final static int UP_To_REFRESH = 5;//当拖动到最底部时载向上拖动 自动刷新
boolean isboottom=false;
int scrolledItemCount ;//已经滚动了多少项
int visibleItemCount;//当前可见项
int totalItemCount;//总共有多少项
// 实际的padding的距离与界面上偏移距离的比例
private final static int RATIO = 3;
private LayoutInflater inflater;
private LinearLayout headView;
private TextView tipsTextview;
private TextView lastUpdatedTextView;
private ImageView arrowImageView;
private ProgressBar progressBar;
private ProgressBar footerProgressBar;
LinearLayout footer;
Button footerBtn;//footer
private RotateAnimation animation;
private RotateAnimation reverseAnimation;
// 用于保证startY的值在一个完整的touch事件中只被记录一次
private boolean isRecored;
private int headContentWidth;
private int headContentHeight;
private int startY;//下拉刷新起始记录
private int startYY;public class AutoR