Skip to content

Commit 477ec31

Browse files
author
王浩
committed
Merge branch 'develop'
2 parents 3d121ba + fc4f356 commit 477ec31

21 files changed

+87
-39
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Change Log
22
==========
33

4+
Version 1.1.0 *(2014-11-18)*
5+
----------------------------
6+
7+
- 解决ListView上拉加载更多视图遮盖最后一个item
8+
49
Version 1.0.9 *(2014-11-15)*
510
----------------------------
611

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
88
开发者使用BGARefreshLayout-Android可以对各种控件实现多种下拉刷新效果、上拉加载更多以及配置自定义头部广告位
99

10+
[测试BGARefreshLayout与Activity、Fragment、ViewPager的各种嵌套的Demo](https://github.com/bingoogolapple/BGARefreshLayoutDemo)
11+
1012
### 目前已经实现了四种下拉刷新效果:
1113

1214
* 新浪微博下拉刷新风格(可设置各种状态是的文本,可设置整个刷新头部的背景)

demo/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ android {
1313
}
1414

1515
dependencies {
16-
compile 'com.android.support:appcompat-v7:23.1.0'
17-
compile 'com.android.support:design:23.1.0'
16+
compile 'com.android.support:appcompat-v7:23.1.1'
17+
compile 'com.android.support:design:23.1.1'
1818

1919
// 以下三个库是必须依赖的
20-
compile 'com.android.support:recyclerview-v7:23.1.0'
20+
compile 'com.android.support:recyclerview-v7:23.1.1'
2121
compile 'com.nineoldandroids:library:2.4.0'
22-
compile 'cn.bingoogolapple:bga-refreshlayout:1.0.9@aar'
22+
compile 'cn.bingoogolapple:bga-refreshlayout:1.1.0@aar'
2323
// compile project(':library')
2424

2525

@@ -28,7 +28,7 @@ dependencies {
2828
compile 'cn.bingoogolapple:bga-adapter:1.0.7@aar'
2929
compile 'cn.bingoogolapple:bga-swipeitemlayout:1.0.3@aar'
3030
compile 'cn.bingoogolapple:bga-indicator:1.0.0@aar'
31-
compile 'com.android.support:cardview-v7:23.1.0'
31+
compile 'com.android.support:cardview-v7:23.1.1'
3232
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
3333
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
3434
compile 'cn.pedant.sweetalert:library:1.3'

demo/src/main/java/cn/bingoogolapple/refreshlayout/demo/ui/activity/NormalListViewActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
136136
showToast("没有更多数据了");
137137
return false;
138138
}
139+
139140
mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
140141
@Override
141142
public void onResponse(Response<List<RefreshModel>> response, Retrofit retrofit) {

demo/src/main/java/cn/bingoogolapple/refreshlayout/demo/ui/fragment/RefreshListViewFragment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected void initView(Bundle savedInstanceState) {
4747
protected void setListener() {
4848
mRefreshLayout.setDelegate(this);
4949
// 设置正在加载更多时不显示加载更多控件
50-
mRefreshLayout.setIsShowLoadingMoreView(false);
50+
// mRefreshLayout.setIsShowLoadingMoreView(false);
5151

5252
mDataLv.setOnItemClickListener(this);
5353
mDataLv.setOnItemLongClickListener(this);
@@ -134,6 +134,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
134134
showToast("没有更多数据了");
135135
return false;
136136
}
137+
showLoadingDialog();
137138
mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
138139
@Override
139140
public void onResponse(final Response<List<RefreshModel>> response, Retrofit retrofit) {
@@ -142,6 +143,7 @@ public void onResponse(final Response<List<RefreshModel>> response, Retrofit ret
142143
@Override
143144
public void run() {
144145
mRefreshLayout.endLoadingMore();
146+
dismissLoadingDialog();
145147
mAdapter.addMoreDatas(response.body());
146148
}
147149
}, MainActivity.LOADING_DURATION);

demo/src/main/java/cn/bingoogolapple/refreshlayout/demo/ui/fragment/StickyNavListViewFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
134134
showToast("没有更多数据了");
135135
return false;
136136
}
137+
showLoadingDialog();
137138
mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
138139
@Override
139140
public void onResponse(final Response<List<RefreshModel>> response, Retrofit retrofit) {

demo/src/main/res/layout/activity_listview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
android:layout_marginTop="@dimen/test_padding_margin"
6666
android:background="@android:color/white"
6767
android:divider="@mipmap/list_divider"
68+
android:overScrollMode="never"
6869
android:paddingBottom="@dimen/test_padding_margin"
6970
android:paddingTop="@dimen/test_padding_margin"
7071
android:scrollbars="none"

demo/src/main/res/layout/activity_recyclerview.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools"
32
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
44
android:id="@+id/refreshLayout"
55
style="@style/MatchMatch"
66
android:paddingBottom="@dimen/test_padding_margin"
@@ -63,6 +63,7 @@
6363
android:layout_marginBottom="@dimen/test_padding_margin"
6464
android:layout_marginTop="@dimen/test_padding_margin"
6565
android:background="@android:color/white"
66+
android:overScrollMode="never"
6667
android:paddingBottom="@dimen/test_padding_margin"
6768
android:paddingTop="@dimen/test_padding_margin"
6869
android:scrollbars="none"

demo/src/main/res/layout/activity_scrollview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
android:layout_marginBottom="@dimen/test_padding_margin"
6464
android:layout_marginTop="@dimen/test_padding_margin"
6565
android:background="@color/test_spacing3"
66+
android:overScrollMode="never"
6667
android:paddingBottom="@dimen/test_padding_margin"
6768
android:paddingTop="@dimen/test_padding_margin"
6869
android:scrollbars="none">

demo/src/main/res/layout/fragment_gridview_refresh.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
android:id="@+id/lv_gridview_data"
2727
style="@style/MatchAuto"
2828
android:numColumns="2"
29+
android:overScrollMode="never"
2930
android:scrollbars="none" />
3031
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
3132
</LinearLayout>

demo/src/main/res/layout/fragment_listview_refresh.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
android:id="@+id/lv_listview_data"
88
style="@style/MatchAuto"
99
android:divider="@mipmap/list_divider"
10+
android:overScrollMode="never"
1011
android:padding="5dp"
1112
android:scrollbars="none" />
1213
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>

demo/src/main/res/layout/fragment_listview_sticky_nav.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
android:layout_marginTop="@dimen/test_padding_margin"
77
android:background="@android:color/white"
88
android:divider="@mipmap/list_divider"
9+
android:overScrollMode="never"
910
android:paddingBottom="@dimen/test_padding_margin"
1011
android:paddingTop="@dimen/test_padding_margin"
1112
android:scrollbars="none"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<cn.bingoogolapple.refreshlayout.BGARefreshLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
android:id="@+id/rl_recyclerview_refresh"
54
style="@style/MatchMatch">
65

@@ -9,6 +8,7 @@
98
android:layout_width="match_parent"
109
android:layout_height="0dp"
1110
android:layout_weight="1"
11+
android:overScrollMode="never"
1212
android:padding="5dp"
1313
android:scrollbars="none" />
1414
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>

demo/src/main/res/layout/fragment_recyclerview_sticky_nav.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
android:layout_marginBottom="@dimen/test_padding_margin"
66
android:layout_marginTop="@dimen/test_padding_margin"
77
android:background="@android:color/white"
8+
android:overScrollMode="never"
89
android:paddingBottom="@dimen/test_padding_margin"
910
android:paddingTop="@dimen/test_padding_margin"
1011
android:scrollbars="none"

demo/src/main/res/layout/fragment_scrollview_refresh.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<ScrollView
77
style="@style/MatchAuto"
8+
android:overScrollMode="never"
89
android:padding="5dp"
910
android:scrollbars="none">
1011

demo/src/main/res/layout/fragment_scrollview_sticky_nav.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<ScrollView
2-
xmlns:android="http://schemas.android.com/apk/res/android"
1+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
32
xmlns:app="http://schemas.android.com/apk/res-auto"
43
style="@style/MatchMatch"
54
android:layout_marginBottom="@dimen/test_padding_margin"
65
android:layout_marginTop="@dimen/test_padding_margin"
76
android:background="@color/test_spacing3"
7+
android:overScrollMode="never"
88
android:paddingBottom="@dimen/test_padding_margin"
99
android:paddingTop="@dimen/test_padding_margin"
1010
android:scrollbars="none">

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ ANDROID_BUILD_TARGET_SDK_VERSION=23
33
ANDROID_BUILD_SDK_VERSION=23
44
ANDROID_BUILD_TOOLS_VERSION=23.0.1
55

6-
VERSION_NAME=1.0.9
7-
VERSION_CODE=109
6+
VERSION_NAME=1.1.0
7+
VERSION_CODE=110

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
}
1212

1313
dependencies {
14-
compile 'com.android.support:recyclerview-v7:23.1.0'
14+
compile 'com.android.support:recyclerview-v7:23.1.1'
1515
compile 'com.nineoldandroids:library:2.4.0'
1616
}
1717

library/src/main/java/cn/bingoogolapple/refreshlayout/BGARefreshLayout.java

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun
315315
}
316316

317317
public boolean shouldHandleAbsListViewLoadingMore(AbsListView absListView) {
318-
if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
318+
if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
319319
return false;
320320
}
321321

@@ -790,24 +790,11 @@ private void showLoadingMoreView() {
790790
mRefreshViewHolder.changeToLoadingMore();
791791
mLoadMoreFooterView.setVisibility(VISIBLE);
792792

793-
if (mScrollView != null) {
794-
new Handler().post(new Runnable() {
795-
@Override
796-
public void run() {
797-
mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
798-
}
799-
});
800-
}
801-
if (mRecyclerView != null) {
802-
RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
803-
if (mRecyclerView.getAdapter() != null && mRecyclerView.getAdapter().getItemCount() > 0) {
804-
layoutManager.scrollToPosition(mRecyclerView.getAdapter().getItemCount() - 1);
805-
}
806-
}
807-
if (mAbsListView != null) {
808-
if (mAbsListView.getAdapter() != null && mAbsListView.getAdapter().getCount() > 0) {
809-
mAbsListView.scrollBy(0, mLoadMoreFooterViewHeight);
810-
}
793+
ScrollingUtil.scrollToBottom(mScrollView);
794+
ScrollingUtil.scrollToBottom(mRecyclerView);
795+
ScrollingUtil.scrollToBottom(mAbsListView);
796+
if (mStickyNavLayout != null) {
797+
mStickyNavLayout.scrollToBottom();
811798
}
812799
}
813800

@@ -831,12 +818,6 @@ public void run() {
831818
mIsLoadingMore = false;
832819
mRefreshViewHolder.onEndLoadingMore();
833820
mLoadMoreFooterView.setVisibility(GONE);
834-
835-
if (mAbsListView != null) {
836-
if (mAbsListView.getAdapter() != null && mAbsListView.getAdapter().getCount() > 0) {
837-
mAbsListView.scrollBy(0, -mLoadMoreFooterViewHeight);
838-
}
839-
}
840821
}
841822
};
842823

library/src/main/java/cn/bingoogolapple/refreshlayout/BGAStickyNavLayout.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,4 +490,19 @@ public boolean shouldHandleLoadingMore() {
490490

491491
return false;
492492
}
493+
494+
public void scrollToBottom() {
495+
ScrollingUtil.scrollToBottom(mDirectScrollView);
496+
ScrollingUtil.scrollToBottom(mDirectRecyclerView);
497+
ScrollingUtil.scrollToBottom(mDirectAbsListView);
498+
499+
if (mDirectViewPager != null) {
500+
if (mNestedContentView == null) {
501+
regetNestedContentView();
502+
}
503+
ScrollingUtil.scrollToBottom(mNestedScrollView);
504+
ScrollingUtil.scrollToBottom(mNestedRecyclerView);
505+
ScrollingUtil.scrollToBottom(mNestedAbsListView);
506+
}
507+
}
493508
}

library/src/main/java/cn/bingoogolapple/refreshlayout/util/ScrollingUtil.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,37 @@ public static boolean isScrollViewToBottom(ScrollView scrollView) {
9393
}
9494
return false;
9595
}
96+
97+
public static void scrollToBottom(final ScrollView scrollView) {
98+
if (scrollView != null) {
99+
scrollView.post(new Runnable() {
100+
@Override
101+
public void run() {
102+
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
103+
}
104+
});
105+
}
106+
}
107+
108+
public static void scrollToBottom(final AbsListView absListView) {
109+
if (absListView != null) {
110+
if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
111+
absListView.post(new Runnable() {
112+
@Override
113+
public void run() {
114+
absListView.setSelection(absListView.getAdapter().getCount() - 1);
115+
}
116+
});
117+
}
118+
}
119+
}
120+
121+
public static void scrollToBottom(RecyclerView recyclerView) {
122+
if (recyclerView != null) {
123+
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
124+
if (recyclerView.getAdapter() != null && recyclerView.getAdapter().getItemCount() > 0) {
125+
layoutManager.scrollToPosition(recyclerView.getAdapter().getItemCount() - 1);
126+
}
127+
}
128+
}
96129
}

0 commit comments

Comments
 (0)