Skip to content

Commit

Permalink
add not loading hint
Browse files Browse the repository at this point in the history
  • Loading branch information
ChadCym committed May 16, 2016
1 parent bc3cd33 commit 84330a9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ public void onLoadMoreRequested() {
@Override
public void run() {
if (mCurrentCounter >= TOTAL_COUNTER) {

mQuickAdapter.notifyDataChangedAfterLoadMore(false);


View view = getLayoutInflater().inflate(R.layout.not_loading, (ViewGroup) mRecyclerView.getParent(), false);
mQuickAdapter.addFooterView(view);
} else {
new Handler().postDelayed(new Runnable() {
@Override
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/res/layout/not_loading.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/loading_view"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_36"
android:gravity="center"
android:orientation="horizontal">


<TextView
android:textColor="@android:color/darker_gray"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="-- end --"/>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ public void add(int position, T item) {
*/
public void setNewData(List<T> data) {
this.mData = data;
if (mRequestLoadMoreListener != null) mNextLoadEnable = true;
if (mRequestLoadMoreListener != null) {
mNextLoadEnable = true;
mFooterView = null;
}
notifyDataSetChanged();
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/main/res/layout/def_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:textColor="@android:color/black"
android:text="正在加载中..."
android:text="@string/loading"
android:textSize="@dimen/sp_14" />
</LinearLayout>
4 changes: 4 additions & 0 deletions library/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<string name="app_name">Library</string>
<string name="loading">Loading...</string>
</resources>
1 change: 1 addition & 0 deletions library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>
<string name="app_name">Library</string>
<string name="loading">正在加载中...</string>
</resources>

0 comments on commit 84330a9

Please sign in to comment.