Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
王浩 committed Nov 17, 2015
2 parents 3d121ba + fc4f356 commit 477ec31
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

Version 1.1.0 *(2014-11-18)*
----------------------------

- 解决ListView上拉加载更多视图遮盖最后一个item

Version 1.0.9 *(2014-11-15)*
----------------------------

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
开发者使用BGARefreshLayout-Android可以对各种控件实现多种下拉刷新效果、上拉加载更多以及配置自定义头部广告位

[测试BGARefreshLayout与Activity、Fragment、ViewPager的各种嵌套的Demo](https://github.com/bingoogolapple/BGARefreshLayoutDemo)

### 目前已经实现了四种下拉刷新效果:

* 新浪微博下拉刷新风格(可设置各种状态是的文本,可设置整个刷新头部的背景)
Expand Down
10 changes: 5 additions & 5 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'

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


Expand All @@ -28,7 +28,7 @@ dependencies {
compile 'cn.bingoogolapple:bga-adapter:1.0.7@aar'
compile 'cn.bingoogolapple:bga-swipeitemlayout:1.0.3@aar'
compile 'cn.bingoogolapple:bga-indicator:1.0.0@aar'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'cn.pedant.sweetalert:library:1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
showToast("没有更多数据了");
return false;
}

mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
@Override
public void onResponse(Response<List<RefreshModel>> response, Retrofit retrofit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void initView(Bundle savedInstanceState) {
protected void setListener() {
mRefreshLayout.setDelegate(this);
// 设置正在加载更多时不显示加载更多控件
mRefreshLayout.setIsShowLoadingMoreView(false);
// mRefreshLayout.setIsShowLoadingMoreView(false);

mDataLv.setOnItemClickListener(this);
mDataLv.setOnItemLongClickListener(this);
Expand Down Expand Up @@ -134,6 +134,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
showToast("没有更多数据了");
return false;
}
showLoadingDialog();
mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
@Override
public void onResponse(final Response<List<RefreshModel>> response, Retrofit retrofit) {
Expand All @@ -142,6 +143,7 @@ public void onResponse(final Response<List<RefreshModel>> response, Retrofit ret
@Override
public void run() {
mRefreshLayout.endLoadingMore();
dismissLoadingDialog();
mAdapter.addMoreDatas(response.body());
}
}, MainActivity.LOADING_DURATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout
showToast("没有更多数据了");
return false;
}
showLoadingDialog();
mEngine.loadMoreData(mMorePageNumber).enqueue(new Callback<List<RefreshModel>>() {
@Override
public void onResponse(final Response<List<RefreshModel>> response, Retrofit retrofit) {
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/res/layout/activity_listview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@android:color/white"
android:divider="@mipmap/list_divider"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none"
Expand Down
3 changes: 2 additions & 1 deletion demo/src/main/res/layout/activity_recyclerview.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/refreshLayout"
style="@style/MatchMatch"
android:paddingBottom="@dimen/test_padding_margin"
Expand Down Expand Up @@ -63,6 +63,7 @@
android:layout_marginBottom="@dimen/test_padding_margin"
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@android:color/white"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none"
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/res/layout/activity_scrollview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
android:layout_marginBottom="@dimen/test_padding_margin"
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@color/test_spacing3"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none">
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/res/layout/fragment_gridview_refresh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
android:id="@+id/lv_gridview_data"
style="@style/MatchAuto"
android:numColumns="2"
android:overScrollMode="never"
android:scrollbars="none" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
</LinearLayout>
1 change: 1 addition & 0 deletions demo/src/main/res/layout/fragment_listview_refresh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
android:id="@+id/lv_listview_data"
style="@style/MatchAuto"
android:divider="@mipmap/list_divider"
android:overScrollMode="never"
android:padding="5dp"
android:scrollbars="none" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
1 change: 1 addition & 0 deletions demo/src/main/res/layout/fragment_listview_sticky_nav.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@android:color/white"
android:divider="@mipmap/list_divider"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none"
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/res/layout/fragment_recyclerview_refresh.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<cn.bingoogolapple.refreshlayout.BGARefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_recyclerview_refresh"
style="@style/MatchMatch">

Expand All @@ -9,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:overScrollMode="never"
android:padding="5dp"
android:scrollbars="none" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:layout_marginBottom="@dimen/test_padding_margin"
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@android:color/white"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none"
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/res/layout/fragment_scrollview_refresh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<ScrollView
style="@style/MatchAuto"
android:overScrollMode="never"
android:padding="5dp"
android:scrollbars="none">

Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/res/layout/fragment_scrollview_sticky_nav.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/MatchMatch"
android:layout_marginBottom="@dimen/test_padding_margin"
android:layout_marginTop="@dimen/test_padding_margin"
android:background="@color/test_spacing3"
android:overScrollMode="never"
android:paddingBottom="@dimen/test_padding_margin"
android:paddingTop="@dimen/test_padding_margin"
android:scrollbars="none">
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ ANDROID_BUILD_TARGET_SDK_VERSION=23
ANDROID_BUILD_SDK_VERSION=23
ANDROID_BUILD_TOOLS_VERSION=23.0.1

VERSION_NAME=1.0.9
VERSION_CODE=109
VERSION_NAME=1.1.0
VERSION_CODE=110
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
}

dependencies {
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun
}

public boolean shouldHandleAbsListViewLoadingMore(AbsListView absListView) {
if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
if (mIsLoadingMore || mCurrentRefreshStatus == RefreshStatus.REFRESHING || mLoadMoreFooterView == null || mDelegate == null || absListView == null || absListView.getAdapter() == null || absListView.getAdapter().getCount() == 0) {
return false;
}

Expand Down Expand Up @@ -790,24 +790,11 @@ private void showLoadingMoreView() {
mRefreshViewHolder.changeToLoadingMore();
mLoadMoreFooterView.setVisibility(VISIBLE);

if (mScrollView != null) {
new Handler().post(new Runnable() {
@Override
public void run() {
mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
if (mRecyclerView != null) {
RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
if (mRecyclerView.getAdapter() != null && mRecyclerView.getAdapter().getItemCount() > 0) {
layoutManager.scrollToPosition(mRecyclerView.getAdapter().getItemCount() - 1);
}
}
if (mAbsListView != null) {
if (mAbsListView.getAdapter() != null && mAbsListView.getAdapter().getCount() > 0) {
mAbsListView.scrollBy(0, mLoadMoreFooterViewHeight);
}
ScrollingUtil.scrollToBottom(mScrollView);
ScrollingUtil.scrollToBottom(mRecyclerView);
ScrollingUtil.scrollToBottom(mAbsListView);
if (mStickyNavLayout != null) {
mStickyNavLayout.scrollToBottom();
}
}

Expand All @@ -831,12 +818,6 @@ public void run() {
mIsLoadingMore = false;
mRefreshViewHolder.onEndLoadingMore();
mLoadMoreFooterView.setVisibility(GONE);

if (mAbsListView != null) {
if (mAbsListView.getAdapter() != null && mAbsListView.getAdapter().getCount() > 0) {
mAbsListView.scrollBy(0, -mLoadMoreFooterViewHeight);
}
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,19 @@ public boolean shouldHandleLoadingMore() {

return false;
}

public void scrollToBottom() {
ScrollingUtil.scrollToBottom(mDirectScrollView);
ScrollingUtil.scrollToBottom(mDirectRecyclerView);
ScrollingUtil.scrollToBottom(mDirectAbsListView);

if (mDirectViewPager != null) {
if (mNestedContentView == null) {
regetNestedContentView();
}
ScrollingUtil.scrollToBottom(mNestedScrollView);
ScrollingUtil.scrollToBottom(mNestedRecyclerView);
ScrollingUtil.scrollToBottom(mNestedAbsListView);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,37 @@ public static boolean isScrollViewToBottom(ScrollView scrollView) {
}
return false;
}

public static void scrollToBottom(final ScrollView scrollView) {
if (scrollView != null) {
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
}

public static void scrollToBottom(final AbsListView absListView) {
if (absListView != null) {
if (absListView.getAdapter() != null && absListView.getAdapter().getCount() > 0) {
absListView.post(new Runnable() {
@Override
public void run() {
absListView.setSelection(absListView.getAdapter().getCount() - 1);
}
});
}
}
}

public static void scrollToBottom(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (recyclerView.getAdapter() != null && recyclerView.getAdapter().getItemCount() > 0) {
layoutManager.scrollToPosition(recyclerView.getAdapter().getItemCount() - 1);
}
}
}
}

0 comments on commit 477ec31

Please sign in to comment.