Skip to content

Commit

Permalink
release 3.5.0 version
Browse files Browse the repository at this point in the history
  • Loading branch information
huxq17 committed Aug 19, 2016
1 parent 3e4481d commit 4e1b0bc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -7,7 +7,7 @@

```groovy
dependencies {
compile 'com.huxq17.xrefreshview:xrefreshview:3.4.0'
compile 'com.huxq17.xrefreshview:xrefreshview:3.5.0'
//依赖下面的库
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
Expand All @@ -34,10 +34,15 @@ dependencies {
还有listview,scrollview,webview等其他的view就不一一截图了。

### 更新日志:<br/>
2016-8-8:
2016-8-19:
1.添加没有数据时显示空布局的支持
2.解决6.0以下的手机,在调用startRefresh()方法后,刷新时headerview有时会不显示的问题
3.其他一些优化
2016-8-8:
1.添加下拉刷新,数据接收失败的ui处理
2.解决下拉刷新,在刷新状态下把headerview完全隐藏掉,在刷新结束以后下拉和上拉都不可用的问题


### 关于我
QQ:1491359569
QQ群:537610843 (加群备注:XRefreshView)
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Expand Up @@ -24,8 +24,8 @@ android {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
// compile 'com.huxq17.xrefreshview:xrefreshview:3.4.0'
// compile project(':library')
compile 'com.huxq17.xrefreshview:xrefreshview:3.5.0'
//依赖下面的库
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Expand Up @@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:onClick="onClick"
android:text="空布局" />
android:text="使用空布局" />

<Button
android:id="@+id/bt_not_full_screen"
Expand Down
2 changes: 1 addition & 1 deletion library/gradle.properties
@@ -1,4 +1,4 @@
VERSION_NAME=3.4.0
VERSION_NAME=3.5.0
GROUP=com.huxq17.xrefreshview
POM_NAME=Android universal pull to refresh library
POM_ARTIFACT_ID=xrefreshview
Expand Down
17 changes: 5 additions & 12 deletions library/src/main/java/com/andview/refreshview/XRefreshView.java
Expand Up @@ -297,8 +297,6 @@ private void getFooterHeight() {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
// int width2 = getDefaultSize(0, widthMeasureSpec);
// int height2 = getDefaultSize(0, heightMeasureSpec);
int childCount = getChildCount();
int finalHeight = 0;
for (int i = 0; i < childCount; i++) {
Expand All @@ -318,7 +316,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
finalHeight += child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
}
}
setMeasuredDimension(width, height);
setMeasuredDimension(width, finalHeight);
getHeaderHeight();
getFooterHeight();
}
Expand Down Expand Up @@ -367,11 +365,8 @@ protected void onLayout(boolean changed, int l, int t2, int r, int b) {
private final CopyOnWriteArrayList<TouchLifeCycle> mTouchLifeCycles = new CopyOnWriteArrayList<>();

interface TouchLifeCycle {
int ACTION_DOWN = 0;
int ACTION_MOVE = 1;
int ACTION_UP = 2;

void onTouch(int action);
void onTouch(MotionEvent event);
}


Expand All @@ -388,10 +383,10 @@ public void removeTouchLifeCycle(TouchLifeCycle lifeCycle) {
}
}

private void updateTouchAction(int action) {
private void updateTouchAction(MotionEvent event) {
for (TouchLifeCycle lifeCycle : mTouchLifeCycles) {
if (lifeCycle != null) {
lifeCycle.onTouch(action);
lifeCycle.onTouch(event);
}
}
}
Expand All @@ -401,17 +396,16 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
final int action = ev.getAction();
int deltaY = 0;
int deltaX = 0;
updateTouchAction(ev);
switch (action) {
case MotionEvent.ACTION_DOWN:
updateTouchAction(TouchLifeCycle.ACTION_DOWN);
mHasSendCancelEvent = false;
mHasSendDownEvent = false;
mLastY = (int) ev.getRawY();
mLastX = (int) ev.getRawX();
mInitialMotionY = mLastY;
break;
case MotionEvent.ACTION_MOVE:
updateTouchAction(TouchLifeCycle.ACTION_MOVE);
mLastMoveEvent = ev;
if (/*!enablePullUp ||*/ mStopingRefresh || !isEnabled() || mIsIntercept) {
return super.dispatchTouchEvent(ev);
Expand Down Expand Up @@ -467,7 +461,6 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
updateTouchAction(TouchLifeCycle.ACTION_UP);
// if (mHolder.mOffsetY != 0 && mRefreshViewListener != null
// && !mPullRefreshing && !mPullLoading) {
// mRefreshViewListener.onRelease(mHolder.mOffsetY);
Expand Down
11 changes: 7 additions & 4 deletions library/src/main/java/com/andview/refreshview/XScrollView.java
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

public class XScrollView extends ScrollView {
Expand Down Expand Up @@ -71,13 +72,15 @@ public void setOnScrollListener(XRefreshView parent, OnScrollListener onScrollLi
this.onScrollListener = onScrollListener;
mParent.addTouchLifeCycle(new XRefreshView.TouchLifeCycle() {
@Override
public void onTouch(int action) {
public void onTouch(MotionEvent event) {
int action = event.getAction();
switch (action) {
case ACTION_DOWN:
case ACTION_MOVE:
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE:
inTouch = true;
break;
case ACTION_UP:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
inTouch = false;
lastT = getScrollY();
removeCallbacks(mRunnable);
Expand Down

0 comments on commit 4e1b0bc

Please sign in to comment.