Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomolong authored and xiaomolong committed Jun 15, 2016
2 parents 0d12ec6 + 90291ab commit 77abf42
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 70 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.wuxiaolong.pullloadmorerecyclerview;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
Expand All @@ -11,6 +13,7 @@
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
Expand All @@ -20,6 +23,7 @@
* github:https://github.com/WuXiaolong/PullLoadMoreRecyclerView
* weibo:http://weibo.com/u/2175011601
*/
@SuppressWarnings("unused")
public class PullLoadMoreRecyclerView extends LinearLayout {
private RecyclerView mRecyclerView;
private SwipeRefreshLayout mSwipeRefreshLayout;
Expand Down Expand Up @@ -65,6 +69,7 @@ private void initView(Context context) {
mEmptyViewContainer = (FrameLayout) view.findViewById(R.id.emptyView);

loadMoreText = (TextView) view.findViewById(R.id.loadMoreText);

mFooterView.setVisibility(View.GONE);
mEmptyViewContainer.setVisibility(View.GONE);

Expand Down Expand Up @@ -198,11 +203,7 @@ protected void onDetachedFromWindow() {
public class onTouchRecyclerView implements OnTouchListener {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (isRefresh || isLoadMore) {
return true;
} else {
return false;
}
return isRefresh || isLoadMore;
}
}

Expand Down Expand Up @@ -259,7 +260,12 @@ public void refresh() {

public void loadMore() {
if (mPullLoadMoreListener != null && hasMore) {
mFooterView.setVisibility(View.VISIBLE);
mFooterView.animate().translationY(0).setDuration(300).setInterpolator(new AccelerateDecelerateInterpolator()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mFooterView.setVisibility(View.VISIBLE);
}
}).start();
invalidate();
mPullLoadMoreListener.onLoadMore();

Expand All @@ -269,10 +275,10 @@ public void loadMore() {

public void setPullLoadMoreCompleted() {
isRefresh = false;
mSwipeRefreshLayout.setRefreshing(false);
setRefreshing(false);

isLoadMore = false;
mFooterView.setVisibility(View.GONE);
mFooterView.animate().translationY(mFooterView.getHeight()).setDuration(300).setInterpolator(new AccelerateDecelerateInterpolator()).start();

}

Expand Down
37 changes: 16 additions & 21 deletions library/src/main/res/layout/footer_layout.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center"
android:background="#cfff"
android:orientation="horizontal">

<LinearLayout
android:layout_width="match_parent"
<ProgressBar
android:id="@+id/loadMoreProgressBar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
android:layout_marginRight="10dp" />

<ProgressBar
android:id="@+id/loadMoreProgressBar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp" />

<TextView
android:id="@+id/loadMoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="@string/load_more_text" />
</LinearLayout>
<TextView
android:id="@+id/loadMoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="@string/load_more_text" />
</LinearLayout>
10 changes: 6 additions & 4 deletions library/src/main/res/layout/pull_loadmore_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
tools:ignore="ResourceName">


<LinearLayout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
android:layout_height="match_parent" />

<include
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/footerView"
layout="@layout/footer_layout" />

Expand All @@ -27,5 +29,5 @@
layout="@layout/empty_layout"/>


</LinearLayout>
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>

0 comments on commit 77abf42

Please sign in to comment.