diff --git a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java
index 21c7f2d..8ff26ad 100644
--- a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java
+++ b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LRecyclerView.java
@@ -14,6 +14,7 @@
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.widget.LinearLayout;
import com.github.jdsjlzx.interfaces.ILoadMoreFooter;
import com.github.jdsjlzx.interfaces.IRefreshHeader;
@@ -126,10 +127,9 @@ private void init() {
}
if (mLoadMoreEnabled) {
- setLoadMoreFooter(new LoadingFooter(getContext().getApplicationContext()));
+ setLoadMoreFooter(new LoadingFooter(getContext().getApplicationContext()),false);
}
-
}
@Override
@@ -407,11 +407,18 @@ public void setRefreshHeader(IRefreshHeader refreshHeader) {
/**
* 设置自定义的footerview
+ * @param loadMoreFooter
+ * @param isCustom 是否自定义footview
*/
- public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter) {
+ public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter, boolean isCustom) {
this.mLoadMoreFooter = loadMoreFooter;
+ if (isCustom) {
+ if (null != mWrapAdapter && mWrapAdapter.getFooterViewsCount() >0) {
+ mWrapAdapter.removeFooterView();
+ }
+ }
mFootView = loadMoreFooter.getFootView();
- mFootView.setVisibility(GONE);
+ mFootView.setVisibility(VISIBLE);
//wxm:mFootView inflate的时候没有以RecyclerView为parent,所以要设置LayoutParams
ViewGroup.LayoutParams layoutParams = mFootView.getLayoutParams();
@@ -420,6 +427,13 @@ public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter) {
} else {
mFootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
+
+ if (isCustom) {
+ if (mLoadMoreEnabled && mWrapAdapter.getFooterViewsCount()==0) {
+ mWrapAdapter.addFooterView(mFootView);
+ }
+ }
+
}
public void setPullRefreshEnabled(boolean enabled) {
diff --git a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerView.java b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerView.java
index c2f90fb..c3fa6ae 100644
--- a/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerView.java
+++ b/LRecyclerview_library/src/main/java/com/github/jdsjlzx/recyclerview/LuRecyclerView.java
@@ -10,6 +10,7 @@
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.util.AttributeSet;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewParent;
import com.github.jdsjlzx.interfaces.ILoadMoreFooter;
@@ -104,10 +105,8 @@ public LuRecyclerView(Context context, AttributeSet attrs, int defStyle) {
private void init() {
if (mLoadMoreEnabled) {
- setLoadMoreFooter(new LoadingFooter(getContext().getApplicationContext()));
+ setLoadMoreFooter(new LoadingFooter(getContext().getApplicationContext()),false);
}
-
-
}
@Override
@@ -252,11 +251,33 @@ public void setNoMore(boolean noMore){
/**
* 设置自定义的footerview
+ * @param loadMoreFooter
+ * @param isCustom 是否自定义footview
*/
- public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter) {
+ public void setLoadMoreFooter(ILoadMoreFooter loadMoreFooter, boolean isCustom) {
this.mLoadMoreFooter = loadMoreFooter;
+ if (isCustom) {
+ if (null != mWrapAdapter && mWrapAdapter.getFooterViewsCount() >0) {
+ mWrapAdapter.removeFooterView();
+ }
+ }
mFootView = loadMoreFooter.getFootView();
- mFootView.setVisibility(GONE);
+ mFootView.setVisibility(VISIBLE);
+
+ //wxm:mFootView inflate的时候没有以RecyclerView为parent,所以要设置LayoutParams
+ ViewGroup.LayoutParams layoutParams = mFootView.getLayoutParams();
+ if (layoutParams != null) {
+ mFootView.setLayoutParams(new LayoutParams(layoutParams));
+ } else {
+ mFootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
+ }
+
+ if (isCustom) {
+ if (mLoadMoreEnabled && mWrapAdapter.getFooterViewsCount()==0) {
+ mWrapAdapter.addFooterView(mFootView);
+ }
+ }
+
}
/**
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9427b55..3e07106 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -56,6 +56,7 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/com/lzx/demo/SplashActivity.java b/app/src/main/java/com/lzx/demo/SplashActivity.java
index d46cbcd..298c680 100644
--- a/app/src/main/java/com/lzx/demo/SplashActivity.java
+++ b/app/src/main/java/com/lzx/demo/SplashActivity.java
@@ -15,6 +15,8 @@
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.TextView;
+import com.lzx.demo.ui.CustomLoadingFootActivity;
+
import static com.lzx.demo.R.id.textView;
public class SplashActivity extends AppCompatActivity implements Runnable {
diff --git a/app/src/main/java/com/lzx/demo/ui/CommonActivity.java b/app/src/main/java/com/lzx/demo/ui/CommonActivity.java
index 7bad4a1..e298690 100644
--- a/app/src/main/java/com/lzx/demo/ui/CommonActivity.java
+++ b/app/src/main/java/com/lzx/demo/ui/CommonActivity.java
@@ -20,7 +20,8 @@ public class CommonActivity extends BaseMainActivity {
AlphaChangeActivity.class,
BannerHeaderLayoutActivity.class,
QzoneHeaderActivity.class,
- MomentsHeaderActivity.class};
+ MomentsHeaderActivity.class,
+ CustomLoadingFootActivity.class};
private static final String[] TITLE = {
"LinearLayoutSample",
@@ -37,7 +38,8 @@ public class CommonActivity extends BaseMainActivity {
"AlphaChangeActivity",
"BannerHeaderLayoutActivity",
"QzoneHeaderActivity",
- "MomentsHeaderActivity"};
+ "MomentsHeaderActivity",
+ "CustomLoadingFootActivity"};
public Class>[] getActivitys() {
return ACTIVITY;
diff --git a/app/src/main/java/com/lzx/demo/ui/CustomLoadingFootActivity.java b/app/src/main/java/com/lzx/demo/ui/CustomLoadingFootActivity.java
new file mode 100644
index 0000000..0ddf45b
--- /dev/null
+++ b/app/src/main/java/com/lzx/demo/ui/CustomLoadingFootActivity.java
@@ -0,0 +1,281 @@
+package com.lzx.demo.ui;
+
+import android.os.Bundle;
+import android.os.Message;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.github.jdsjlzx.ItemDecoration.DividerDecoration;
+import com.github.jdsjlzx.interfaces.OnItemClickListener;
+import com.github.jdsjlzx.interfaces.OnItemLongClickListener;
+import com.github.jdsjlzx.interfaces.OnLoadMoreListener;
+import com.github.jdsjlzx.interfaces.OnNetWorkErrorListener;
+import com.github.jdsjlzx.interfaces.OnRefreshListener;
+import com.github.jdsjlzx.recyclerview.LRecyclerView;
+import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;
+import com.github.jdsjlzx.recyclerview.ProgressStyle;
+import com.github.jdsjlzx.util.WeakHandler;
+import com.lzx.demo.R;
+import com.lzx.demo.adapter.DataAdapter;
+import com.lzx.demo.bean.ItemModel;
+import com.lzx.demo.util.AppToast;
+import com.lzx.demo.util.NetworkUtils;
+import com.lzx.demo.view.CustLoadingFooter;
+
+import java.util.ArrayList;
+
+/**
+ * 自定义footview
+ */
+public class CustomLoadingFootActivity extends AppCompatActivity{
+ private static final String TAG = "lzx";
+
+ /**服务器端一共多少条数据*/
+ private static final int TOTAL_COUNTER = 34;//如果服务器没有返回总数据或者总页数,这里设置为最大值比如10000,什么时候没有数据了根据接口返回判断
+
+ /**每一页展示多少条数据*/
+ private static final int REQUEST_COUNT = 10;
+
+ /**已经获取到多少条数据了*/
+ private static int mCurrentCounter = 0;
+
+ private LRecyclerView mRecyclerView = null;
+
+ private DataAdapter mDataAdapter = null;
+
+
+ private LRecyclerViewAdapter mLRecyclerViewAdapter = null;
+
+ //WeakHandler必须是Activity的一个实例变量.原因详见:http://dk-exp.com/2015/11/11/weak-handler/
+ private WeakHandler mHandler = new WeakHandler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+
+ case -1:
+
+ int currentSize = mDataAdapter.getItemCount();
+
+ //模拟组装10个数据
+ ArrayList newList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ if (newList.size() + currentSize >= TOTAL_COUNTER) {
+ break;
+ }
+
+ ItemModel item = new ItemModel();
+ item.id = currentSize + i;
+ item.title = "item" + (item.id);
+
+ newList.add(item);
+ }
+
+ addItems(newList);
+
+ mRecyclerView.refreshComplete(REQUEST_COUNT);
+
+ break;
+ case -3:
+ mRecyclerView.refreshComplete(REQUEST_COUNT);
+ notifyDataSetChanged();
+ mRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {
+ @Override
+ public void reload() {
+ requestData();
+ }
+ });
+
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.sample_ll_activity);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+
+ mRecyclerView = (LRecyclerView) findViewById(R.id.list);
+
+ mDataAdapter = new DataAdapter(this);
+ mLRecyclerViewAdapter = new LRecyclerViewAdapter(mDataAdapter);
+ mRecyclerView.setAdapter(mLRecyclerViewAdapter);
+
+ DividerDecoration divider = new DividerDecoration.Builder(this)
+ .setHeight(R.dimen.default_divider_height)
+ .setPadding(R.dimen.default_divider_padding)
+ .setColorResource(R.color.split)
+ .build();
+
+ //mRecyclerView.setHasFixedSize(true);
+ mRecyclerView.addItemDecoration(divider);
+
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
+
+ mRecyclerView.setRefreshProgressStyle(ProgressStyle.LineSpinFadeLoader);
+ mRecyclerView.setArrowImageView(R.drawable.ic_pulltorefresh_arrow);
+ mRecyclerView.setLoadingMoreProgressStyle(ProgressStyle.BallSpinFadeLoader);
+
+ //add a HeaderView
+ final View header = LayoutInflater.from(this).inflate(R.layout.sample_header,(ViewGroup)findViewById(android.R.id.content), false);
+ mLRecyclerViewAdapter.addHeaderView(header);
+
+ mRecyclerView.setOnRefreshListener(new OnRefreshListener() {
+ @Override
+ public void onRefresh() {
+
+ mDataAdapter.clear();
+ mLRecyclerViewAdapter.notifyDataSetChanged();//fix bug:crapped or attached views may not be recycled. isScrap:false isAttached:true
+ mCurrentCounter = 0;
+ requestData();
+
+ }
+ });
+
+ //是否禁用自动加载更多功能,false为禁用, 默认开启自动加载更多功能
+ mRecyclerView.setLoadMoreEnabled(true);
+
+ CustLoadingFooter custLoadingFooter = new CustLoadingFooter(this);
+ custLoadingFooter.setProgressStyle(ProgressStyle.SysProgress);
+ mRecyclerView.setLoadMoreFooter(custLoadingFooter,true);
+ notifyDataSetChanged();
+
+ mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {
+ @Override
+ public void onLoadMore() {
+
+ if (mCurrentCounter < TOTAL_COUNTER) {
+ // loading more
+ requestData();
+ } else {
+ //the end
+ mRecyclerView.setNoMore(true);
+ }
+ }
+ });
+
+ mRecyclerView.setLScrollListener(new LRecyclerView.LScrollListener() {
+
+ @Override
+ public void onScrollUp() {
+ }
+
+ @Override
+ public void onScrollDown() {
+ }
+
+
+ @Override
+ public void onScrolled(int distanceX, int distanceY) {
+ }
+
+ @Override
+ public void onScrollStateChanged(int state) {
+
+ }
+
+ });
+
+ //设置头部加载颜色
+ mRecyclerView.setHeaderViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white);
+ //设置底部加载颜色
+ mRecyclerView.setFooterViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white);
+ //设置底部加载文字提示
+ mRecyclerView.setFooterViewHint("拼命加载中","我是有底线的","网络不给力啊,点击再试一次吧");
+
+ mRecyclerView.refresh();
+
+ mLRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(View view, int position) {
+ if (mDataAdapter.getDataList().size() > position) {
+ ItemModel item = mDataAdapter.getDataList().get(position);
+ AppToast.showShortText(getApplicationContext(), item.title);
+ mDataAdapter.remove(position);
+ }
+
+ }
+
+ });
+
+ mLRecyclerViewAdapter.setOnItemLongClickListener(new OnItemLongClickListener() {
+ @Override
+ public void onItemLongClick(View view, int position) {
+ ItemModel item = mDataAdapter.getDataList().get(position);
+ AppToast.showShortText(getApplicationContext(), "onItemLongClick - " + item.title);
+ }
+ });
+
+ }
+
+ private void notifyDataSetChanged() {
+ mLRecyclerViewAdapter.notifyDataSetChanged();
+ }
+
+ private void addItems(ArrayList list) {
+
+ mDataAdapter.addAll(list);
+ mCurrentCounter += list.size();
+
+ }
+
+ /**
+ * 模拟请求网络
+ */
+ private void requestData() {
+ Log.d(TAG, "requestData");
+ new Thread() {
+
+ @Override
+ public void run() {
+ super.run();
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ //模拟一下网络请求失败的情况
+ if(NetworkUtils.isNetAvailable(getApplicationContext())) {
+ mHandler.sendEmptyMessage(-1);
+ } else {
+ mHandler.sendEmptyMessage(-3);
+ }
+ }
+ }.start();
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_main_refresh, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ } else if (item.getItemId() == R.id.menu_refresh) {
+ mRecyclerView.forceToRefresh();
+ }
+ return true;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lzx/demo/view/CustLoadingFooter.java b/app/src/main/java/com/lzx/demo/view/CustLoadingFooter.java
new file mode 100644
index 0000000..e9d48ab
--- /dev/null
+++ b/app/src/main/java/com/lzx/demo/view/CustLoadingFooter.java
@@ -0,0 +1,248 @@
+package com.lzx.demo.view;
+
+import android.content.Context;
+import android.support.v4.content.ContextCompat;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewStub;
+import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.github.jdsjlzx.interfaces.ILoadMoreFooter;
+import com.github.jdsjlzx.progressindicator.AVLoadingIndicatorView;
+import com.github.jdsjlzx.recyclerview.ProgressStyle;
+import com.github.jdsjlzx.view.SimpleViewSwitcher;
+import com.lzx.demo.R;
+
+public class CustLoadingFooter extends RelativeLayout implements ILoadMoreFooter {
+
+ protected State mState = State.Normal;
+ private View mLoadingView;
+ private View mNetworkErrorView;
+ private View mTheEndView;
+ private SimpleViewSwitcher mProgressView;
+ private TextView mLoadingText;
+ private TextView mNoMoreText;
+ private TextView mNoNetWorkText;
+ private String loadingHint;
+ private String noMoreHint;
+ private String noNetWorkHint;
+ private int style;
+ private int indicatorColor;
+ private int hintColor = R.color.colorAccent;
+
+ public CustLoadingFooter(Context context) {
+ super(context);
+ init();
+ }
+
+ public CustLoadingFooter(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public CustLoadingFooter(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ public void init() {
+
+ inflate(getContext(), R.layout.view_cust_recyclerview_footer, this);
+ setOnClickListener(null);
+
+ onReset();//初始为隐藏状态
+
+ indicatorColor = ContextCompat.getColor(getContext(), R.color.colorAccent);
+ style = ProgressStyle.SysProgress;
+ }
+
+ public void setLoadingHint(String hint) {
+ this.loadingHint = hint;
+ }
+
+ public void setNoMoreHint(String hint) {
+ this.noMoreHint = hint;
+ }
+
+ public void setNoNetWorkHint(String hint) {
+ this.noNetWorkHint = hint;
+ }
+
+ public void setIndicatorColor(int color) {
+ this.indicatorColor = color;
+ }
+
+ public void setHintTextColor(int color) {
+ this.hintColor = color;
+ }
+
+ public void setViewBackgroundColor(int color) {
+ this.setBackgroundColor(ContextCompat.getColor(getContext(), color));
+ }
+
+ public void setProgressStyle(int style) {
+ this.style = style;
+ }
+
+ public State getState() {
+ return mState;
+ }
+
+ public void setState(State status) {
+ setState(status, true);
+ }
+
+ private View initIndicatorView(int style) {
+ if (style == ProgressStyle.SysProgress) {
+ return new ProgressBar(getContext(), null, android.R.attr.progressBarStyle);
+ } else {
+ AVLoadingIndicatorView progressView = (AVLoadingIndicatorView) LayoutInflater.from(getContext()).inflate(R.layout.layout_indicator_view, null);
+ progressView.setIndicatorId(style);
+ progressView.setIndicatorColor(indicatorColor);
+ return progressView;
+ }
+
+ }
+
+ @Override
+ public void onReset() {
+ onComplete();
+ }
+
+ @Override
+ public void onLoading() {
+ setState(State.Loading);
+ }
+
+ @Override
+ public void onComplete() {
+ setState(State.Normal);
+ }
+
+ @Override
+ public void onNoMore() {
+ setState(State.NoMore);
+ }
+
+ @Override
+ public View getFootView() {
+ return this;
+ }
+
+ /**
+ * 设置状态
+ *
+ * @param status
+ * @param showView 是否展示当前View
+ */
+ public void setState(State status, boolean showView) {
+ if (mState == status) {
+ return;
+ }
+ mState = status;
+
+ switch (status) {
+ case Normal:
+ setOnClickListener(null);
+ if (mLoadingView != null) {
+ mLoadingView.setVisibility(GONE);
+ }
+
+ if (mTheEndView != null) {
+ mTheEndView.setVisibility(GONE);
+ }
+
+ if (mNetworkErrorView != null) {
+ mNetworkErrorView.setVisibility(GONE);
+ }
+
+ break;
+ case Loading:
+ setOnClickListener(null);
+ if (mTheEndView != null) {
+ mTheEndView.setVisibility(GONE);
+ }
+
+ if (mNetworkErrorView != null) {
+ mNetworkErrorView.setVisibility(GONE);
+ }
+
+ if (mLoadingView == null) {
+ ViewStub viewStub = (ViewStub) findViewById(R.id.loading_viewstub);
+ mLoadingView = viewStub.inflate();
+
+ mProgressView = (SimpleViewSwitcher) mLoadingView.findViewById(R.id.loading_progressbar);
+ mLoadingText = (TextView) mLoadingView.findViewById(R.id.loading_text);
+ }
+
+ mLoadingView.setVisibility(showView ? VISIBLE : GONE);
+
+ mProgressView.setVisibility(View.VISIBLE);
+ mProgressView.removeAllViews();
+ mProgressView.addView(initIndicatorView(style));
+
+ mLoadingText.setText(TextUtils.isEmpty(loadingHint) ? getResources().getString(R.string.list_footer_loading) : loadingHint);
+ mLoadingText.setTextColor(ContextCompat.getColor(getContext(), hintColor));
+
+ break;
+ case NoMore:
+ setOnClickListener(null);
+ if (mLoadingView != null) {
+ mLoadingView.setVisibility(GONE);
+ }
+
+ if (mNetworkErrorView != null) {
+ mNetworkErrorView.setVisibility(GONE);
+ }
+
+ if (mTheEndView == null) {
+ ViewStub viewStub = (ViewStub) findViewById(R.id.end_viewstub);
+ mTheEndView = viewStub.inflate();
+
+ mNoMoreText = (TextView) mTheEndView.findViewById(R.id.loading_end_text);
+ } else {
+ mTheEndView.setVisibility(VISIBLE);
+ }
+
+ mTheEndView.setVisibility(showView ? VISIBLE : GONE);
+ mNoMoreText.setText(TextUtils.isEmpty(noMoreHint) ? getResources().getString(R.string.list_footer_end) : noMoreHint);
+ mNoMoreText.setTextColor(ContextCompat.getColor(getContext(), hintColor));
+ break;
+ case NetWorkError:
+ if (mLoadingView != null) {
+ mLoadingView.setVisibility(GONE);
+ }
+
+ if (mTheEndView != null) {
+ mTheEndView.setVisibility(GONE);
+ }
+
+ if (mNetworkErrorView == null) {
+ ViewStub viewStub = (ViewStub) findViewById(R.id.network_error_viewstub);
+ mNetworkErrorView = viewStub.inflate();
+ mNoNetWorkText = (TextView) mNetworkErrorView.findViewById(R.id.network_error_text);
+ } else {
+ mNetworkErrorView.setVisibility(VISIBLE);
+ }
+
+ mNetworkErrorView.setVisibility(showView ? VISIBLE : GONE);
+ mNoNetWorkText.setText(TextUtils.isEmpty(noNetWorkHint) ? getResources().getString(R.string.list_footer_network_error) : noNetWorkHint);
+ mNoNetWorkText.setTextColor(ContextCompat.getColor(getContext(), hintColor));
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ public enum State {
+ Normal/**正常*/
+ , NoMore/**加载到最底了*/
+ , Loading/**加载中..*/
+ , NetWorkError/**网络异常*/
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_cust_recyclerview_footer.xml b/app/src/main/res/layout/view_cust_recyclerview_footer.xml
new file mode 100644
index 0000000..bc4384f
--- /dev/null
+++ b/app/src/main/res/layout/view_cust_recyclerview_footer.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_recyclerview_footer_loading.xml b/app/src/main/res/layout/view_recyclerview_footer_loading.xml
new file mode 100644
index 0000000..711140f
--- /dev/null
+++ b/app/src/main/res/layout/view_recyclerview_footer_loading.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_recyclerview_footer_network_error.xml b/app/src/main/res/layout/view_recyclerview_footer_network_error.xml
new file mode 100644
index 0000000..481996a
--- /dev/null
+++ b/app/src/main/res/layout/view_recyclerview_footer_network_error.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index d40f22d..8b87be8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,12 +2,14 @@
buildscript {
repositories {
- jcenter()
+ mavenLocal()
google()
+ mavenCentral()
+ jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.1'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
+ classpath 'com.android.tools.build:gradle:3.2.0'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@@ -15,9 +17,11 @@ buildscript {
allprojects {
repositories {
- jcenter()
maven { url "https://jitpack.io" }
+ mavenLocal()
google()
+ mavenCentral()
+ jcenter()
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e0f410c..1cdc439 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Apr 19 13:46:17 GMT+08:00 2018
+#Wed Oct 10 17:33:04 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip