From 36999858649c051155376562ea449cb292dc6406 Mon Sep 17 00:00:00 2001 From: jjhesk Date: Thu, 28 Apr 2016 10:15:20 +0800 Subject: [PATCH 1/5] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 0aabc38d..ceb514be 100644 --- a/README.md +++ b/README.md @@ -96,17 +96,13 @@ If you have some good ideas, please tell us. My email is cymcsg # gmail.com.And ![grid_layout](http://i.giphy.com/UKxCkkUHVH8Fq.gif) ![admob](http://i.giphy.com/bExwitMhjtUqI.gif) ![expandable](http://i.giphy.com/pLWHKsEdVlsKA.gif) +![node](http://i.giphy.com/Xjf7Y8pZ84OxW.gif) ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview11.gif) - ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview12.gif) - ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview7.gif) - ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/f4794974d8de71ab1d0f0efddda556df7e792df2/ultimaterecyclerview/ultimate_recyclerview3.gif) - ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview8.gif) - ![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview9.gif) From 6f2922b5fd12ab5ac9cea62b933a111fe194f1c4 Mon Sep 17 00:00:00 2001 From: jjhesk Date: Thu, 28 Apr 2016 10:28:35 +0800 Subject: [PATCH 2/5] Delete README.md --- README.md | 143 ------------------------------------------------------ 1 file changed, 143 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index ceb514be..00000000 --- a/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# UltimateRecyclerView - -[![Download](https://api.bintray.com/packages/jjhesk/maven/MenuURV/images/download.svg) ](https://bintray.com/jjhesk/maven/MenuURV/_latestVersion)[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)[![Stories in Ready](https://badge.waffle.io/cymcsg/UltimateRecyclerView.svg?label=ready&title=Ready)](http://waffle.io/cymcsg/UltimateRecyclerView) - - -[![Throughput Graph](https://graphs.waffle.io/cymcsg/UltimateRecyclerView/throughput.svg)](https://waffle.io/cymcsg/UltimateRecyclerView/metrics) - -#### Master branch:[![Build Status](https://travis-ci.org/cymcsg/UltimateRecyclerView.svg?branch=master)](https://travis-ci.org/cymcsg/UltimateRecyclerView) - -#### Dev branch:[![Build Status](https://travis-ci.org/cymcsg/UltimateRecyclerView.svg?branch=dev)](https://travis-ci.org/cymcsg/UltimateRecyclerView) - - -##### Project website:[https://github.com/cymcsg/UltimateRecyclerView](https://github.com/cymcsg/UltimateRecyclerView) - - -### Quick Setup(Basic Usage) - -###### 1.Integration jcenter - -Please follow the latest publishing aar on jcenter. - -follow by the gradle code -```gradle -repositories { - jcenter() - maven { url "http://dl.bintray.com/jjhesk/maven" } - } - -dependencies{ - compile 'com.hkm.ui:ultimaterecyclerview:0.5.0' -} -``` - -###### 2.Usage: - -``` xml - -``` - -### Version Log -* ***v0.5.0*** this library will be based on v23.2.1 from now on. if you need have the v23.1.1 please go back to the previous release. detail of this upgrade please see [#342](https://github.com/cymcsg/UltimateRecyclerView/issues/342) -* ***v0.4.9*** This is the last version that will be based on V23.1.1. and this library will not be supported on this version. For further supports please refer to the latest release. -* ***v0.3.11*** There are still version that is based on 22.+ - -### Description - -UltimateRecyclerView is a RecyclerView(advanced and flexible version of ListView) with pulling to refresh, loading more, swiping to dismiss, draging and drop, animations ,sticky header,show or hide toolbar and FAB when scrolling and many other features.You can use it ```just like RecyclerView```. - -Notice that UltimateRecyclerView is a project under development. - -[Your donations is highly appreciated. Thank you!](#donations) - -### Features: - -* Swipe to refresh(using android.support.v4.widget.SwipeRefreshLayout) -* Many kinds of animations -* Swipe to dismiss -* Parallax or normal head view -* Drag and drop items -* Loading more when reach the last item(infinite scrolling) -* Custom views in loading more -* Showing or hiding toolbar and floating button when scrolling -* Scrollbars -* Colorful styles of ``swipe to refresh`` -* Sticky header like instagram -* Support different layout in adapter -* Loading adapter with animation - -### Upcoming features: -* Refer to discussion for headers [#299](https://github.com/cymcsg/UltimateRecyclerView/issues/299) -* Refer to discussion for the loading more [#276](https://github.com/cymcsg/UltimateRecyclerView/issues/276) -* Swipe issue and discussion [#296](https://github.com/cymcsg/UltimateRecyclerView/issues/296) -* Wishlist for [UltiamteRecyclerview 0.4.2](UpcomingChanges.md) -* and more. - -> Notice that it might not be the latest version - -### Demo App / Sample Code: -* Due to rapid updates and developments we have decided to host the demo APK on github -* Check out this link for [latest demonstration for the code](https://github.com/cymcsg/UltimateRecyclerView/releases) -* Video demo for [grid layout demo](https://www.youtube.com/watch?v=iTnIf-N8m1Y) -* or you can check it out already compiled at [Google Play](https://play.google.com/store/apps/details?id=com.marshalchen.ultimaterecyclerview.demo) -* You can clone the project and compile it yourself (it includes a sample), or you can check it out already compiled at Google Play -* You can read more usage in [wiki](https://github.com/cymcsg/UltimateRecyclerView/wiki) and welcome to make your own tutorials in here. - -#### Welcome to fork and PR (pull request) -If you have some good ideas, please tell us. My email is cymcsg # gmail.com.And it is a good idea to put your idea on the issue. If you want to use a rapid development framework for developing apps, you can try [UltimateAndroid Framework](https://github.com/cymcsg/UltimateAndroid). - -### Screenshot - -![grid_layout](http://i.giphy.com/UVKEWEGu64z60.gif) -![grid_layout](http://i.giphy.com/UKxCkkUHVH8Fq.gif) -![admob](http://i.giphy.com/bExwitMhjtUqI.gif) -![expandable](http://i.giphy.com/pLWHKsEdVlsKA.gif) -![node](http://i.giphy.com/Xjf7Y8pZ84OxW.gif) - -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview11.gif) -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview12.gif) -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview7.gif) -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/f4794974d8de71ab1d0f0efddda556df7e792df2/ultimaterecyclerview/ultimate_recyclerview3.gif) -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview8.gif) -![ultimate_recyclerview](https://bytebucket.org/marshalchen/images/raw/44beb162121c719ea4094bd7ea1c9f0cd7de4c04/ultimaterecyclerview/ultimate_recyclerview9.gif) - - -### Thanks -* Use animators from [recyclerview-animators](https://github.com/wasabeef/recyclerview-animators) -* Deal with different types of LayoutManager from[SuperRecyclerView](https://github.com/Malinskiy/SuperRecyclerView) -* Divider of recyclerview[RecyclerView-FlexibleDivider](https://github.com/yqritc/RecyclerView-FlexibleDivider) -* Parallax header of the recyclerview[android-parallax-recyclerview](https://github.com/kanytu/android-parallax-recyclerview) -* Floating action button [FloatingActionButton](https://github.com/futuresimple/android-floating-action-button) -* Colorful pull to refresh [Ultra Pull To Refresh](https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh) -* Sticky section headers in RecyclerView [StickHeader](https://github.com/eowise/recyclerview-stickyheaders) -* Swipe[AndroidSwipeLayout](https://github.com/daimajia/AndroidSwipeLayout) -* Thanks [jjhesk](https://github.com/jjhesk) for doing so many work on the project - -If there are someone who I do not mention here,please accept my sincerely appologies and tell me. - -

Donations:

-Donate $9.99: [![$9.99](https://bytebucket.org/marshalchen/images/raw/9c442645492ddc10474416debf511a57a0367397/others/donate.jpg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5GYRYZVNAK2G2) - -Alipay:![donate](https://bytebucket.org/marshalchen/images/raw/9c442645492ddc10474416debf511a57a0367397/others/alipay.png) - -## License - -``` -Copyright 2015 MarsellChan - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` From de712ba99e19e85c08d598001400eca3f79c48fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E5=A4=96=E6=A1=83=E6=BA=90?= Date: Fri, 29 Apr 2016 19:06:02 +0800 Subject: [PATCH 3/5] update version --- UltimateRecyclerView/ultimaterecyclerview/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltimateRecyclerView/ultimaterecyclerview/gradle.properties b/UltimateRecyclerView/ultimaterecyclerview/gradle.properties index bad11b80..b46d8c9f 100644 --- a/UltimateRecyclerView/ultimaterecyclerview/gradle.properties +++ b/UltimateRecyclerView/ultimaterecyclerview/gradle.properties @@ -1,8 +1,8 @@ POM_NAME=ultimaterecyclerview POM_ARTIFACT_ID=library POM_PACKAGING=aar -VERSION_NAME=0.5.5 -VERSION_CODE=66 +VERSION_NAME=0.5.6 +VERSION_CODE=67 GROUP=com.marshalchen.ultimaterecyclerview POM_DESCRIPTION=A RecyclerView(advanced and flexible version of ListView) with refreshing,loading more,animation and many other features. POM_URL=https://github.com/cymcsg/UltimateRecyclerView From fa2cea11483bf6f539b4fd44637c2019a6fe7cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E5=A4=96=E6=A1=83=E6=BA=90?= Date: Mon, 23 May 2016 11:39:10 +0800 Subject: [PATCH 4/5] bug hunting for the #363, #374 --- UltimateRecyclerView/app/build.gradle | 5 + UltimateRecyclerView/app/proguard-rules.pro | 22 +- .../app/src/main/AndroidManifest.xml | 5 +- .../demo/MainActivity.java | 369 ------------------ .../ultimaterecyclerview/demo/MainList.java | 84 ++++ .../admobdemo/TestAdMobClassicActivity.java | 5 +- .../admobdemo/TestAdvancedAdmobActivity.java | 4 +- .../demo/dragdemo/DragActivity.java | 4 - .../demo/expandemo/TestExpandableRV.java | 2 +- .../demo/griddemo/GridLayoutRVTest.java | 14 +- .../demo/griddemo/GridTestOnlyOnePage.java | 27 ++ .../demo/modules/MainWatcher.java | 5 +- .../multiitemdemo/MultiViewTypesActivity.java | 2 +- .../src/main/res/layout/activity_loadmore.xml | 2 +- .../app/src/main/res/layout/activity_main.xml | 21 +- .../res/layout/custom_bottom_progressbar.xml | 7 +- .../app/src/main/res/layout/grid_item.xml | 6 +- .../app/src/main/res/menu/admenu.xml | 4 + .../app/src/main/res/values/strings.xml | 1 + UltimateRecyclerView/build.gradle | 23 +- UltimateRecyclerView/gradle.properties | 8 +- .../UltimateRecyclerView.java | 13 - 22 files changed, 184 insertions(+), 449 deletions(-) delete mode 100644 UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainActivity.java create mode 100644 UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainList.java create mode 100644 UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java create mode 100644 UltimateRecyclerView/app/src/main/res/menu/admenu.xml diff --git a/UltimateRecyclerView/app/build.gradle b/UltimateRecyclerView/app/build.gradle index c4191f17..4c462414 100644 --- a/UltimateRecyclerView/app/build.gradle +++ b/UltimateRecyclerView/app/build.gradle @@ -35,6 +35,11 @@ dependencies { compile supportDependencies.cv + debugCompile supportDependencies.leakcanary + releaseCompile supportDependencies.leakcanarynoop + testCompile supportDependencies.leakcanarynoop + + compile project(':ultimaterecyclerview') // compile 'com.marshalchen.ultimaterecyclerview:library:0.4.0' compile 'com.google.android.gms:play-services:7.3.0' diff --git a/UltimateRecyclerView/app/proguard-rules.pro b/UltimateRecyclerView/app/proguard-rules.pro index 9efd57af..0ce23854 100644 --- a/UltimateRecyclerView/app/proguard-rules.pro +++ b/UltimateRecyclerView/app/proguard-rules.pro @@ -1,17 +1,7 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Volumes/MAC3/adt/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} +#-dontwarn com.squareup.haha.guava.** +#-dontwarn com.squareup.haha.perflib.** +#-dontwarn com.squareup.haha.trove.** +-dontwarn com.squareup.leakcanary.** +#-keep class com.squareup.haha.** { *; } +-keep class com.squareup.leakcanary.** { *; } \ No newline at end of file diff --git a/UltimateRecyclerView/app/src/main/AndroidManifest.xml b/UltimateRecyclerView/app/src/main/AndroidManifest.xml index f10e3174..55e9216f 100644 --- a/UltimateRecyclerView/app/src/main/AndroidManifest.xml +++ b/UltimateRecyclerView/app/src/main/AndroidManifest.xml @@ -18,7 +18,7 @@ android:theme="@style/AppTheme" tools:replace="android:icon,android:theme"> @@ -33,6 +33,9 @@ + diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainActivity.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainActivity.java deleted file mode 100644 index 212e5114..00000000 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainActivity.java +++ /dev/null @@ -1,369 +0,0 @@ -package com.marshalchen.ultimaterecyclerview.demo; - -import android.graphics.Color; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.os.Handler; -import android.support.v4.widget.SwipeRefreshLayout; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; -import android.support.v7.widget.helper.ItemTouchHelper; -import android.view.ActionMode; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.marshalchen.ultimaterecyclerview.URLogs; -import com.marshalchen.ultimaterecyclerview.ObservableScrollState; -import com.marshalchen.ultimaterecyclerview.ObservableScrollViewCallbacks; -import com.marshalchen.ultimaterecyclerview.UltimateRecyclerView; -import com.marshalchen.ultimaterecyclerview.demo.rvComponents.sectionCommonAdapter; -import com.marshalchen.ultimaterecyclerview.demo.rvComponents.sectionZeroAdapter; -import com.marshalchen.ultimaterecyclerview.demo.modules.FastBinding; -import com.marshalchen.ultimaterecyclerview.itemTouchHelper.SimpleItemTouchHelperCallback; -import com.marshalchen.ultimaterecyclerview.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration; - -import java.util.ArrayList; -import java.util.List; - - -public class MainActivity extends AppCompatActivity implements ActionMode.Callback { - - UltimateRecyclerView ultimateRecyclerView; - sectionCommonAdapter RVAdapter = null; - LinearLayoutManager linearLayoutManager; - int moreNum = 2; - private ActionMode actionMode; - - Toolbar toolbar; - boolean isDrag = true; - - private ItemTouchHelper mItemTouchHelper; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - toolbar = (Toolbar) findViewById(R.id.tool_bar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayShowTitleEnabled(false); - - - ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view); - ultimateRecyclerView.setHasFixedSize(false); - final List stringList = new ArrayList<>(); - - stringList.add("E19"); - stringList.add("P32"); - stringList.add("G22"); - stringList.add("B33"); - stringList.add("T44"); - stringList.add("R55"); - stringList.add("B66"); - stringList.add("Q17"); - - RVAdapter = new sectionCommonAdapter(stringList); - - linearLayoutManager = new LinearLayoutManager(this); - ultimateRecyclerView.setLayoutManager(linearLayoutManager); - - - - // ultimateRecyclerView.setEmptyView(getResources().getIdentifier("empty_view","layout",getPackageName())); - // ultimateRecyclerView.showEmptyView(); - enableLoadMore(); - // enableHeader(); - // enableParalax(); - ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ffffff")); - enableRefreshGoogleMaterialStyle(); - - ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(RVAdapter); - - mItemTouchHelper = new ItemTouchHelper(callback); - mItemTouchHelper.attachToRecyclerView(ultimateRecyclerView.mRecyclerView); - RVAdapter.setOnDragStartListener(new sectionZeroAdapter.OnStartDragListener() { - @Override - public void onStartDrag(RecyclerView.ViewHolder viewHolder) { - mItemTouchHelper.startDrag(viewHolder); - } - }); - - ultimateRecyclerView.setScrollViewCallbacks(new ObservableScrollViewCallbacks() { - @Override - public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { - - } - - @Override - public void onDownMotionEvent() { - - } - - @Override - public void onUpOrCancelMotionEvent(ObservableScrollState observableScrollState) { -// if (observableScrollState == ObservableScrollState.DOWN) { -// ultimateRecyclerView.showToolbar(toolbar, ultimateRecyclerView, getScreenHeight()); -// ultimateRecyclerView.showFloatingActionMenu(); -// } else if (observableScrollState == ObservableScrollState.UP) { -// ultimateRecyclerView.hideToolbar(toolbar, ultimateRecyclerView, getScreenHeight()); -// ultimateRecyclerView.hideFloatingActionMenu(); -// } else if (observableScrollState == ObservableScrollState.STOP) { -// } - URLogs.d("onUpOrCancelMotionEvent"); - if (observableScrollState == ObservableScrollState.UP) { - ultimateRecyclerView.hideToolbar(toolbar, ultimateRecyclerView, getScreenHeight()); - ultimateRecyclerView.hideFloatingActionMenu(); - } else if (observableScrollState == ObservableScrollState.DOWN) { - ultimateRecyclerView.showToolbar(toolbar, ultimateRecyclerView, getScreenHeight()); - ultimateRecyclerView.showFloatingActionMenu(); - } - } - }); - - ultimateRecyclerView.showFloatingButtonView(); -// ultimateRecyclerView.addOnItemTouchListener(new SwipeableRecyclerViewTouchListener(ultimateRecyclerView.mRecyclerView, -// new SwipeableRecyclerViewTouchListener.SwipeListener() { -// @Override -// public boolean canSwipe(int position) { -// -// if (position > 0 && position < stringList.size()) -// return true; -// else return false; -// } -// -// @Override -// public void onDismissedBySwipeLeft(RecyclerView recyclerView, int[] reverseSortedPositions) { -// for (int position : reverseSortedPositions) { -// RVAdapter.remove(position); -// } -// RVAdapter.notifyDataSetChanged(); -// } -// -// @Override -// public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) { -// for (int position : reverseSortedPositions) { -// RVAdapter.remove(position); -// } -// RVAdapter.notifyDataSetChanged(); -// } -// })); - /* - - - Spinner spinner = (Spinner) findViewById(R.id.spinner); - ArrayAdapter spinnerAdapter = - new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); - for (Type type : Type.values()) { - spinnerAdapter.add(type.name()); - } - spinner.setAdapter(spinnerAdapter); - spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - ultimateRecyclerView.setItemAnimator(Type.values()[position].getAnimator()); - ultimateRecyclerView.getItemAnimator().setAddDuration(300); - ultimateRecyclerView.getItemAnimator().setRemoveDuration(300); - } - - @Override - public void onNothingSelected(AdapterView parent) { - - } - }); - - - */ - - ultimateRecyclerView.setAdapter(RVAdapter); - findViewById(R.id.add).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - RVAdapter.insertLast("newly added item"); - } - }); - - findViewById(R.id.del).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - RVAdapter.removeLast(); - } - }); - -// ultimateRecyclerView.addItemDecoration( -// new HorizontalDividerItemDecoration.Builder(this).build()); - -// ultimateRecyclerView.setCustomSwipeToRefresh(); -// final StoreHouseHeader header = new StoreHouseHeader(this); -// // header.setPadding(0, 15, 0, 0); -// -// header.initWithString("Marshal Chen"); -// // header.initWithStringArray(R.array.akta); -// ultimateRecyclerView.mPtrFrameLayout.setHeaderView(header); -// ultimateRecyclerView.mPtrFrameLayout.addPtrUIHandler(header); -// -// ultimateRecyclerView.mPtrFrameLayout.setPtrHandler(new PtrHandler() { -// @Override -// public boolean checkCanDoRefresh(PtrFrameLayout ptrFrameLayout, View view, View view2) { -// boolean canbePullDown = PtrDefaultHandler.checkContentCanBePulledDown(ptrFrameLayout, view, view2); -// return canbePullDown; -// } -// -// @Override -// public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) { -// ptrFrameLayout.postDelayed(new Runnable() { -// @Override -// public void run() { -// RVAdapter.insert("Refresh things", 0); -// // ultimateRecyclerView.scrollBy(0, -50); -// linearLayoutManager.scrollToPosition(0); -// ultimateRecyclerView.mPtrFrameLayout.refreshComplete(); -// } -// }, 1800); -// } -// }); - - } - - - - private void enableHeader() { - StickyRecyclerHeadersDecoration headersDecor = new StickyRecyclerHeadersDecoration(RVAdapter); - ultimateRecyclerView.addItemDecoration(headersDecor); - // ultimateRecyclerView.setParallaxHeader(getLayoutInflater().inflate(R.layout.parallax_recyclerview_header, ultimateRecyclerView.mRecyclerView, false)); - ultimateRecyclerView.setNormalHeader(getLayoutInflater().inflate(R.layout.parallax_recyclerview_header, ultimateRecyclerView.mRecyclerView, false)); - - } - - private void enableParalax() { - ultimateRecyclerView.setOnParallaxScroll(new UltimateRecyclerView.OnParallaxScroll() { - @Override - public void onParallaxScroll(float percentage, float offset, View parallax) { - Drawable c = toolbar.getBackground(); - c.setAlpha(Math.round(127 + percentage * 128)); - toolbar.setBackgroundDrawable(c); - } - }); - } - - private void enableLoadMore() { - ultimateRecyclerView.setLoadMoreView(R.layout.custom_bottom_progressbar); - ultimateRecyclerView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() { - @Override - public void loadMore(int itemsCount, final int maxLastVisiblePosition) { - Handler handler = new Handler(); - handler.postDelayed(new Runnable() { - public void run() { - RVAdapter.insertLast("more" + moreNum++); - RVAdapter.insertLast("more" + moreNum++); - RVAdapter.insertLast("more" + moreNum++); - } - }, 1000); - } - }); - } - - private void enableRefreshGoogleMaterialStyle() { - ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { - @Override - public void onRefresh() { - new Handler().postDelayed(new Runnable() { - @Override - public void run() { - moreNum++; - RVAdapter.insertLast(moreNum + " Refresh things"); - ultimateRecyclerView.setRefreshing(false); - // ultimateRecyclerView.scrollBy(0, -50); - linearLayoutManager.scrollToPosition(0); - // ultimateRecyclerView.setAdapter(RVAdapter); - // RVAdapter.notifyDataSetChanged(); - } - }, 1000); - } - }); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ultimateRecyclerView.setDefaultSwipeToRefreshColorScheme( - getColor(android.R.color.holo_orange_light), - getColor(android.R.color.holo_orange_dark), - getColor(android.R.color.holo_red_dark), - getColor(android.R.color.holo_red_light)); - } else { - ultimateRecyclerView.setDefaultSwipeToRefreshColorScheme( - getResources().getColor(android.R.color.holo_orange_light), - getResources().getColor(android.R.color.holo_orange_dark), - getResources().getColor(android.R.color.holo_red_dark), - getResources().getColor(android.R.color.holo_red_light)); - } - } - - private void toggleSelection(int position) { - RVAdapter.toggleSelection(position); - actionMode.setTitle("Selected " + "1"); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - - } - - public int getScreenHeight() { - return findViewById(android.R.id.content).getHeight(); - } - - @Override - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - URLogs.d("actionmode---" + (mode == null)); - mode.getMenuInflater().inflate(R.menu.menu_main, menu); - return true; - // return false; - } - - /** - * Called to refresh an action mode's action menu whenever it is invalidated. - * - * @param mode ActionMode being prepared - * @param menu Menu used to populate action buttons - * @return true if the menu or action mode was updated, false otherwise. - */ - @Override - public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - // swipeToDismissTouchListener.setEnabled(false); - this.actionMode = mode; - return false; - } - - - @Override - public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - return false; - } - - - @Override - public void onDestroyActionMode(ActionMode mode) { - this.actionMode = null; - } - - - // - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.menu_main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - FastBinding.startactivity(this, item.getItemId()); - return super.onOptionsItemSelected(item); - } - -} diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainList.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainList.java new file mode 100644 index 00000000..1aa62d5a --- /dev/null +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/MainList.java @@ -0,0 +1,84 @@ +package com.marshalchen.ultimaterecyclerview.demo; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import com.marshalchen.ultimaterecyclerview.demo.admobdemo.TestAdMobClassicActivity; +import com.marshalchen.ultimaterecyclerview.demo.admobdemo.TestAdvancedAdmobActivity; +import com.marshalchen.ultimaterecyclerview.demo.dragdemo.DragActivity; +import com.marshalchen.ultimaterecyclerview.demo.expandemo.TestExpandableRV; +import com.marshalchen.ultimaterecyclerview.demo.griddemo.GridLayoutRVTest; +import com.marshalchen.ultimaterecyclerview.demo.griddemo.GridTestOnlyOnePage; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.DebugLoadMoreActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.DebugNoHeaderLoadMoreActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.FinalEmptyViewDisplayActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.FirstPageCancelLoadMore; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.LineNodeActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.PullToRefreshActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.SliderHeader; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.StaggerLoadMoreActivity; +import com.marshalchen.ultimaterecyclerview.demo.loadmoredemo.SwipeListViewExampleActivity; +import com.marshalchen.ultimaterecyclerview.demo.multiitemdemo.MultiViewTypesActivity; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Created by hesk on 23/5/16. + */ +public class MainList extends AppCompatActivity implements AdapterView.OnItemClickListener { + ListView mList; + LinkedHashMap data = new LinkedHashMap<>(); + ArrayList o = new ArrayList<>(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + mList = (ListView) findViewById(android.R.id.list); + ArrayList items = new ArrayList<>(); + initList(); + for (Map.Entry entry : data.entrySet()) { + String key = entry.getKey(); + items.add(key); + o.add(entry.getValue()); + } + mList.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items)); + mList.setOnItemClickListener(this); + } + + public void initList() { + + data.put("Debug Grid Test", GridLayoutRVTest.class); + data.put("Issue #374, #363 enabled and disable load more off screen", GridTestOnlyOnePage.class); + data.put("Debug load more", DebugLoadMoreActivity.class); + data.put("Debug no header", DebugNoHeaderLoadMoreActivity.class); + data.put("Debug Final Empty", FinalEmptyViewDisplayActivity.class); + data.put("Debug First Page Cancel Load More", FirstPageCancelLoadMore.class); + data.put("Debug Line Node", LineNodeActivity.class); + data.put("Debug Pull to refresh", PullToRefreshActivity.class); + data.put("Debug Admob classic", TestAdMobClassicActivity.class); + data.put("Debug Admob advanced", TestAdvancedAdmobActivity.class); + data.put("Debug Slider Header", SliderHeader.class); + data.put("Debug Stagger Load More", StaggerLoadMoreActivity.class); + data.put("Debug Swipe List", SwipeListViewExampleActivity.class); + data.put("Debug expandable", TestExpandableRV.class); + data.put("Debug dragging", DragActivity.class); + data.put("Debug multi view types", MultiViewTypesActivity.class); + } + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent = new Intent(this, o.get(position)); + startActivity(intent); + } + + +} diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdMobClassicActivity.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdMobClassicActivity.java index b9d7b13e..2a4ee4ba 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdMobClassicActivity.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdMobClassicActivity.java @@ -42,7 +42,7 @@ public class TestAdMobClassicActivity extends AppCompatActivity { private AdView createadmob() { AdView mAdView = new AdView(this); mAdView.setAdSize(AdSize.MEDIUM_RECTANGLE); - mAdView.setAdUnitId("/1015938/Hypebeast_App_320x50"); + mAdView.setAdUnitId("ca-app-pub-3940256099942544/6300978111"); mAdView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // Create an ad request. AdRequest.Builder adRequestBuilder = new AdRequest.Builder(); @@ -130,7 +130,7 @@ public void onClick(View v) { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(R.layout.activity_loadmore); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); @@ -171,7 +171,6 @@ public int getScreenHeight() { return findViewById(android.R.id.content).getHeight(); } - // @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdvancedAdmobActivity.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdvancedAdmobActivity.java index eefdd14d..980e90f9 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdvancedAdmobActivity.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/admobdemo/TestAdvancedAdmobActivity.java @@ -130,7 +130,7 @@ private RelativeLayout createadmob() { adSize = AdSize.MEDIUM_RECTANGLE; final AdView mAdView = new AdView(this); mAdView.setAdSize(adSize); - mAdView.setAdUnitId("/1015938/Hypebeast_App_320x50"); + mAdView.setAdUnitId("ca-app-pub-3940256099942544/6300978111"); // Create an ad request. AdRequest.Builder adRequestBuilder = new AdRequest.Builder(); if (admob_test_mode) @@ -177,7 +177,7 @@ private BiAdAdapterSwitcher imple_switch_view(final UltimateRecyclerView rv) { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(R.layout.activity_loadmore); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/dragdemo/DragActivity.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/dragdemo/DragActivity.java index b74a6f5f..dc09ac9c 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/dragdemo/DragActivity.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/dragdemo/DragActivity.java @@ -7,10 +7,6 @@ import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.Spinner; import com.marshalchen.ultimaterecyclerview.demo.R; import com.marshalchen.ultimaterecyclerview.demo.modules.FastBinding; diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/expandemo/TestExpandableRV.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/expandemo/TestExpandableRV.java index 18a7468b..a9981de1 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/expandemo/TestExpandableRV.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/expandemo/TestExpandableRV.java @@ -69,7 +69,7 @@ private void addExpandableFeatures() { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(R.layout.activity_loadmore); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java index 3e0d248a..5854e837 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java @@ -26,8 +26,8 @@ * Created by hesk on 24/8/15. */ public class GridLayoutRVTest extends AppCompatActivity { - private UltimateRecyclerView listuv; - private GridJRAdapter mGridAdapter = null; + protected UltimateRecyclerView listuv; + protected GridJRAdapter mGridAdapter = null; private BasicGridLayoutManager mGridLayoutManager; private int moreNum = 2, columns = 2; private ActionMode actionMode; @@ -56,8 +56,7 @@ protected void onCreate(Bundle savedInstanceState) { listuv.setHasFixedSize(true); listuv.setSaveEnabled(true); listuv.setClipToPadding(false); - listuv.setAdapter(mGridAdapter); - listuv.setItemAnimator(new DefaultItemAnimator()); + // mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null)); listuv.setNormalHeader(setupHeaderView()); @@ -80,7 +79,10 @@ public void run() { // listuv.enableLoadmore(); // listuv.disableLoadmore(); listuv.setLoadMoreView(R.layout.custom_bottom_progressbar); - harn_controls(); + listuv.setAdapter(mGridAdapter); + listuv.setItemAnimator(new DefaultItemAnimator()); + + harness_control(); } private List getJRList() { @@ -107,7 +109,7 @@ private View setupHeaderView() { return custom_header; } - private void harn_controls() { + private void harness_control() { findViewById(R.id.add).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java new file mode 100644 index 00000000..18d8f4c0 --- /dev/null +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java @@ -0,0 +1,27 @@ +package com.marshalchen.ultimaterecyclerview.demo.griddemo; + +import android.os.Bundle; +import android.os.Handler; + +import com.marshalchen.ultimaterecyclerview.demo.modules.SampleDataboxset; + +/** + * This is the fix the off screen detection issue + * Created by hesk on 23/5/16. + */ +public class GridTestOnlyOnePage extends GridLayoutRVTest { + + Handler poster = new Handler(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + poster.postDelayed(new Runnable() { + @Override + public void run() { + mGridAdapter.insert(SampleDataboxset.genJRList(5)); + listuv.disableLoadmore(); + } + }, 1000); + } +} diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/modules/MainWatcher.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/modules/MainWatcher.java index 48f9df8f..94602ccb 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/modules/MainWatcher.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/modules/MainWatcher.java @@ -9,8 +9,9 @@ * Created by hesk on 2/10/15. */ public class MainWatcher extends Application { - @Override public void onCreate() { + @Override + public void onCreate() { super.onCreate(); - CrashWoodpecker.fly().to(this); + //CrashWoodpecker.fly().to(this); } } diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/multiitemdemo/MultiViewTypesActivity.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/multiitemdemo/MultiViewTypesActivity.java index a8031ad5..6dd4a495 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/multiitemdemo/MultiViewTypesActivity.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/multiitemdemo/MultiViewTypesActivity.java @@ -34,7 +34,7 @@ public class MultiViewTypesActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(R.layout.activity_loadmore); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); diff --git a/UltimateRecyclerView/app/src/main/res/layout/activity_loadmore.xml b/UltimateRecyclerView/app/src/main/res/layout/activity_loadmore.xml index 96c2b014..5ab79acd 100644 --- a/UltimateRecyclerView/app/src/main/res/layout/activity_loadmore.xml +++ b/UltimateRecyclerView/app/src/main/res/layout/activity_loadmore.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context=".MainActivity"> + tools:context=".loadmoredemo.BasicFunctions"> + tools:context=".MainList"> - - + --> + + - \ No newline at end of file diff --git a/UltimateRecyclerView/app/src/main/res/layout/custom_bottom_progressbar.xml b/UltimateRecyclerView/app/src/main/res/layout/custom_bottom_progressbar.xml index 7545412a..eddb0a9c 100644 --- a/UltimateRecyclerView/app/src/main/res/layout/custom_bottom_progressbar.xml +++ b/UltimateRecyclerView/app/src/main/res/layout/custom_bottom_progressbar.xml @@ -1,20 +1,19 @@ + android:layout_height="wrap_content"> + android:text="Loading" /> \ No newline at end of file diff --git a/UltimateRecyclerView/app/src/main/res/layout/grid_item.xml b/UltimateRecyclerView/app/src/main/res/layout/grid_item.xml index aab38837..12804353 100644 --- a/UltimateRecyclerView/app/src/main/res/layout/grid_item.xml +++ b/UltimateRecyclerView/app/src/main/res/layout/grid_item.xml @@ -1,8 +1,8 @@ + android:id="@+id/planview" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + + \ No newline at end of file diff --git a/UltimateRecyclerView/app/src/main/res/values/strings.xml b/UltimateRecyclerView/app/src/main/res/values/strings.xml index 9b0e0e2c..eae6eacd 100644 --- a/UltimateRecyclerView/app/src/main/res/values/strings.xml +++ b/UltimateRecyclerView/app/src/main/res/values/strings.xml @@ -4,5 +4,6 @@ UltimateRecyclerView Hello world! Settings + https://github.com/cymcsg/UltimateRecyclerView diff --git a/UltimateRecyclerView/build.gradle b/UltimateRecyclerView/build.gradle index 26bbe59b..33e3b3bb 100644 --- a/UltimateRecyclerView/build.gradle +++ b/UltimateRecyclerView/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { // - @ https://oss.sonatype.org/ - classpath 'com.android.tools.build:gradle:2.0.0' + classpath 'com.android.tools.build:gradle:2.1.0' // - tutorials @https://github.com/novoda/bintray-release classpath 'com.novoda:bintray-release:0.3.4' } @@ -40,13 +40,20 @@ ext { //Support Libraries dependencies supportDependencies = [ - percent : "com.android.support:percent:${SUPPORT_LIBRARY}", - annotation: "com.android.support:support-annotations:${SUPPORT_LIBRARY}", - support : "com.android.support:support-v13:${SUPPORT_LIBRARY}", - appCompat : "com.android.support:appcompat-v7:${SUPPORT_LIBRARY}", - rv : "com.android.support:recyclerview-v7:${SUPPORT_LIBRARY}", - cv : "com.android.support:cardview-v7:${SUPPORT_LIBRARY}", - kitCore : "com.52inc:52Kit-core:${ftKit}" + percent : "com.android.support:percent:${SUPPORT_LIBRARY}", + annotation : "com.android.support:support-annotations:${SUPPORT_LIBRARY}", + support : "com.android.support:support-v13:${SUPPORT_LIBRARY}", + appCompat : "com.android.support:appcompat-v7:${SUPPORT_LIBRARY}", + rv : "com.android.support:recyclerview-v7:${SUPPORT_LIBRARY}", + cv : "com.android.support:cardview-v7:${SUPPORT_LIBRARY}", + kitCore : "com.52inc:52Kit-core:${ftKit}", + + + + leakcanary : "com.squareup.leakcanary:leakcanary-android:${LEAKCANARY}", + leakcanarynoop: "com.squareup.leakcanary:leakcanary-android-no-op:${LEAKCANARY}", + + ] IS_UPLOADING = project.getGradle().startParameter.taskNames.any { it.contains('bintrayUpload') } diff --git a/UltimateRecyclerView/gradle.properties b/UltimateRecyclerView/gradle.properties index 41e57290..55e65dd7 100644 --- a/UltimateRecyclerView/gradle.properties +++ b/UltimateRecyclerView/gradle.properties @@ -1,5 +1,9 @@ -SUPPORT_LIBRARY=23.3.0 +SUPPORT_LIBRARY=23.4.0 ANDROID_BUILD_MIN_SDK_VERSION=13 ANDROID_BUILD_TARGET_SDK_VERSION=23 ANDROID_BUILD_SDK_VERSION=23 -ANDROID_BUILD_TOOLS_VERSION=23.0.3 \ No newline at end of file +ANDROID_BUILD_TOOLS_VERSION=23.0.3 + +#version check on @link https://github.com/square/leakcanary +LEAKCANARY=1.4-beta2 + diff --git a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java index 57e152ee..65789b9a 100644 --- a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java +++ b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java @@ -594,19 +594,6 @@ protected void enableShoworHideToolbarAndFloatingButton(RecyclerView recyclerVie mPrevFirstVisiblePosition = firstVisiblePosition; mCallbacks.onScrollChanged(mScrollY, mFirstScroll, mDragging); -// if (mFirstScroll) { -// mFirstScroll = false; -// } - -// if (mPrevScrollY < mScrollY) { -// //down -// mObservableScrollState = ObservableScrollState.UP; -// } else if (mScrollY < mPrevScrollY) { -// //up -// mObservableScrollState = ObservableScrollState.DOWN; -// } else { -// mObservableScrollState = ObservableScrollState.STOP; -// } if (mPrevScrollY < mScrollY) { //down From 5e5499d94c197ac6ca4fcbdd4d5bddcca3874b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E5=A4=96=E6=A1=83=E6=BA=90?= Date: Mon, 23 May 2016 14:11:32 +0800 Subject: [PATCH 5/5] dev fix loading more for five or less items. display and remove loader animations. --- UltimateRecyclerView/app/build.gradle | 7 ++-- .../demo/griddemo/GridLayoutRVTest.java | 12 ++++--- .../demo/griddemo/GridTestOnlyOnePage.java | 7 +++- .../ultimaterecyclerview/gradle.properties | 4 +-- .../UltimateRecyclerView.java | 32 +++++++++++-------- .../UltimateViewAdapter.java | 13 ++++++-- 6 files changed, 47 insertions(+), 28 deletions(-) diff --git a/UltimateRecyclerView/app/build.gradle b/UltimateRecyclerView/app/build.gradle index 4c462414..aaa8fd37 100644 --- a/UltimateRecyclerView/app/build.gradle +++ b/UltimateRecyclerView/app/build.gradle @@ -34,20 +34,17 @@ dependencies { compile supportDependencies.annotation compile supportDependencies.cv - debugCompile supportDependencies.leakcanary releaseCompile supportDependencies.leakcanarynoop testCompile supportDependencies.leakcanarynoop - - compile project(':ultimaterecyclerview') - // compile 'com.marshalchen.ultimaterecyclerview:library:0.4.0' + // compile 'com.marshalchen.ultimaterecyclerview:library:0.4.0' compile 'com.google.android.gms:play-services:7.3.0' debugCompile 'me.drakeet.library:crashwoodpecker:0.9.7' releaseCompile 'me.drakeet.library:crashwoodpecker-do-nothing:0.9.7' compile 'com.hkm.loyalslider:library:1.6.2' - + compile project(':ultimaterecyclerview') //used in the gridlayout // compile 'com.hkm.loyalslider:library:1.4.5' exclude group: 'android.support.v13' diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java index 5854e837..7b2ae7b6 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridLayoutRVTest.java @@ -68,9 +68,8 @@ public void loadMore(int itemsCount, int maxLastVisiblePosition) { f.postDelayed(new Runnable() { @Override public void run() { - mGridAdapter.insert(SampleDataboxset.genJRList(13)); - // listuv.disableLoadmore(); - // listuv.disableLoadmore(); + mGridAdapter.insert(SampleDataboxset.genJRList(5)); + afterAdd(); } }, 2000); } @@ -79,12 +78,17 @@ public void run() { // listuv.enableLoadmore(); // listuv.disableLoadmore(); listuv.setLoadMoreView(R.layout.custom_bottom_progressbar); + listuv.setAdapter(mGridAdapter); listuv.setItemAnimator(new DefaultItemAnimator()); harness_control(); } + protected void afterAdd() { + + } + private List getJRList() { List team = new ArrayList<>(); //you can make your own test for starting-zero-data @@ -140,7 +144,7 @@ public void onClick(View v) { findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - // mGridAdapter.notifyDataSetChanged(); + listuv.reenableLoadmore(); } }); diff --git a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java index 18d8f4c0..9de851a7 100644 --- a/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java +++ b/UltimateRecyclerView/app/src/main/java/com/marshalchen/ultimaterecyclerview/demo/griddemo/GridTestOnlyOnePage.java @@ -19,9 +19,14 @@ protected void onCreate(Bundle savedInstanceState) { poster.postDelayed(new Runnable() { @Override public void run() { + listuv.reenableLoadmore(); mGridAdapter.insert(SampleDataboxset.genJRList(5)); - listuv.disableLoadmore(); } }, 1000); } + + @Override + protected void afterAdd() { + listuv.disableLoadmore(); + } } diff --git a/UltimateRecyclerView/ultimaterecyclerview/gradle.properties b/UltimateRecyclerView/ultimaterecyclerview/gradle.properties index b46d8c9f..b84e8fff 100644 --- a/UltimateRecyclerView/ultimaterecyclerview/gradle.properties +++ b/UltimateRecyclerView/ultimaterecyclerview/gradle.properties @@ -1,8 +1,8 @@ POM_NAME=ultimaterecyclerview POM_ARTIFACT_ID=library POM_PACKAGING=aar -VERSION_NAME=0.5.6 -VERSION_CODE=67 +VERSION_NAME=0.5.8 +VERSION_CODE=70 GROUP=com.marshalchen.ultimaterecyclerview POM_DESCRIPTION=A RecyclerView(advanced and flexible version of ListView) with refreshing,loading more,animation and many other features. POM_URL=https://github.com/cymcsg/UltimateRecyclerView diff --git a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java index 65789b9a..5307c822 100644 --- a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java +++ b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java @@ -80,7 +80,7 @@ public class UltimateRecyclerView extends FrameLayout implements Scrollable { private int lastVisibleItemPosition; protected RecyclerView.OnScrollListener mOnScrollListener; protected LAYOUT_MANAGER_TYPE layoutManagerType; - private boolean isLoadingMore = false; + private boolean automaticLoadMoreEnabled = false; protected int mPadding; protected int mPaddingTop; protected int mPaddingBottom; @@ -104,7 +104,7 @@ public class UltimateRecyclerView extends FrameLayout implements Scrollable { private boolean mFirstScroll; private boolean mDragging; private boolean mIntercepted; - private boolean mIsLoadMoreWidgetEnabled; + private boolean mIsLoadMoreWidgetEnabled = false; private MotionEvent mPrevMoveEvent; private ViewGroup mTouchInterceptionViewGroup; /** @@ -459,21 +459,27 @@ private void scroll_load_more_detection(RecyclerView recyclerView) { break; } - if (isLoadingMore) { - //todo: there are some bugs needs to be adjusted for admob adapter + if (automaticLoadMoreEnabled) { + if (mTotalItemCount > previousTotal) { - isLoadingMore = false; + automaticLoadMoreEnabled = false; previousTotal = mTotalItemCount; } } boolean bottomEdgeHit = (mTotalItemCount - mVisibleItemCount) <= mFirstVisibleItem; - if (!isLoadingMore && bottomEdgeHit) { - onLoadMoreListener.loadMore(mRecyclerView.getAdapter().getItemCount(), lastVisibleItemPosition); - isLoadingMore = true; + + if (bottomEdgeHit) { + if (mIsLoadMoreWidgetEnabled) { + /**auto activate load more**/ + if (!automaticLoadMoreEnabled) { + onLoadMoreListener.loadMore(mRecyclerView.getAdapter().getItemCount(), lastVisibleItemPosition); + automaticLoadMoreEnabled = true; + } + } + mAdapter.internalExecuteLoadingView(); previousTotal = mTotalItemCount; } - } protected void setDefaultScrollListener() { @@ -488,9 +494,9 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (isParallaxHeader) translateHeader(mTotalYScrolled); } - if (mIsLoadMoreWidgetEnabled) { - scroll_load_more_detection(recyclerView); - } + + scroll_load_more_detection(recyclerView); + enableShoworHideToolbarAndFloatingButton(recyclerView); } }; @@ -839,7 +845,7 @@ public void onChanged() { private void updateHelperDisplays() { - isLoadingMore = false; + automaticLoadMoreEnabled = false; if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(false); if (mAdapter == null) diff --git a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateViewAdapter.java b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateViewAdapter.java index 1293ae05..a249256a 100644 --- a/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateViewAdapter.java +++ b/UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateViewAdapter.java @@ -120,8 +120,14 @@ public void run() { */ public final void enableLoadMore(final boolean b) { cbloadmore = new delayenableloadmore(b); - timer.postDelayed(cbloadmore, 1000); - loadmoresetingswatch++; + } + + public final void internalExecuteLoadingView() { + if (cbloadmore != null) { + timer.post(cbloadmore); + loadmoresetingswatch++; + cbloadmore = null; + } } /** @@ -170,7 +176,8 @@ public VH onCreateViewHolder(ViewGroup parent, int viewType) { customLoadMoreItemView = viewHolder.itemView; if (getAdapterItemCount() == 0) { removeDispatchLoadMoreView(); - } else if (enabled_custom_load_more_view = true) { + } + if (enabled_custom_load_more_view && getAdapterItemCount() > 0) { revealDispatchLoadMoreView(); } return viewHolder;