diff --git a/.gitignore b/.gitignore index 6a1f35482..8a89c5a49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,14 @@ -#Android generated -bin -gen - -#Eclipse -.project -.classpath -.settings - -#IntelliJ IDEA -.idea *.iml -*.ipr -*.iws -out - -#Maven -target -release.properties -pom.xml.* - -#Ant -build.xml -local.properties -proguard.cfg - -#OSX +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries .DS_Store +/build +/captures + +/sample/build +/pulltorefresh/build +/pulltorefresh/local.properties +/.idea +/pulltorefresh/.idea \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/README.md b/README.md index b05891dd4..bbf997219 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,43 @@ -# PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED - -* * * - # Pull To Refresh Views for Android +Expanded support for **RecyclerView** +Expanded support for **Custom LoadingLayout** + ![Screenshot](https://github.com/chrisbanes/Android-PullToRefresh/raw/master/header_graphic.png) +### RecyclerView with Custom LoadingLayout Demo ### +![Screenshot](https://raw.githubusercontent.com/xuehuayous/Android-PullToRefresh/master/recyclerView_demo.gif) + This project aims to provide a reusable Pull to Refresh widget for Android. It was originally based on Johan Nilsson's [library](https://github.com/johannilsson/android-pulltorefresh) (mainly for graphics, strings and animations), but these have been replaced since. +## Using Pull To Refresh in your application + +If you are building with Gradle, simply add the following line to the `dependencies` section of your `build.gradle` file: + +``` + compile 'com.kevin:pulltorefresh:1.0.8' +``` + ## Features * Supports both Pulling Down from the top, and Pulling Up from the bottom (or even both). * Animated Scrolling for all devices. * Over Scroll supports for devices on Android v2.3+. * Currently works with: - * **ListView** + * **ListView** * **ExpandableListView** * **GridView** * **WebView** * **ScrollView** * **HorizontalScrollView** * **ViewPager** + * **RecyclerView** * Integrated End of List Listener for use of detecting when the user has scrolled to the bottom. * Maven Support. * Indicators to show the user when a Pull-to-Refresh is available. * Support for **ListFragment**! * Lots of [Customisation](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Customisation) options! + * Expanded support for **RecyclerView** by Kevin Repository at . diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..2b6ba2f43 --- /dev/null +++ b/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.0.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/extras/PullToRefreshListFragment/LICENSE b/extras/PullToRefreshListFragment/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/extras/PullToRefreshListFragment/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/extras/PullToRefreshListFragment/libs/android-support-v4.jar b/extras/PullToRefreshListFragment/libs/android-support-v4.jar deleted file mode 100644 index feaf44f80..000000000 Binary files a/extras/PullToRefreshListFragment/libs/android-support-v4.jar and /dev/null differ diff --git a/extras/PullToRefreshListFragment/pom.xml b/extras/PullToRefreshListFragment/pom.xml deleted file mode 100644 index b67c8bbe4..000000000 --- a/extras/PullToRefreshListFragment/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - 4.0.0 - - com.github.chrisbanes.pulltorefresh - extra-listfragment - apklib - Android-PullToRefresh Extras: ListFragment - - - com.github.chrisbanes.pulltorefresh - extras - 2.1.2-SNAPSHOT - - - - - com.google.android - android - - - com.google.android - support-v4 - r7 - - - ${project.groupId} - library - apklib - ${project.version} - - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - org.apache.maven.plugins - maven-eclipse-plugin - - - - diff --git a/extras/PullToRefreshListFragment/project.properties b/extras/PullToRefreshListFragment/project.properties deleted file mode 100644 index 927fba41c..000000000 --- a/extras/PullToRefreshListFragment/project.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -android.library=true -# Project target. -target=android-16 -android.library.reference.1=../../library diff --git a/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml b/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml deleted file mode 100644 index f59ab8781..000000000 --- a/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/extras/PullToRefreshViewPager/AndroidManifest.xml b/extras/PullToRefreshViewPager/AndroidManifest.xml deleted file mode 100644 index eaffd6803..000000000 --- a/extras/PullToRefreshViewPager/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/extras/PullToRefreshViewPager/ant.properties b/extras/PullToRefreshViewPager/ant.properties deleted file mode 100644 index b0971e891..000000000 --- a/extras/PullToRefreshViewPager/ant.properties +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked into Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/extras/PullToRefreshViewPager/libs/android-support-v4.jar b/extras/PullToRefreshViewPager/libs/android-support-v4.jar deleted file mode 100644 index feaf44f80..000000000 Binary files a/extras/PullToRefreshViewPager/libs/android-support-v4.jar and /dev/null differ diff --git a/extras/PullToRefreshViewPager/pom.xml b/extras/PullToRefreshViewPager/pom.xml deleted file mode 100644 index 55978777f..000000000 --- a/extras/PullToRefreshViewPager/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - 4.0.0 - - com.github.chrisbanes.pulltorefresh - extra-viewpager - apklib - Android-PullToRefresh Extras: ViewPager - - - com.github.chrisbanes.pulltorefresh - extras - 2.1.2-SNAPSHOT - - - - - com.google.android - android - - - com.google.android - support-v4 - r7 - - - ${project.groupId} - library - apklib - ${project.version} - - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - org.apache.maven.plugins - maven-eclipse-plugin - - - - diff --git a/extras/PullToRefreshViewPager/project.properties b/extras/PullToRefreshViewPager/project.properties deleted file mode 100644 index 927fba41c..000000000 --- a/extras/PullToRefreshViewPager/project.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -android.library=true -# Project target. -target=android-16 -android.library.reference.1=../../library diff --git a/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml b/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml deleted file mode 100644 index f59ab8781..000000000 --- a/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/extras/PullToRefreshViewPager/res/values/ids.xml b/extras/PullToRefreshViewPager/res/values/ids.xml deleted file mode 100644 index 81cebf0eb..000000000 --- a/extras/PullToRefreshViewPager/res/values/ids.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/extras/pom.xml b/extras/pom.xml deleted file mode 100644 index 78cab515e..000000000 --- a/extras/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - 4.0.0 - - com.github.chrisbanes.pulltorefresh - extras - pom - Android-PullToRefresh Extras - - - com.github.chrisbanes.pulltorefresh - parent - 2.1.2-SNAPSHOT - - - - PullToRefreshListFragment - PullToRefreshViewPager - - diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..2dccfebf2 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +## Project-wide Gradle settings. +# +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +#Wed Dec 16 09:58:17 GMT+08:00 2015 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..05ef575b0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..c529ae1a7 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Apr 09 07:46:35 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..9d82f7891 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..8a0b282aa --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/library/AndroidManifest.xml b/library/AndroidManifest.xml deleted file mode 100644 index c3db5673d..000000000 --- a/library/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/library/LICENSE b/library/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/library/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/library/pom.xml b/library/pom.xml deleted file mode 100644 index 6b48e0adb..000000000 --- a/library/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - com.github.chrisbanes.pulltorefresh - library - apklib - Android-PullToRefresh Library - - - com.github.chrisbanes.pulltorefresh - parent - 2.1.2-SNAPSHOT - - - - - com.google.android - android - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - org.apache.maven.plugins - maven-eclipse-plugin - - - - diff --git a/library/project.properties b/library/project.properties deleted file mode 100644 index acfc74eb1..000000000 --- a/library/project.properties +++ /dev/null @@ -1,12 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-16 -android.library=true diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 1a755fea7..000000000 --- a/pom.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - 4.0.0 - com.github.chrisbanes.pulltorefresh - parent - pom - 2.1.2-SNAPSHOT - Android-PullToRefresh Project - Implementation of the Pull-to-Refresh UI Pattern for Android. - https://github.com/chrisbanes/Android-PullToRefresh - - org.sonatype.oss - oss-parent - 7 - - - - Apache License Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - https://github.com/chrisbanes/Android-PullToRefresh - scm:git:git://github.com/chrisbanes/Android-PullToRefresh.git - scm:git:git@github.com:chrisbanes/Android-PullToRefresh.git - HEAD - - - - Chris Banes - http://about.me/chrisbanes - chrisbanes - - - - library - sample - extras - - - - UTF-8 - UTF-8 - 1.6 - 4.1.1.4 - 16 - 3.2.0 - - - - - com.google.android - android - ${android.version} - provided - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-release-plugin - 2.3.2 - - v@{project.version} - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - ${android-maven.version} - - - ${android.platform} - - true - ${sourceCompatibility} - ${sourceCompatibility} - - true - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - com.google.android:android - - bin - - com.android.ide.eclipse.adt.ANDROID_FRAMEWORK - - - com.android.ide.eclipse.adt.AndroidNature - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - com.android.ide.eclipse.adt.PreCompilerBuilder - com.android.ide.eclipse.adt.ApkBuilder - - - - - - src - - diff --git a/pulltorefresh/.gitignore b/pulltorefresh/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/pulltorefresh/.gitignore @@ -0,0 +1 @@ +/build diff --git a/pulltorefresh/bintrayUpload.gradle b/pulltorefresh/bintrayUpload.gradle new file mode 100644 index 000000000..7aa773703 --- /dev/null +++ b/pulltorefresh/bintrayUpload.gradle @@ -0,0 +1,116 @@ +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' + +// load properties +Properties properties = new Properties() +File localPropertiesFile = project.file("local.properties"); +if(localPropertiesFile.exists()){ + properties.load(localPropertiesFile.newDataInputStream()) +} +File projectPropertiesFile = project.file("project.properties"); +if(projectPropertiesFile.exists()){ + properties.load(projectPropertiesFile.newDataInputStream()) +} + +// read properties +def projectName = properties.getProperty("project.name") +def projectGroupId = properties.getProperty("project.groupId") +def projectArtifactId = properties.getProperty("project.artifactId") +def projectVersionName = android.defaultConfig.versionName +def projectPackaging = properties.getProperty("project.packaging") +def projectSiteUrl = properties.getProperty("project.siteUrl") +def projectGitUrl = properties.getProperty("project.gitUrl") + +def developerId = properties.getProperty("developer.id") +def developerName = properties.getProperty("developer.name") +def developerEmail = properties.getProperty("developer.email") + +def bintrayUser = properties.getProperty("bintray.user") +def bintrayApikey = properties.getProperty("bintray.apikey") + +def javadocName = properties.getProperty("javadoc.name") + +group = projectGroupId + +// This generates POM.xml with proper parameters +install { + repositories.mavenInstaller { + pom { + project { + name projectName + groupId projectGroupId + artifactId projectArtifactId + version projectVersionName + packaging projectPackaging + url projectSiteUrl + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id developerId + name developerName + email developerEmail + } + } + scm { + connection projectGitUrl + developerConnection projectGitUrl + url projectSiteUrl + } + } + } + } +} + +// This generates sources.jar +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +// This generates javadoc.jar +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar +} + +// javadoc configuration +javadoc { + options{ + encoding "UTF-8" + charSet 'UTF-8' + author true + version projectVersionName + links "http://docs.oracle.com/javase/7/docs/api" + title javadocName + } +} + +// bintray configuration +bintray { + user = bintrayUser + key = bintrayApikey + configurations = ['archives'] + pkg { + repo = "maven" + name = projectName + websiteUrl = projectSiteUrl + vcsUrl = projectGitUrl + licenses = ["Apache-2.0"] + publish = true + } +} \ No newline at end of file diff --git a/pulltorefresh/build.gradle b/pulltorefresh/build.gradle new file mode 100644 index 000000000..25ce55c37 --- /dev/null +++ b/pulltorefresh/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 7 + targetSdkVersion 23 + versionCode 8 + versionName "1.0.8" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile 'com.android.support:recyclerview-v7:23.3.0' +} + +apply from: "bintrayUpload.gradle" \ No newline at end of file diff --git a/pulltorefresh/gradle/wrapper/gradle-wrapper.jar b/pulltorefresh/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..05ef575b0 Binary files /dev/null and b/pulltorefresh/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pulltorefresh/gradle/wrapper/gradle-wrapper.properties b/pulltorefresh/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..f23df6e46 --- /dev/null +++ b/pulltorefresh/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 21 11:34:03 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/pulltorefresh/gradlew b/pulltorefresh/gradlew new file mode 100644 index 000000000..9d82f7891 --- /dev/null +++ b/pulltorefresh/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/pulltorefresh/gradlew.bat b/pulltorefresh/gradlew.bat new file mode 100644 index 000000000..8a0b282aa --- /dev/null +++ b/pulltorefresh/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/extras/PullToRefreshViewPager/proguard-project.txt b/pulltorefresh/proguard-rules.pro similarity index 62% rename from extras/PullToRefreshViewPager/proguard-project.txt rename to pulltorefresh/proguard-rules.pro index f2fe1559a..9655c1074 100644 --- a/extras/PullToRefreshViewPager/proguard-project.txt +++ b/pulltorefresh/proguard-rules.pro @@ -1,11 +1,8 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. +# in D:\studio-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 diff --git a/pulltorefresh/project.properties b/pulltorefresh/project.properties new file mode 100644 index 000000000..71a63b2a3 --- /dev/null +++ b/pulltorefresh/project.properties @@ -0,0 +1,10 @@ +#project +project.name=PullToRefresh +project.groupId=com.kevin +project.artifactId=pulltorefresh +project.packaging=aar +project.siteUrl=https://github.com/xuehuayous/Android-PullToRefresh +project.gitUrl=https://github.com/xuehuayous/Android-PullToRefresh.git + +#javadoc +javadoc.name=PullToRefresh \ No newline at end of file diff --git a/pulltorefresh/src/androidTest/java/com/handmark/pulltorefresh/ApplicationTest.java b/pulltorefresh/src/androidTest/java/com/handmark/pulltorefresh/ApplicationTest.java new file mode 100644 index 000000000..30f324c1d --- /dev/null +++ b/pulltorefresh/src/androidTest/java/com/handmark/pulltorefresh/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.handmark.pulltorefresh; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/extras/PullToRefreshListFragment/AndroidManifest.xml b/pulltorefresh/src/main/AndroidManifest.xml similarity index 52% rename from extras/PullToRefreshListFragment/AndroidManifest.xml rename to pulltorefresh/src/main/AndroidManifest.xml index 6745733d6..87dc89278 100644 --- a/extras/PullToRefreshListFragment/AndroidManifest.xml +++ b/pulltorefresh/src/main/AndroidManifest.xml @@ -1,9 +1,5 @@ - + package="com.handmark.pulltorefresh.library"> - \ No newline at end of file diff --git a/library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/ILoadingLayout.java similarity index 99% rename from library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/ILoadingLayout.java index ff2a95722..133ef95b3 100644 --- a/library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/ILoadingLayout.java @@ -51,6 +51,7 @@ public interface ILoadingLayout { * displayed. Please see * {@link android.widget.TextView#setTypeface(Typeface) * TextView#setTypeface(Typeface)}. + * @param tf */ public void setTextTypeface(Typeface tf); diff --git a/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/IPullToRefresh.java similarity index 90% rename from library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/IPullToRefresh.java index a06cdd7cf..cd7c2b8c5 100644 --- a/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/IPullToRefresh.java @@ -59,7 +59,7 @@ public interface IPullToRefresh { /** * Returns a proxy object which allows you to call methods on all of the * LoadingLayouts (the Views which show when Pulling/Refreshing). - *

+ * * You should not keep the result of this method any longer than you need * it. * @@ -73,7 +73,7 @@ public interface IPullToRefresh { * LoadingLayouts (the Views which show when Pulling/Refreshing). The actual * LoadingLayout(s) which will be affected, are chosen by the parameters you * give. - *

+ * * You should not keep the result of this method any longer than you need * it. * @@ -194,6 +194,29 @@ public interface IPullToRefresh { */ public void setOnRefreshListener(OnRefreshListener2 listener); + /** + * Set a header LoadingLayout for the Widget + * + * @param headerLayout + */ + public void setHeaderLayout(LoadingLayoutBase headerLayout); + + /** + * Set a footer LoadingLayout for the Widget + * + * @param footerLayout + */ + public void setFooterLayout(LoadingLayoutBase footerLayout); + + /** + * Set a second footer LoadingLayout for the Widget,it used to the widget + * can add footer just like ListView or + * WrapRecyclerView(https://github.com/xuehuayous/WrapRecyclerView) + * + * @param view + */ + public void setSecondFooterLayout(View view); + /** * Sets whether Overscroll support is enabled. This is different to * Android's standard Overscroll support (the edge-glow). This setting only @@ -243,4 +266,16 @@ public interface IPullToRefresh { */ public void setShowViewWhileRefreshing(boolean showView); + /** + * set weather has friction when pull down + * @param hasPullDownFriction + */ + public void setHasPullDownFriction(boolean hasPullDownFriction); + + /** + * set weather has friction when pull up + * @param hasPullUpFriction + */ + public void setHasPullUpFriction(boolean hasPullUpFriction); + } \ No newline at end of file diff --git a/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutBase.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutBase.java new file mode 100644 index 000000000..bf098379c --- /dev/null +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutBase.java @@ -0,0 +1,124 @@ +package com.handmark.pulltorefresh.library; + +import android.content.Context; +import android.graphics.Typeface; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import com.handmark.pulltorefresh.library.ILoadingLayout; + +/** + * Created by zwenkai on 2015/12/19. + */ +public abstract class LoadingLayoutBase extends FrameLayout implements ILoadingLayout{ + + public LoadingLayoutBase(Context context) { + super(context); + } + + public LoadingLayoutBase(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public LoadingLayoutBase(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public final void setHeight(int height) { + ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams(); + lp.height = height; + requestLayout(); + } + + public final void setWidth(int width) { + ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams(); + lp.width = width; + requestLayout(); + } + + @Override + public void setLastUpdatedLabel(CharSequence label) { + + } + + @Override + public void setLoadingDrawable(Drawable drawable) { + + } + + @Override + public void setTextTypeface(Typeface tf) { + + } + + /** + * get the LoadingLayout height or width + * + * @return size + */ + public abstract int getContentSize(); + + /** + * Call when the widget begins to slide + */ + public abstract void pullToRefresh(); + + /** + * Call when the LoadingLayout is fully displayed + */ + public abstract void releaseToRefresh(); + + /** + * Call when the LoadingLayout is sliding + * + * @param scaleOfLayout scaleOfLayout + */ + public abstract void onPull(float scaleOfLayout); + + /** + * Call when the LoadingLayout is fully displayed and the widget has released. + * Used to prompt the user loading data + */ + public abstract void refreshing(); + + /** + * Call when the data has loaded + */ + public abstract void reset(); + + public void hideAllViews(){ + hideAllViews(this); + } + + public void showInvisibleViews() { + showAllViews(this); + } + + private void hideAllViews(View view) { + if(view instanceof ViewGroup) { + for (int i = 0; i < ((ViewGroup)view).getChildCount(); i++) { + hideAllViews(((ViewGroup)view).getChildAt(i)); + } + } else { + if(View.VISIBLE == view.getVisibility()) { + view.setVisibility(View.INVISIBLE); + } + } + } + + private void showAllViews(View view) { + if(view instanceof ViewGroup) { + for (int i = 0; i < ((ViewGroup)view).getChildCount(); i++) { + showAllViews(((ViewGroup) view).getChildAt(i)); + } + } else { + if(View.INVISIBLE == view.getVisibility()) { + view.setVisibility(View.VISIBLE); + } + } + } + +} diff --git a/library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java similarity index 71% rename from library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java index 5f76645d2..5642738dc 100644 --- a/library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java @@ -1,18 +1,16 @@ package com.handmark.pulltorefresh.library; -import java.util.HashSet; - import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import com.handmark.pulltorefresh.library.internal.LoadingLayout; +import java.util.HashSet; public class LoadingLayoutProxy implements ILoadingLayout { - private final HashSet mLoadingLayouts; + private final HashSet mLoadingLayouts; LoadingLayoutProxy() { - mLoadingLayouts = new HashSet(); + mLoadingLayouts = new HashSet(); } /** @@ -24,7 +22,7 @@ public class LoadingLayoutProxy implements ILoadingLayout { * * @param layout - LoadingLayout to have included. */ - public void addLayout(LoadingLayout layout) { + public void addLayout(LoadingLayoutBase layout) { if (null != layout) { mLoadingLayouts.add(layout); } @@ -32,41 +30,41 @@ public void addLayout(LoadingLayout layout) { @Override public void setLastUpdatedLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setLastUpdatedLabel(label); } } @Override public void setLoadingDrawable(Drawable drawable) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setLoadingDrawable(drawable); } } @Override public void setRefreshingLabel(CharSequence refreshingLabel) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setRefreshingLabel(refreshingLabel); } } @Override public void setPullLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setPullLabel(label); } } @Override public void setReleaseLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setReleaseLabel(label); } } public void setTextTypeface(Typeface tf) { - for (LoadingLayout layout : mLoadingLayouts) { + for (LoadingLayoutBase layout : mLoadingLayouts) { layout.setTextTypeface(tf); } } diff --git a/library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java similarity index 99% rename from library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java index 52a20de24..f5985ad31 100644 --- a/library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/OverscrollHelper.java @@ -31,7 +31,7 @@ public final class OverscrollHelper { /** * Helper method for Overscrolling that encapsulates all of the necessary * function. - *

+ * * This should only be used on AdapterView's such as ListView as it just * calls through to overScrollBy() with the scrollRange = 0. AdapterView's * do not have a scroll range (i.e. getScrollY() doesn't work). diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java similarity index 99% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java index cfff83716..c44b8651c 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java @@ -143,7 +143,7 @@ public final void onScrollStateChanged(final AbsListView view, final int state) /** * Pass-through method for {@link PullToRefreshBase#getRefreshableView() * getRefreshableView()}. - * {@link AdapterView#setAdapter(android.widget.Adapter)} + * {@link AdapterView#setAdapter(Adapter)} * setAdapter(adapter)}. This is just for convenience! * * @param adapter - Adapter to set @@ -154,10 +154,10 @@ public void setAdapter(ListAdapter adapter) { /** * Sets the Empty View to be used by the Adapter View. - *

+ * * We need it handle it ourselves so that we can Pull-to-Refresh when the * Empty View is shown. - *

+ * * Please note, you do not usually need to call this method * yourself. Calling setEmptyView on the AdapterView will automatically call * this method and set everything up. This includes when the Android diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java similarity index 95% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java index e76b234f3..832a417c5 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java @@ -35,7 +35,6 @@ import android.widget.LinearLayout; import com.handmark.pulltorefresh.library.internal.FlipLoadingLayout; -import com.handmark.pulltorefresh.library.internal.LoadingLayout; import com.handmark.pulltorefresh.library.internal.RotateLoadingLayout; import com.handmark.pulltorefresh.library.internal.Utils; import com.handmark.pulltorefresh.library.internal.ViewCompat; @@ -46,11 +45,11 @@ public abstract class PullToRefreshBase extends LinearLayout imp // Constants // =========================================================== - static final boolean DEBUG = true; + public static final boolean DEBUG = false; static final boolean USE_HW_LAYERS = false; - static final String LOG_TAG = "PullToRefresh"; + public static final String LOG_TAG = "PullToRefresh"; static final float FRICTION = 2.0f; @@ -78,7 +77,7 @@ public abstract class PullToRefreshBase extends LinearLayout imp private Mode mMode = Mode.getDefault(); private Mode mCurrentMode; - T mRefreshableView; + protected T mRefreshableView; private FrameLayout mRefreshableViewWrapper; private boolean mShowViewWhileRefreshing = true; @@ -86,12 +85,14 @@ public abstract class PullToRefreshBase extends LinearLayout imp private boolean mFilterTouchEvents = true; private boolean mOverScrollEnabled = true; private boolean mLayoutVisibilityChangesEnabled = true; + private boolean mHasPullDownFriction = true; + private boolean mHasPullUpFriction = true; private Interpolator mScrollAnimationInterpolator; private AnimationStyle mLoadingAnimationStyle = AnimationStyle.getDefault(); - private LoadingLayout mHeaderLayout; - private LoadingLayout mFooterLayout; + protected LoadingLayoutBase mHeaderLayout; + protected LoadingLayoutBase mFooterLayout; private OnRefreshListener mOnRefreshListener; private OnRefreshListener2 mOnRefreshListener2; @@ -445,6 +446,22 @@ public final void setOnRefreshListener(OnRefreshListener2 listener) { mOnRefreshListener = null; } + @Override + public void setHeaderLayout(LoadingLayoutBase headerLayout) { + mHeaderLayout = headerLayout; + updateUIForMode(); + } + + @Override + public void setFooterLayout(LoadingLayoutBase footerLayout) { + mFooterLayout = footerLayout; + updateUIForMode(); + } + + @Override + public void setSecondFooterLayout(View secondFooterLayout) { + } + /** * @deprecated You should now call this method on the result of * {@link #getLoadingLayoutProxy()}. @@ -487,6 +504,16 @@ public final void setRefreshing(boolean doScroll) { } } + @Override + public void setHasPullDownFriction(boolean hasPullDownFriction) { + this.mHasPullDownFriction = hasPullDownFriction; + } + + @Override + public void setHasPullUpFriction(boolean hasPullUpFriction) { + this.mHasPullUpFriction = hasPullUpFriction; + } + /** * @deprecated You should now call this method on the result of * {@link #getLoadingLayoutProxy()}. @@ -583,8 +610,8 @@ protected final void addViewInternal(View child, ViewGroup.LayoutParams params) super.addView(child, -1, params); } - protected LoadingLayout createLoadingLayout(Context context, Mode mode, TypedArray attrs) { - LoadingLayout layout = mLoadingAnimationStyle.createLoadingLayout(context, mode, + protected LoadingLayoutBase createLoadingLayout(Context context, Mode mode, TypedArray attrs) { + LoadingLayoutBase layout = mLoadingAnimationStyle.createLoadingLayout(context, mode, getPullToRefreshScrollDirection(), attrs); layout.setVisibility(View.INVISIBLE); return layout; @@ -611,7 +638,7 @@ protected LoadingLayoutProxy createLoadingLayoutProxy(final boolean includeStart * This is implemented by derived classes to return the created View. If you * need to use a custom View (such as a custom ListView), override this * method and return an instance of your custom class. - *

+ * * Be sure to set the ID of the view in this method, especially if you're * using a ListActivity or ListFragment. * @@ -627,7 +654,7 @@ protected final void disableLoadingLayoutVisibilityChanges() { mLayoutVisibilityChangesEnabled = false; } - protected final LoadingLayout getFooterLayout() { + protected final LoadingLayoutBase getFooterLayout() { return mFooterLayout; } @@ -635,7 +662,7 @@ protected final int getFooterSize() { return mFooterLayout.getContentSize(); } - protected final LoadingLayout getHeaderLayout() { + protected final LoadingLayoutBase getHeaderLayout() { return mHeaderLayout; } @@ -921,7 +948,7 @@ protected final void refreshLoadingViewsSize() { protected final void refreshRefreshableViewSize(int width, int height) { // We need to set the Height of the Refreshable View to the same as // this layout - LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mRefreshableViewWrapper.getLayoutParams(); + LayoutParams lp = (LayoutParams) mRefreshableViewWrapper.getLayoutParams(); switch (getPullToRefreshScrollDirection()) { case HORIZONTAL: @@ -1023,7 +1050,7 @@ protected final void smoothScrollToLonger(int scrollValue) { protected void updateUIForMode() { // We need to use the correct LayoutParam values, based on scroll // direction - final LinearLayout.LayoutParams lp = getLoadingLayoutLayoutParams(); + final LayoutParams lp = getLoadingLayoutLayoutParams(); // Remove Header, and then add Header Loading View again if needed if (this == mHeaderLayout.getParent()) { @@ -1054,7 +1081,7 @@ private void addRefreshableView(Context context, T refreshableView) { mRefreshableViewWrapper.addView(refreshableView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - addViewInternal(mRefreshableViewWrapper, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, + addViewInternal(mRefreshableViewWrapper, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } @@ -1180,12 +1207,20 @@ private void pullEvent() { switch (mCurrentMode) { case PULL_FROM_END: - newScrollValue = Math.round(Math.max(initialMotionValue - lastMotionValue, 0) / FRICTION); + if(mHasPullUpFriction) { + newScrollValue = Math.round(Math.max(initialMotionValue - lastMotionValue, 0) / FRICTION); + } else { + newScrollValue = Math.round(Math.max(initialMotionValue - lastMotionValue, 0)); + } itemDimension = getFooterSize(); break; case PULL_FROM_START: default: - newScrollValue = Math.round(Math.min(initialMotionValue - lastMotionValue, 0) / FRICTION); + if(mHasPullDownFriction) { + newScrollValue = Math.round(Math.min(initialMotionValue - lastMotionValue, 0) / FRICTION); + } else { + newScrollValue = Math.round(Math.min(initialMotionValue - lastMotionValue, 0)); + } itemDimension = getHeaderSize(); break; } @@ -1212,15 +1247,15 @@ private void pullEvent() { } } - private LinearLayout.LayoutParams getLoadingLayoutLayoutParams() { + private LayoutParams getLoadingLayoutLayoutParams() { switch (getPullToRefreshScrollDirection()) { case HORIZONTAL: - return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT); + return new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT); case VERTICAL: default: - return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT); + return new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.WRAP_CONTENT); } } @@ -1321,7 +1356,7 @@ static AnimationStyle mapIntToValue(int modeInt) { } } - LoadingLayout createLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { + LoadingLayoutBase createLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { switch (this) { case ROTATE: default: diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshGridView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshGridView.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshGridView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshGridView.java diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshListView.java similarity index 76% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshListView.java index 0aa9a27d6..89d5cb36d 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshListView.java @@ -30,14 +30,18 @@ import android.widget.ListView; import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor; -import com.handmark.pulltorefresh.library.internal.LoadingLayout; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; public class PullToRefreshListView extends PullToRefreshAdapterViewBase { - private LoadingLayout mHeaderLoadingView; - private LoadingLayout mFooterLoadingView; + private LoadingLayoutBase mHeaderLoadingView; + private LoadingLayoutBase mFooterLoadingView; + private FrameLayout mLvHeaderLoadingFrame; private FrameLayout mLvFooterLoadingFrame; + private FrameLayout mLvSecondFooterLoadingFrame; private boolean mListViewExtrasEnabled; @@ -57,6 +61,9 @@ public PullToRefreshListView(Context context, Mode mode, AnimationStyle style) { super(context, mode, style); } + /** + * 获取刷新方向 + */ @Override public final Orientation getPullToRefreshScrollDirection() { return Orientation.VERTICAL; @@ -76,7 +83,7 @@ protected void onRefreshing(final boolean doScroll) { super.onRefreshing(false); - final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView; + final LoadingLayoutBase origLoadingView, listViewLoadingView, oppositeListViewLoadingView; final int selection, scrollToY; switch (getCurrentMode()) { @@ -136,7 +143,7 @@ protected void onReset() { return; } - final LoadingLayout originalLoadingLayout, listViewLoadingLayout; + final LoadingLayoutBase originalLoadingLayout, listViewLoadingLayout; final int scrollToHeight, selection; final boolean scrollLvToEdge; @@ -232,17 +239,19 @@ protected void handleStyledAttributes(TypedArray a) { FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); // Create Loading Views ready for use later - FrameLayout frame = new FrameLayout(getContext()); + mLvHeaderLoadingFrame = new FrameLayout(getContext()); mHeaderLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_START, a); mHeaderLoadingView.setVisibility(View.GONE); - frame.addView(mHeaderLoadingView, lp); - mRefreshableView.addHeaderView(frame, null, false); + mLvHeaderLoadingFrame.addView(mHeaderLoadingView, lp); + mRefreshableView.addHeaderView(mLvHeaderLoadingFrame, null, false); mLvFooterLoadingFrame = new FrameLayout(getContext()); mFooterLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_END, a); mFooterLoadingView.setVisibility(View.GONE); mLvFooterLoadingFrame.addView(mFooterLoadingView, lp); + mLvSecondFooterLoadingFrame = new FrameLayout(getContext()); + /** * If the value for Scrolling While Refreshing hasn't been * explicitly set via XML, enable Scrolling While Refreshing. @@ -253,6 +262,59 @@ protected void handleStyledAttributes(TypedArray a) { } } + @Override + public void setHeaderLayout(LoadingLayoutBase headerLayout) { + super.setHeaderLayout(headerLayout); + + try { + Constructor c = headerLayout.getClass().getDeclaredConstructor(new Class[]{Context.class}); + LoadingLayoutBase mHeaderLayout = (LoadingLayoutBase)c.newInstance(new Object[]{getContext()}); + if(null != mHeaderLayout) { + mRefreshableView.removeHeaderView(mLvHeaderLoadingFrame); + final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); + + mLvHeaderLoadingFrame = new FrameLayout(getContext()); + mHeaderLoadingView = mHeaderLayout; + mHeaderLoadingView.setVisibility(View.GONE); + mLvHeaderLoadingFrame.addView(mHeaderLoadingView, lp); + mRefreshableView.addHeaderView(mLvHeaderLoadingFrame, null, false); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void setFooterLayout(LoadingLayoutBase footerLayout) { + super.setFooterLayout(footerLayout); + + try { + Constructor c = footerLayout.getClass().getDeclaredConstructor(new Class[]{Context.class}); + LoadingLayoutBase mFooterLayout = (LoadingLayoutBase)c.newInstance(new Object[]{getContext()}); + if(null != mFooterLayout) { + mRefreshableView.removeFooterView(mLvFooterLoadingFrame); + final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); + + mLvFooterLoadingFrame = new FrameLayout(getContext()); + mFooterLoadingView = mFooterLayout; + mFooterLoadingView.setVisibility(View.GONE); + mLvFooterLoadingFrame.addView(mFooterLoadingView, lp); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void setSecondFooterLayout(View secondFooterLayout) { + final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); + + mLvSecondFooterLoadingFrame.addView(secondFooterLayout, lp); + } + @TargetApi(9) final class InternalListViewSDK9 extends InternalListView { @@ -262,7 +324,7 @@ public InternalListViewSDK9(Context context, AttributeSet attrs) { @Override protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { + int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); @@ -315,6 +377,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { public void setAdapter(ListAdapter adapter) { // Add the Footer View at the last possible moment if (null != mLvFooterLoadingFrame && !mAddedLvFooter) { + addFooterView(mLvSecondFooterLoadingFrame, null, false); addFooterView(mLvFooterLoadingFrame, null, false); mAddedLvFooter = true; } @@ -334,4 +397,4 @@ public void setEmptyViewInternal(View emptyView) { } -} +} \ No newline at end of file diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java diff --git a/library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshWebView.java similarity index 95% rename from library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshWebView.java index 3f873de08..384724ccf 100644 --- a/library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshWebView.java @@ -25,6 +25,7 @@ import android.webkit.WebChromeClient; import android.webkit.WebView; + public class PullToRefreshWebView extends PullToRefreshBase { private static final OnRefreshListener defaultOnRefreshListener = new OnRefreshListener() { @@ -112,7 +113,7 @@ protected boolean isReadyForPullStart() { @Override protected boolean isReadyForPullEnd() { - float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); + float exactContentHeight = (float) Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); } @@ -158,7 +159,7 @@ protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, } private int getScrollRange() { - return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()) + return (int) Math.max(0, Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()) - (getHeight() - getPaddingBottom() - getPaddingTop())); } } diff --git a/library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java similarity index 99% rename from library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java index 781920374..ec3c0d431 100644 --- a/library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java @@ -15,19 +15,19 @@ *******************************************************************************/ package com.handmark.pulltorefresh.library.extras; -import java.util.concurrent.atomic.AtomicBoolean; - import android.content.Context; import android.util.AttributeSet; import android.webkit.WebView; import com.handmark.pulltorefresh.library.PullToRefreshWebView; +import java.util.concurrent.atomic.AtomicBoolean; + /** * An advanced version of {@link PullToRefreshWebView} which delegates the * triggering of the PullToRefresh gesture to the Javascript running within the * WebView. This means that you should only use this class if: - *

+ * *

    *
  • {@link PullToRefreshWebView} doesn't work correctly because you're using * overflow:scroll or something else which means @@ -35,15 +35,14 @@ *
  • You control the web content being displayed, as you need to write some * Javascript callbacks.
  • *
- *

- *

+ * * The way this call works is that when a PullToRefresh gesture is in action, * the following Javascript methods will be called: * isReadyForPullDown() and isReadyForPullUp(), it is * your job to calculate whether the view is in a state where a PullToRefresh * can happen, and return the result via the callback mechanism. An example can * be seen below: - *

+ * * *

  * function isReadyForPullDown() {
diff --git a/library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
similarity index 99%
rename from library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
index a7aac306a..9030daf78 100644
--- a/library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
+++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java
@@ -15,8 +15,6 @@
  *******************************************************************************/
 package com.handmark.pulltorefresh.library.extras;
 
-import java.util.HashMap;
-
 import android.content.Context;
 import android.media.MediaPlayer;
 import android.view.View;
@@ -25,6 +23,8 @@
 import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
 import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
 
+import java.util.HashMap;
+
 public class SoundPullEventListener implements PullToRefreshBase.OnPullEventListener {
 
 	private final Context mContext;
@@ -54,7 +54,7 @@ public final void onPullEvent(PullToRefreshBase refreshView, State event, Mod
 	 * Set the Sounds to be played when a Pull Event happens. You specify which
 	 * sound plays for which events by calling this method multiple times for
 	 * each event.
-	 * 

+ * * If you've already set a sound for a certain event, and add another sound * for that event, only the new sound will be played. * diff --git a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshBaseListFragment.java similarity index 94% rename from extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshBaseListFragment.java index 4350f9257..f4d305c45 100644 --- a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshBaseListFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ -package com.handmark.pulltorefresh.extras.listfragment; +package com.handmark.pulltorefresh.library.extras.listfragment; import android.os.Bundle; import android.support.v4.app.ListFragment; @@ -59,7 +59,7 @@ public final T getPullToRefreshListView() { * * @param inflater - LayoutInflater which can be used to inflate from XML. * @param savedInstanceState - Bundle passed through from - * {@link ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle) + * {ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle) * onCreateView(...)} * @return The {@link PullToRefreshBase} which will replace the ListView. */ diff --git a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshExpandableListFragment.java similarity index 92% rename from extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshExpandableListFragment.java index aca73a3e7..82f83034d 100644 --- a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshExpandableListFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ -package com.handmark.pulltorefresh.extras.listfragment; +package com.handmark.pulltorefresh.library.extras.listfragment; import android.os.Bundle; import android.support.v4.app.ListFragment; @@ -23,11 +23,11 @@ /** * A sample implementation of how to use {@link PullToRefreshExpandableListView} - * with {@link ListFragment}. This implementation simply replaces the ListView + * with {ListFragment}. This implementation simply replaces the ListView * that {@code ListFragment} creates with a new * {@code PullToRefreshExpandableListView}. This means that ListFragment still * works 100% (e.g. setListShown(...) ). - *

+ * * The new PullToRefreshListView is created in the method * {@link #onCreatePullToRefreshListView(LayoutInflater, Bundle)}. If you wish * to customise the {@code PullToRefreshExpandableListView} then override this diff --git a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshListFragment.java similarity index 90% rename from extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshListFragment.java index e544797f9..b6004f14e 100644 --- a/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/listfragment/PullToRefreshListFragment.java @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ -package com.handmark.pulltorefresh.extras.listfragment; +package com.handmark.pulltorefresh.library.extras.listfragment; import android.os.Bundle; -import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import com.handmark.pulltorefresh.library.PullToRefreshListView; /** * A sample implementation of how to use {@link PullToRefreshListView} with - * {@link ListFragment}. This implementation simply replaces the ListView that + * {ListFragment}. This implementation simply replaces the ListView that * {@code ListFragment} creates with a new PullToRefreshListView. This means * that ListFragment still works 100% (e.g. setListShown(...) ). - *

+ * * The new PullToRefreshListView is created in the method * {@link #onCreatePullToRefreshListView(LayoutInflater, Bundle)}. If you wish * to customise the {@code PullToRefreshListView} then override this method and diff --git a/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/recyclerview/PullToRefreshRecyclerView.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/recyclerview/PullToRefreshRecyclerView.java new file mode 100644 index 000000000..54e4d7142 --- /dev/null +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/recyclerview/PullToRefreshRecyclerView.java @@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright 2011, 2012 Chris Banes. + * + * 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. + *******************************************************************************/ +package com.handmark.pulltorefresh.library.extras.recyclerview; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.RecyclerView.Adapter; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; + +import com.handmark.pulltorefresh.library.PullToRefreshBase; + +/** + * 版权所有:XXX有限公司 + * + * PullToRefreshRecyclerView + * + * @author zhou.wenkai zwenkai@foxmail.com ,Created on 2015-9-23 09:07:33 + * Major Function:对PullToRefresh的扩展,增加支持RecyclerView + * + * 注:如果您修改了本类请填写以下内容作为记录,如非本人操作劳烦通知,谢谢!!! + * @author mender,Modified Date Modify Content: + */ +public class PullToRefreshRecyclerView extends PullToRefreshBase { + + public PullToRefreshRecyclerView(Context context) { + super(context); + } + + public PullToRefreshRecyclerView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public PullToRefreshRecyclerView(Context context, Mode mode) { + super(context, mode); + } + + public PullToRefreshRecyclerView(Context context, Mode mode, AnimationStyle style) { + super(context, mode, style); + } + + @Override + public final Orientation getPullToRefreshScrollDirection() { + return Orientation.VERTICAL; + } + + @Override + protected RecyclerView createRefreshableView(Context context, + AttributeSet attrs) { + RecyclerView recyclerView = new RecyclerView(context, attrs); + return recyclerView; + } + + @Override + protected boolean isReadyForPullStart() { + return isFirstItemVisible(); + } + + @Override + protected boolean isReadyForPullEnd() { + return isLastItemVisible(); + } + + /** + * @Description: 判断第一个条目是否完全可见 + * + * @return boolean: + * @version 1.0 + * @date 2015-9-23 + * @Author zhou.wenkai + */ + private boolean isFirstItemVisible() { + final Adapter adapter = getRefreshableView().getAdapter(); + + // 如果未设置Adapter或者Adapter没有数据可以下拉刷新 + if (null == adapter || adapter.getItemCount() == 0) { + if (DEBUG) { + Log.d(LOG_TAG, "isFirstItemVisible. Empty View."); + } + return true; + + } else { + // 第一个条目完全展示,可以刷新 + if (getFirstVisiblePosition() == 0) { + return mRefreshableView.getChildAt(0).getTop() >= mRefreshableView + .getTop(); + } + } + + return false; + } + + /** + * @Description: 获取第一个可见子View的位置下标 + * + * @return int: 位置 + * @version 1.0 + * @date 2015-9-23 + * @Author zhou.wenkai + */ + private int getFirstVisiblePosition() { + View firstVisibleChild = mRefreshableView.getChildAt(0); + return firstVisibleChild != null ? mRefreshableView + .getChildAdapterPosition(firstVisibleChild) : -1; + } + + /** + * @Description: 判断最后一个条目是否完全可见 + * + * @return boolean: + * @version 1.0 + * @date 2015-9-23 + * @Author zhou.wenkai + */ + private boolean isLastItemVisible() { + final Adapter adapter = getRefreshableView().getAdapter(); + + // 如果未设置Adapter或者Adapter没有数据可以上拉刷新 + if (null == adapter || adapter.getItemCount() == 0) { + if (DEBUG) { + Log.d(LOG_TAG, "isLastItemVisible. Empty View."); + } + return true; + + } else { + // 最后一个条目View完全展示,可以刷新 + int lastVisiblePosition = getLastVisiblePosition(); + if(lastVisiblePosition >= mRefreshableView.getAdapter().getItemCount()-1) { + return mRefreshableView.getChildAt( + mRefreshableView.getChildCount() - 1).getBottom() <= mRefreshableView + .getBottom(); + } + } + + return false; + } + + /** + * @Description: 获取最后一个可见子View的位置下标 + * + * @return int: 位置 + * @version 1.0 + * @date 2015-9-23 + * @Author zhou.wenkai + */ + private int getLastVisiblePosition() { + View lastVisibleChild = mRefreshableView.getChildAt(mRefreshableView + .getChildCount() - 1); + return lastVisibleChild != null ? mRefreshableView + .getChildAdapterPosition(lastVisibleChild) : -1; + } + +} \ No newline at end of file diff --git a/extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/viewpager/PullToRefreshViewPager.java similarity index 95% rename from extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/viewpager/PullToRefreshViewPager.java index d5f845b32..1056d994a 100644 --- a/extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/extras/viewpager/PullToRefreshViewPager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ -package com.handmark.pulltorefresh.extras.viewpager; +package com.handmark.pulltorefresh.library.extras.viewpager; import android.content.Context; import android.support.v4.view.PagerAdapter; @@ -40,7 +40,7 @@ public final Orientation getPullToRefreshScrollDirection() { @Override protected ViewPager createRefreshableView(Context context, AttributeSet attrs) { ViewPager viewPager = new ViewPager(context, attrs); - viewPager.setId(R.id.viewpager); +// viewPager.setId(R.id.viewpager); return viewPager; } diff --git a/library/src/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java diff --git a/library/src/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java diff --git a/library/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java diff --git a/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java similarity index 87% rename from library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java index 9c12586df..01bcc8fd7 100644 --- a/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java +++ b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/LoadingLayout.java @@ -27,7 +27,6 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.widget.FrameLayout; @@ -35,13 +34,13 @@ import android.widget.ProgressBar; import android.widget.TextView; -import com.handmark.pulltorefresh.library.ILoadingLayout; +import com.handmark.pulltorefresh.library.LoadingLayoutBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation; import com.handmark.pulltorefresh.library.R; @SuppressLint("ViewConstructor") -public abstract class LoadingLayout extends FrameLayout implements ILoadingLayout { +abstract class LoadingLayout extends LoadingLayoutBase { static final String LOG_TAG = "PullToRefresh-LoadingLayout"; @@ -85,7 +84,7 @@ public LoadingLayout(Context context, final Mode mode, final Orientation scrollD mSubHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_sub_text); mHeaderImage = (ImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_image); - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInnerLayout.getLayoutParams(); + LayoutParams lp = (LayoutParams) mInnerLayout.getLayoutParams(); switch (mode) { case PULL_FROM_END: @@ -180,18 +179,9 @@ public LoadingLayout(Context context, final Mode mode, final Orientation scrollD reset(); } - public final void setHeight(int height) { - ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams(); - lp.height = height; - requestLayout(); - } - public final void setWidth(int width) { - ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) getLayoutParams(); - lp.width = width; - requestLayout(); - } + @Override public final int getContentSize() { switch (mScrollDirection) { case HORIZONTAL: @@ -202,27 +192,14 @@ public final int getContentSize() { } } - public final void hideAllViews() { - if (View.VISIBLE == mHeaderText.getVisibility()) { - mHeaderText.setVisibility(View.INVISIBLE); - } - if (View.VISIBLE == mHeaderProgress.getVisibility()) { - mHeaderProgress.setVisibility(View.INVISIBLE); - } - if (View.VISIBLE == mHeaderImage.getVisibility()) { - mHeaderImage.setVisibility(View.INVISIBLE); - } - if (View.VISIBLE == mSubHeaderText.getVisibility()) { - mSubHeaderText.setVisibility(View.INVISIBLE); - } - } - + @Override public final void onPull(float scaleOfLayout) { if (!mUseIntrinsicAnimation) { onPullImpl(scaleOfLayout); } } + @Override public final void pullToRefresh() { if (null != mHeaderText) { mHeaderText.setText(mPullLabel); @@ -232,6 +209,7 @@ public final void pullToRefresh() { pullToRefreshImpl(); } + @Override public final void refreshing() { if (null != mHeaderText) { mHeaderText.setText(mRefreshingLabel); @@ -249,6 +227,7 @@ public final void refreshing() { } } + @Override public final void releaseToRefresh() { if (null != mHeaderText) { mHeaderText.setText(mReleaseLabel); @@ -258,6 +237,7 @@ public final void releaseToRefresh() { releaseToRefreshImpl(); } + @Override public final void reset() { if (null != mHeaderText) { mHeaderText.setText(mPullLabel); @@ -311,21 +291,6 @@ public void setTextTypeface(Typeface tf) { mHeaderText.setTypeface(tf); } - public final void showInvisibleViews() { - if (View.INVISIBLE == mHeaderText.getVisibility()) { - mHeaderText.setVisibility(View.VISIBLE); - } - if (View.INVISIBLE == mHeaderProgress.getVisibility()) { - mHeaderProgress.setVisibility(View.VISIBLE); - } - if (View.INVISIBLE == mHeaderImage.getVisibility()) { - mHeaderImage.setVisibility(View.VISIBLE); - } - if (View.INVISIBLE == mSubHeaderText.getVisibility()) { - mSubHeaderText.setVisibility(View.VISIBLE); - } - } - /** * Callbacks for derivative Layouts */ diff --git a/library/src/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java diff --git a/library/src/com/handmark/pulltorefresh/library/internal/Utils.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/Utils.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/Utils.java diff --git a/library/src/com/handmark/pulltorefresh/library/internal/ViewCompat.java b/pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java similarity index 100% rename from library/src/com/handmark/pulltorefresh/library/internal/ViewCompat.java rename to pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/internal/ViewCompat.java diff --git a/library/res/anim/slide_in_from_bottom.xml b/pulltorefresh/src/main/res/anim/slide_in_from_bottom.xml similarity index 100% rename from library/res/anim/slide_in_from_bottom.xml rename to pulltorefresh/src/main/res/anim/slide_in_from_bottom.xml diff --git a/library/res/anim/slide_in_from_top.xml b/pulltorefresh/src/main/res/anim/slide_in_from_top.xml similarity index 100% rename from library/res/anim/slide_in_from_top.xml rename to pulltorefresh/src/main/res/anim/slide_in_from_top.xml diff --git a/library/res/anim/slide_out_to_bottom.xml b/pulltorefresh/src/main/res/anim/slide_out_to_bottom.xml similarity index 100% rename from library/res/anim/slide_out_to_bottom.xml rename to pulltorefresh/src/main/res/anim/slide_out_to_bottom.xml diff --git a/library/res/anim/slide_out_to_top.xml b/pulltorefresh/src/main/res/anim/slide_out_to_top.xml similarity index 100% rename from library/res/anim/slide_out_to_top.xml rename to pulltorefresh/src/main/res/anim/slide_out_to_top.xml diff --git a/library/res/drawable-hdpi/default_ptr_flip.png b/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_flip.png similarity index 100% rename from library/res/drawable-hdpi/default_ptr_flip.png rename to pulltorefresh/src/main/res/drawable-hdpi/default_ptr_flip.png diff --git a/library/res/drawable-hdpi/default_ptr_rotate.png b/pulltorefresh/src/main/res/drawable-hdpi/default_ptr_rotate.png similarity index 100% rename from library/res/drawable-hdpi/default_ptr_rotate.png rename to pulltorefresh/src/main/res/drawable-hdpi/default_ptr_rotate.png diff --git a/library/res/drawable-hdpi/indicator_arrow.png b/pulltorefresh/src/main/res/drawable-hdpi/indicator_arrow.png similarity index 100% rename from library/res/drawable-hdpi/indicator_arrow.png rename to pulltorefresh/src/main/res/drawable-hdpi/indicator_arrow.png diff --git a/library/res/drawable-mdpi/default_ptr_flip.png b/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_flip.png similarity index 100% rename from library/res/drawable-mdpi/default_ptr_flip.png rename to pulltorefresh/src/main/res/drawable-mdpi/default_ptr_flip.png diff --git a/library/res/drawable-mdpi/default_ptr_rotate.png b/pulltorefresh/src/main/res/drawable-mdpi/default_ptr_rotate.png similarity index 100% rename from library/res/drawable-mdpi/default_ptr_rotate.png rename to pulltorefresh/src/main/res/drawable-mdpi/default_ptr_rotate.png diff --git a/library/res/drawable-mdpi/indicator_arrow.png b/pulltorefresh/src/main/res/drawable-mdpi/indicator_arrow.png similarity index 100% rename from library/res/drawable-mdpi/indicator_arrow.png rename to pulltorefresh/src/main/res/drawable-mdpi/indicator_arrow.png diff --git a/library/res/drawable-xhdpi/default_ptr_flip.png b/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_flip.png similarity index 100% rename from library/res/drawable-xhdpi/default_ptr_flip.png rename to pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_flip.png diff --git a/library/res/drawable-xhdpi/default_ptr_rotate.png b/pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_rotate.png similarity index 100% rename from library/res/drawable-xhdpi/default_ptr_rotate.png rename to pulltorefresh/src/main/res/drawable-xhdpi/default_ptr_rotate.png diff --git a/library/res/drawable-xhdpi/indicator_arrow.png b/pulltorefresh/src/main/res/drawable-xhdpi/indicator_arrow.png similarity index 100% rename from library/res/drawable-xhdpi/indicator_arrow.png rename to pulltorefresh/src/main/res/drawable-xhdpi/indicator_arrow.png diff --git a/library/res/drawable/indicator_bg_bottom.xml b/pulltorefresh/src/main/res/drawable/indicator_bg_bottom.xml similarity index 100% rename from library/res/drawable/indicator_bg_bottom.xml rename to pulltorefresh/src/main/res/drawable/indicator_bg_bottom.xml diff --git a/library/res/drawable/indicator_bg_top.xml b/pulltorefresh/src/main/res/drawable/indicator_bg_top.xml similarity index 100% rename from library/res/drawable/indicator_bg_top.xml rename to pulltorefresh/src/main/res/drawable/indicator_bg_top.xml diff --git a/library/res/layout/pull_to_refresh_header_horizontal.xml b/pulltorefresh/src/main/res/layout/pull_to_refresh_header_horizontal.xml similarity index 100% rename from library/res/layout/pull_to_refresh_header_horizontal.xml rename to pulltorefresh/src/main/res/layout/pull_to_refresh_header_horizontal.xml diff --git a/library/res/layout/pull_to_refresh_header_vertical.xml b/pulltorefresh/src/main/res/layout/pull_to_refresh_header_vertical.xml similarity index 100% rename from library/res/layout/pull_to_refresh_header_vertical.xml rename to pulltorefresh/src/main/res/layout/pull_to_refresh_header_vertical.xml diff --git a/library/res/values-ar/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml similarity index 98% rename from library/res/values-ar/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml index 5b0b571cc..9177a97a6 100644 --- a/library/res/values-ar/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-ar/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - اسحب للتحديث… - اترك للتحديث… - تحميل… - + + + اسحب للتحديث… + اترك للتحديث… + تحميل… + diff --git a/library/res/values-cs/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-cs/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml index a8f0acea7..c878da0cf --- a/library/res/values-cs/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-cs/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Tažením aktualizujete… - Uvolněním aktualizujete… - Načítání… - + + + Tažením aktualizujete… + Uvolněním aktualizujete… + Načítání… + diff --git a/library/res/values-de/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-de/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml index 3f773deb0..901291bfa --- a/library/res/values-de/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-de/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Ziehen zum Aktualisieren… - Loslassen zum Aktualisieren… - Laden… - + + + Ziehen zum Aktualisieren… + Loslassen zum Aktualisieren… + Laden… + diff --git a/library/res/values-es/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-es/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml index 6f85c1008..5e9d2803a --- a/library/res/values-es/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-es/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Tirar para actualizar… - Soltar para actualizar… - Cargando… - + + + Tirar para actualizar… + Soltar para actualizar… + Cargando… + diff --git a/library/res/values-fi/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-fi/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 100% rename from library/res/values-fi/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-fi/pull_refresh_strings.xml diff --git a/library/res/values-fr/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-fr/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml index e59f07eca..fb53ef8c4 --- a/library/res/values-fr/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-fr/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Tirez pour rafraîchir… - Relâcher pour rafraîchir… - Chargement… - + + + Tirez pour rafraîchir… + Relâcher pour rafraîchir… + Chargement… + diff --git a/library/res/values-he/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml similarity index 98% rename from library/res/values-he/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml index f22f7853f..beedc1f6e 100644 --- a/library/res/values-he/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-he/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - משוך לרענון… - שחרר לרענון… - טוען… - + + + משוך לרענון… + שחרר לרענון… + טוען… + diff --git a/library/res/values-it/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-it/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml index 9eaa74955..415fb9ed9 --- a/library/res/values-it/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-it/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Tira per aggiornare… - Rilascia per aggionare… - Caricamento… - + + + Tira per aggiornare… + Rilascia per aggionare… + Caricamento… + diff --git a/library/res/values-iw/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml similarity index 98% rename from library/res/values-iw/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml index f22f7853f..beedc1f6e 100644 --- a/library/res/values-iw/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-iw/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - משוך לרענון… - שחרר לרענון… - טוען… - + + + משוך לרענון… + שחרר לרענון… + טוען… + diff --git a/library/res/values-ja/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml similarity index 98% rename from library/res/values-ja/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml index 124154433..d24842c9b 100644 --- a/library/res/values-ja/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-ja/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - 画面を引っ張って… - 指を離して更新… - 読み込み中… - + + + 画面を引っ張って… + 指を離して更新… + 読み込み中… + diff --git a/library/res/values-ko/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-ko/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml index 15d86d4dd..53edd592a --- a/library/res/values-ko/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-ko/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - 당겨서 새로 고침… - 놓아서 새로 고침… - 로드 중… - + + + 당겨서 새로 고침… + 놓아서 새로 고침… + 로드 중… + diff --git a/library/res/values-nl/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-nl/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml index 0701c9b47..4c063ed98 --- a/library/res/values-nl/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-nl/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Sleep om te vernieuwen… - Loslaten om te vernieuwen… - Laden… - + + + Sleep om te vernieuwen… + Loslaten om te vernieuwen… + Laden… + diff --git a/library/res/values-pl/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-pl/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml index 7d474c189..007255a2e --- a/library/res/values-pl/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-pl/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Pociągnij, aby odświeżyć… - Puść, aby odświeżyć… - Wczytywanie… - + + + Pociągnij, aby odświeżyć… + Puść, aby odświeżyć… + Wczytywanie… + diff --git a/library/res/values-pt-rBR/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-pt-rBR/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml index 1a4359a86..0ec1ef7fe --- a/library/res/values-pt-rBR/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-pt-rBR/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Puxe para atualizar… - Libere para atualizar… - Carregando… - + + + Puxe para atualizar… + Libere para atualizar… + Carregando… + diff --git a/library/res/values-pt/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-pt/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml index 71eea31ac..d08bc63b0 --- a/library/res/values-pt/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-pt/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Puxe para atualizar… - Liberação para atualizar… - A carregar… - + + + Puxe para atualizar… + Liberação para atualizar… + A carregar… + diff --git a/library/res/values-ro/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml similarity index 98% rename from library/res/values-ro/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml index c89e80a98..87ddc941f 100644 --- a/library/res/values-ro/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-ro/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Trage pentru a reîmprospăta… - Eliberează pentru a reîmprospăta… - Încărcare… - + + + Trage pentru a reîmprospăta… + Eliberează pentru a reîmprospăta… + Încărcare… + diff --git a/library/res/values-ru/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 98% rename from library/res/values-ru/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml index ca364ff8e..71ddcda71 --- a/library/res/values-ru/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-ru/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - Потяните для обновления… - Отпустите для обновления… - Загрузка… - + + + Потяните для обновления… + Отпустите для обновления… + Загрузка… + diff --git a/library/res/values-zh/pull_refresh_strings.xml b/pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml old mode 100755 new mode 100644 similarity index 97% rename from library/res/values-zh/pull_refresh_strings.xml rename to pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml index 397376be9..08766e0b8 --- a/library/res/values-zh/pull_refresh_strings.xml +++ b/pulltorefresh/src/main/res/values-zh/pull_refresh_strings.xml @@ -1,6 +1,6 @@ - - - 下拉刷新… - 放开以刷新… - 正在载入… - + + + 下拉刷新… + 放开以刷新… + 正在载入… + diff --git a/library/res/values/attrs.xml b/pulltorefresh/src/main/res/values/attrs.xml similarity index 91% rename from library/res/values/attrs.xml rename to pulltorefresh/src/main/res/values/attrs.xml index a3408ae7d..38b0543e4 100644 --- a/library/res/values/attrs.xml +++ b/pulltorefresh/src/main/res/values/attrs.xml @@ -65,6 +65,13 @@ --> + + + diff --git a/sample/assets/ptr_webview2_sample.html b/sample/src/main/assets/ptr_webview2_sample.html similarity index 100% rename from sample/assets/ptr_webview2_sample.html rename to sample/src/main/assets/ptr_webview2_sample.html diff --git a/sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/LauncherActivity.java similarity index 92% rename from sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/LauncherActivity.java index 8eb47bc91..b2ab8e9e0 100644 --- a/sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/LauncherActivity.java @@ -22,10 +22,11 @@ import android.widget.ArrayAdapter; import android.widget.ListView; -public class LauncherActivity extends ListActivity { +public class LauncherActivity extends ListActivity { public static final String[] options = { "ListView", "ExpandableListView", "GridView", "WebView", "ScrollView", - "Horizontal ScrollView", "ViewPager", "ListView Fragment", "WebView Advanced", "ListView in ViewPager" }; + "Horizontal ScrollView", "ViewPager", "ListView Fragment", "WebView Advanced", "ListView in ViewPager", + "RecyclerView"}; @Override protected void onCreate(Bundle savedInstanceState) { @@ -69,6 +70,9 @@ protected void onListItemClick(ListView l, View v, int position, long id) { case 9: intent = new Intent(this, PullToRefreshListInViewPagerActivity.class); break; + case 10: + intent = new Intent(this, PullToRefreshRecycleActivity.class); + break; } startActivity(intent); diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java similarity index 100% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java similarity index 100% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java similarity index 100% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java old mode 100755 new mode 100644 similarity index 91% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java index 13b572ea2..ba692f952 --- a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java @@ -32,13 +32,14 @@ import android.widget.ListView; import android.widget.Toast; +import com.handmark.pulltorefresh.library.extras.SoundPullEventListener; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnLastItemVisibleListener; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; import com.handmark.pulltorefresh.library.PullToRefreshBase.State; import com.handmark.pulltorefresh.library.PullToRefreshListView; -import com.handmark.pulltorefresh.library.extras.SoundPullEventListener; +import com.handmark.pulltorefresh.samples.loadinglayout.JingDongHeaderLayout; public final class PullToRefreshListActivity extends ListActivity { @@ -58,6 +59,12 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_ptr_list); mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list); + mPullRefreshListView.setHeaderLayout(new JingDongHeaderLayout(this)); + // 使用第二底部加载布局,要先禁止掉包含(Mode.PULL_FROM_END)的模式 + // 如修改(Mode.BOTH为Mode.PULL_FROM_START) + // 修改(Mode.PULL_FROM_END 为Mode.DISABLE) + mPullRefreshListView.setSecondFooterLayout(new JingDongHeaderLayout(this, Mode.PULL_FROM_END)); + mPullRefreshListView.setHasPullUpFriction(false); // 设置没有上拉阻力 // Set a listener to be invoked when the list should be refreshed. mPullRefreshListView.setOnRefreshListener(new OnRefreshListener() { @@ -92,7 +99,7 @@ public void onLastItemVisible() { mListItems.addAll(Arrays.asList(mStrings)); mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mListItems); - + mAdapter.notifyDataSetChanged(); /** * Add Sound Event Listener */ @@ -121,7 +128,9 @@ protected String[] doInBackground(Void... params) { @Override protected void onPostExecute(String[] result) { - mListItems.addFirst("Added after refresh..."); +// mListItems.addFirst("Added after refresh..."); + mListItems.addLast("Added after refresh..."); + mListItems.addLast("Added after refresh..."); mAdapter.notifyDataSetChanged(); // Call onRefreshComplete when the list has been refreshed. diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java similarity index 97% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java index 4361c6040..cdea88ad0 100644 --- a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java @@ -24,7 +24,7 @@ import android.widget.ArrayAdapter; import android.widget.ListView; -import com.handmark.pulltorefresh.extras.listfragment.PullToRefreshListFragment; +import com.handmark.pulltorefresh.library.extras.listfragment.PullToRefreshListFragment; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; import com.handmark.pulltorefresh.library.PullToRefreshListView; diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java similarity index 100% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java diff --git a/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshRecycleActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshRecycleActivity.java new file mode 100644 index 000000000..d2aef7eef --- /dev/null +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshRecycleActivity.java @@ -0,0 +1,165 @@ +package com.handmark.pulltorefresh.samples; + +import java.util.Arrays; +import java.util.LinkedList; + +import android.app.Activity; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.RecyclerView.Adapter; +import android.support.v7.widget.RecyclerView.ViewHolder; +import android.support.v7.widget.StaggeredGridLayoutManager; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import android.widget.Toast; + +import com.handmark.pulltorefresh.library.extras.recyclerview.PullToRefreshRecyclerView; +import com.handmark.pulltorefresh.library.PullToRefreshBase; +import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; +import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2; +import com.handmark.pulltorefresh.samples.loadinglayout.JingDongHeaderLayout; + +public class PullToRefreshRecycleActivity extends Activity{ + + static final int MENU_SET_MODE = 0; + + private LinkedList mListItems; + private PullToRefreshRecyclerView mPullRefreshRecyclerView; + private RecyclerView mRecyclerView; + private RecyclerViewAdapter mAdapter; + + private String[] mStrings = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", + "Acorn", "Adelost", "Kevin" }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_ptr_recycler); + mPullRefreshRecyclerView = (PullToRefreshRecyclerView) this.findViewById(R.id.pull_refresh_recycler); + mPullRefreshRecyclerView.setHeaderLayout(new JingDongHeaderLayout(this)); + mPullRefreshRecyclerView.setHasPullUpFriction(false); // 设置没有上拉阻力 + + mRecyclerView = mPullRefreshRecyclerView.getRefreshableView(); +// mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); + mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL)); + + // Set a listener to be invoked when the list should be refreshed. + mPullRefreshRecyclerView.setOnRefreshListener(new OnRefreshListener2() { + + @Override + public void onPullDownToRefresh(PullToRefreshBase refreshView) { + Toast.makeText(PullToRefreshRecycleActivity.this, "Pull Down!", Toast.LENGTH_SHORT).show(); + new GetDataTask().execute(); + } + + @Override + public void onPullUpToRefresh(PullToRefreshBase refreshView) { + Toast.makeText(PullToRefreshRecycleActivity.this, "Pull Up!", Toast.LENGTH_SHORT).show(); + new GetDataTask().execute(); + } + }); + + mListItems = new LinkedList(); + mListItems.addAll(Arrays.asList(mStrings)); + mAdapter = new RecyclerViewAdapter(); + mRecyclerView.setAdapter(mAdapter); + + } + + private class GetDataTask extends AsyncTask { + + @Override + protected String[] doInBackground(Void... params) { + // Simulates a background job. + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + } + return mStrings; + } + + @Override + protected void onPostExecute(String[] result) { + mListItems.addFirst("Added after refresh..."); + mListItems.addAll(Arrays.asList(result)); + mAdapter.notifyDataSetChanged(); + + // Call onRefreshComplete when the list has been refreshed. + mPullRefreshRecyclerView.onRefreshComplete(); + + super.onPostExecute(result); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, MENU_SET_MODE, 0, + mPullRefreshRecyclerView.getMode() == Mode.BOTH ? "Change to MODE_PULL_DOWN" + : "Change to MODE_PULL_BOTH"); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + MenuItem setModeItem = menu.findItem(MENU_SET_MODE); + setModeItem.setTitle(mPullRefreshRecyclerView.getMode() == Mode.BOTH ? "Change to MODE_PULL_FROM_START" + : "Change to MODE_PULL_BOTH"); + + return super.onPrepareOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case MENU_SET_MODE: + mPullRefreshRecyclerView + .setMode(mPullRefreshRecyclerView.getMode() == Mode.BOTH ? Mode.PULL_FROM_START + : Mode.BOTH); + break; + } + + return super.onOptionsItemSelected(item); + } + + + class RecyclerViewAdapter extends Adapter { + + @Override + public int getItemCount() { + return mListItems.size(); + } + + @Override + public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + MyViewHolder holder = new MyViewHolder(LayoutInflater.from( + PullToRefreshRecycleActivity.this).inflate(android.R.layout.simple_list_item_1, parent, + false)); + return holder; + } + + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + ((MyViewHolder)holder).tv.setText(mListItems.get(position)); + int bg = Color.rgb((int) Math.floor(Math.random() * 128) + 64, + (int) Math.floor(Math.random() * 128) + 64, + (int) Math.floor(Math.random() * 128) + 64); + ((MyViewHolder)holder).tv.setBackgroundColor(bg); + } + + class MyViewHolder extends ViewHolder { + TextView tv; + public MyViewHolder(View view) { + super(view); + tv = (TextView) view.findViewById(android.R.id.text1); + } + } + + } + +} diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java similarity index 89% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java index 008b920de..fdf2afc99 100644 --- a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java @@ -23,6 +23,7 @@ import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; import com.handmark.pulltorefresh.library.PullToRefreshScrollView; +import com.handmark.pulltorefresh.samples.loadinglayout.JingDongHeaderLayout; public final class PullToRefreshScrollViewActivity extends Activity { @@ -36,6 +37,9 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_ptr_scrollview); mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.pull_refresh_scrollview); + mPullRefreshScrollView.setHeaderLayout(new JingDongHeaderLayout(this)); + mPullRefreshScrollView.setFooterLayout(new JingDongHeaderLayout(this, PullToRefreshBase.Mode.PULL_FROM_END)); + mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener() { @Override diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java similarity index 97% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java index df05fddc4..215cfeae3 100644 --- a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java @@ -25,7 +25,7 @@ import android.view.ViewGroup.LayoutParams; import android.widget.ImageView; -import com.handmark.pulltorefresh.extras.viewpager.PullToRefreshViewPager; +import com.handmark.pulltorefresh.library.extras.viewpager.PullToRefreshViewPager; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java similarity index 97% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java index 786f1954d..d35a3fa50 100644 --- a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java @@ -20,9 +20,9 @@ import android.webkit.WebView; import android.webkit.WebViewClient; +import com.handmark.pulltorefresh.library.extras.PullToRefreshWebView2; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.extras.PullToRefreshWebView2; public final class PullToRefreshWebView2Activity extends Activity implements OnRefreshListener { @@ -41,7 +41,7 @@ public void onCreate(Bundle savedInstanceState) { // We just load a prepared HTML page from the assets folder for this // sample, see that file for the Javascript implementation - webView.loadUrl("file:///android_asset/ptr_webview2_sample.html"); + webView.loadUrl("file:///android_asset/e.html"); } private static class SampleWebViewClient extends WebViewClient { diff --git a/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java similarity index 100% rename from sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java rename to sample/src/main/java/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java diff --git a/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/JingDongHeaderLayout.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/JingDongHeaderLayout.java new file mode 100644 index 000000000..ce197e0fa --- /dev/null +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/JingDongHeaderLayout.java @@ -0,0 +1,159 @@ +package com.handmark.pulltorefresh.samples.loadinglayout; + +import android.animation.ObjectAnimator; +import android.content.Context; +import android.graphics.Typeface; +import android.graphics.drawable.AnimationDrawable; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import com.handmark.pulltorefresh.library.PullToRefreshBase; +import com.handmark.pulltorefresh.library.LoadingLayoutBase; +import com.handmark.pulltorefresh.samples.R; +import com.nineoldandroids.view.ViewHelper; + +/** + * Created by zwenkai on 2015/12/19. + */ +public class JingDongHeaderLayout extends LoadingLayoutBase{ + + static final String LOG_TAG = "PullToRefresh-JingDongHeaderLayout"; + + private FrameLayout mInnerLayout; + + private final TextView mHeaderText; + private final TextView mSubHeaderText; + + private CharSequence mPullLabel; + private CharSequence mRefreshingLabel; + private CharSequence mReleaseLabel; + + private ImageView mGoodsImage; + private ImageView mPersonImage; + private AnimationDrawable animP; + + public JingDongHeaderLayout(Context context) { + this(context, PullToRefreshBase.Mode.PULL_FROM_START); + } + + public JingDongHeaderLayout(Context context, PullToRefreshBase.Mode mode) { + super(context); + + LayoutInflater.from(context).inflate(R.layout.jingdong_header_loadinglayout, this); + + mInnerLayout = (FrameLayout) findViewById(R.id.fl_inner); + mHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_text); + mSubHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_sub_text); + mGoodsImage = (ImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_goods); + mPersonImage = (ImageView) mInnerLayout.findViewById(R.id.pull_to_refresh_people); + + LayoutParams lp = (LayoutParams) mInnerLayout.getLayoutParams(); + lp.gravity = mode == PullToRefreshBase.Mode.PULL_FROM_END ? Gravity.TOP : Gravity.BOTTOM; + + // Load in labels + mPullLabel = "下拉可以刷新"; + mRefreshingLabel = "正在加载中"; + mReleaseLabel = "松开后刷新"; + + reset(); + } + + @Override + public final int getContentSize() { + return mInnerLayout.getHeight(); + } + + @Override + public final void pullToRefresh() { + mSubHeaderText.setText(mPullLabel); + } + + @Override + public final void onPull(float scaleOfLayout) { + scaleOfLayout = scaleOfLayout > 1.0f ? 1.0f : scaleOfLayout; + + if (mGoodsImage.getVisibility() != View.VISIBLE) { + mGoodsImage.setVisibility(View.VISIBLE); + } + + //透明度动画 + ObjectAnimator animAlphaP = ObjectAnimator.ofFloat(mPersonImage, "alpha", -1, 1).setDuration(300); + animAlphaP.setCurrentPlayTime((long) (scaleOfLayout * 300)); + ObjectAnimator animAlphaG = ObjectAnimator.ofFloat(mGoodsImage, "alpha", -1, 1).setDuration(300); + animAlphaG.setCurrentPlayTime((long) (scaleOfLayout * 300)); + + //缩放动画 + ViewHelper.setPivotX(mPersonImage, 0); // 设置中心点 + ViewHelper.setPivotY(mPersonImage, 0); + ObjectAnimator animPX = ObjectAnimator.ofFloat(mPersonImage, "scaleX", 0, 1).setDuration(300); + animPX.setCurrentPlayTime((long) (scaleOfLayout * 300)); + ObjectAnimator animPY = ObjectAnimator.ofFloat(mPersonImage, "scaleY", 0, 1).setDuration(300); + animPY.setCurrentPlayTime((long) (scaleOfLayout * 300)); + + ViewHelper.setPivotX(mGoodsImage, mGoodsImage.getMeasuredWidth()); + ObjectAnimator animGX = ObjectAnimator.ofFloat(mGoodsImage, "scaleX", 0, 1).setDuration(300); + animGX.setCurrentPlayTime((long) (scaleOfLayout * 300)); + ObjectAnimator animGY = ObjectAnimator.ofFloat(mGoodsImage, "scaleY", 0, 1).setDuration(300); + animGY.setCurrentPlayTime((long) (scaleOfLayout * 300)); + } + + @Override + public final void refreshing() { + mSubHeaderText.setText(mRefreshingLabel); + + if (animP == null) { + mPersonImage.setImageResource(R.drawable.refreshing_anim); + animP = (AnimationDrawable) mPersonImage.getDrawable(); + } + animP.start(); + if (mGoodsImage.getVisibility() == View.VISIBLE) { + mGoodsImage.setVisibility(View.INVISIBLE); + } + } + + @Override + public final void releaseToRefresh() { + mSubHeaderText.setText(mReleaseLabel); + } + + @Override + public final void reset() { + if (animP != null) { + animP.stop(); + animP = null; + } + mPersonImage.setImageResource(R.drawable.app_refresh_people_0); + if (mGoodsImage.getVisibility() == View.VISIBLE) { + mGoodsImage.setVisibility(View.INVISIBLE); + } + } + + @Override + public void setLastUpdatedLabel(CharSequence label) { + mSubHeaderText.setText(label); + } + + @Override + public void setPullLabel(CharSequence pullLabel) { + mPullLabel = pullLabel; + } + + @Override + public void setRefreshingLabel(CharSequence refreshingLabel) { + mRefreshingLabel = refreshingLabel; + } + + @Override + public void setReleaseLabel(CharSequence releaseLabel) { + mReleaseLabel = releaseLabel; + } + + @Override + public void setTextTypeface(Typeface tf) { + mHeaderText.setTypeface(tf); + } +} \ No newline at end of file diff --git a/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/SecondFooterLayout.java b/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/SecondFooterLayout.java new file mode 100644 index 000000000..7c4129f44 --- /dev/null +++ b/sample/src/main/java/com/handmark/pulltorefresh/samples/loadinglayout/SecondFooterLayout.java @@ -0,0 +1,33 @@ +package com.handmark.pulltorefresh.samples.loadinglayout; + +import android.content.Context; +import android.view.LayoutInflater; +import android.widget.FrameLayout; +import android.widget.TextView; + +import com.handmark.pulltorefresh.samples.R; + +/** + * Created by zwenkai on 2016/4/10. + */ +public class SecondFooterLayout extends FrameLayout { + + private FrameLayout mInnerLayout; + private final TextView mHasDataText; + private final TextView mNoDataText; + + public SecondFooterLayout(Context context) { + super(context); + + LayoutInflater.from(context).inflate(R.layout.listview_footer_second_loadinglayout, this); + + mInnerLayout = (FrameLayout) findViewById(R.id.fl_inner); + mHasDataText = (TextView) mInnerLayout.findViewById(R.id.second_footer_has_data); + mNoDataText = (TextView) mInnerLayout.findViewById(R.id.second_footer_no_data); + } + + public void setNoData() { + mHasDataText.setVisibility(GONE); + mNoDataText.setVisibility(VISIBLE); + } +} \ No newline at end of file diff --git a/sample/res/drawable-hdpi/android.png b/sample/src/main/res/drawable-hdpi/android.png similarity index 100% rename from sample/res/drawable-hdpi/android.png rename to sample/src/main/res/drawable-hdpi/android.png diff --git a/sample/res/drawable-hdpi/icon.png b/sample/src/main/res/drawable-hdpi/icon.png old mode 100755 new mode 100644 similarity index 100% rename from sample/res/drawable-hdpi/icon.png rename to sample/src/main/res/drawable-hdpi/icon.png diff --git a/sample/res/drawable-ldpi/icon.png b/sample/src/main/res/drawable-ldpi/icon.png old mode 100755 new mode 100644 similarity index 100% rename from sample/res/drawable-ldpi/icon.png rename to sample/src/main/res/drawable-ldpi/icon.png diff --git a/sample/res/drawable-mdpi/icon.png b/sample/src/main/res/drawable-mdpi/icon.png old mode 100755 new mode 100644 similarity index 100% rename from sample/res/drawable-mdpi/icon.png rename to sample/src/main/res/drawable-mdpi/icon.png diff --git a/sample/res/drawable-nodpi/wallpaper.jpg b/sample/src/main/res/drawable-nodpi/wallpaper.jpg similarity index 100% rename from sample/res/drawable-nodpi/wallpaper.jpg rename to sample/src/main/res/drawable-nodpi/wallpaper.jpg diff --git a/sample/res/drawable-xhdpi/android.png b/sample/src/main/res/drawable-xhdpi/android.png similarity index 100% rename from sample/res/drawable-xhdpi/android.png rename to sample/src/main/res/drawable-xhdpi/android.png diff --git a/sample/src/main/res/drawable-xhdpi/app_refresh_goods_0.png b/sample/src/main/res/drawable-xhdpi/app_refresh_goods_0.png new file mode 100644 index 000000000..664c80b3e Binary files /dev/null and b/sample/src/main/res/drawable-xhdpi/app_refresh_goods_0.png differ diff --git a/sample/src/main/res/drawable-xhdpi/app_refresh_people_0.png b/sample/src/main/res/drawable-xhdpi/app_refresh_people_0.png new file mode 100644 index 000000000..4ad3e6cff Binary files /dev/null and b/sample/src/main/res/drawable-xhdpi/app_refresh_people_0.png differ diff --git a/sample/src/main/res/drawable-xhdpi/app_refresh_people_1.png b/sample/src/main/res/drawable-xhdpi/app_refresh_people_1.png new file mode 100644 index 000000000..d082e6829 Binary files /dev/null and b/sample/src/main/res/drawable-xhdpi/app_refresh_people_1.png differ diff --git a/sample/src/main/res/drawable-xhdpi/app_refresh_people_2.png b/sample/src/main/res/drawable-xhdpi/app_refresh_people_2.png new file mode 100644 index 000000000..688e51583 Binary files /dev/null and b/sample/src/main/res/drawable-xhdpi/app_refresh_people_2.png differ diff --git a/sample/src/main/res/drawable-xhdpi/app_refresh_people_3.png b/sample/src/main/res/drawable-xhdpi/app_refresh_people_3.png new file mode 100644 index 000000000..12f307a56 Binary files /dev/null and b/sample/src/main/res/drawable-xhdpi/app_refresh_people_3.png differ diff --git a/sample/res/drawable/icon.png b/sample/src/main/res/drawable/icon.png old mode 100755 new mode 100644 similarity index 100% rename from sample/res/drawable/icon.png rename to sample/src/main/res/drawable/icon.png diff --git a/sample/src/main/res/drawable/refreshing_anim.xml b/sample/src/main/res/drawable/refreshing_anim.xml new file mode 100644 index 000000000..39416529f --- /dev/null +++ b/sample/src/main/res/drawable/refreshing_anim.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/sample/res/layout/activity_ptr_expandable_list.xml b/sample/src/main/res/layout/activity_ptr_expandable_list.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_expandable_list.xml rename to sample/src/main/res/layout/activity_ptr_expandable_list.xml diff --git a/sample/res/layout/activity_ptr_grid.xml b/sample/src/main/res/layout/activity_ptr_grid.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_grid.xml rename to sample/src/main/res/layout/activity_ptr_grid.xml diff --git a/sample/src/main/res/layout/activity_ptr_header_recycler.xml b/sample/src/main/res/layout/activity_ptr_header_recycler.xml new file mode 100644 index 000000000..8501394fe --- /dev/null +++ b/sample/src/main/res/layout/activity_ptr_header_recycler.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/sample/res/layout/activity_ptr_horizontalscrollview.xml b/sample/src/main/res/layout/activity_ptr_horizontalscrollview.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_horizontalscrollview.xml rename to sample/src/main/res/layout/activity_ptr_horizontalscrollview.xml diff --git a/sample/res/layout/activity_ptr_list.xml b/sample/src/main/res/layout/activity_ptr_list.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_list.xml rename to sample/src/main/res/layout/activity_ptr_list.xml diff --git a/sample/res/layout/activity_ptr_list_fragment.xml b/sample/src/main/res/layout/activity_ptr_list_fragment.xml similarity index 77% rename from sample/res/layout/activity_ptr_list_fragment.xml rename to sample/src/main/res/layout/activity_ptr_list_fragment.xml index e3cf94b40..34e109c6e 100644 --- a/sample/res/layout/activity_ptr_list_fragment.xml +++ b/sample/src/main/res/layout/activity_ptr_list_fragment.xml @@ -5,7 +5,7 @@ diff --git a/sample/res/layout/activity_ptr_list_in_vp.xml b/sample/src/main/res/layout/activity_ptr_list_in_vp.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_list_in_vp.xml rename to sample/src/main/res/layout/activity_ptr_list_in_vp.xml diff --git a/sample/src/main/res/layout/activity_ptr_recycler.xml b/sample/src/main/res/layout/activity_ptr_recycler.xml new file mode 100644 index 000000000..b893bb531 --- /dev/null +++ b/sample/src/main/res/layout/activity_ptr_recycler.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/sample/res/layout/activity_ptr_scrollview.xml b/sample/src/main/res/layout/activity_ptr_scrollview.xml old mode 100755 new mode 100644 similarity index 100% rename from sample/res/layout/activity_ptr_scrollview.xml rename to sample/src/main/res/layout/activity_ptr_scrollview.xml diff --git a/sample/res/layout/activity_ptr_viewpager.xml b/sample/src/main/res/layout/activity_ptr_viewpager.xml old mode 100755 new mode 100644 similarity index 88% rename from sample/res/layout/activity_ptr_viewpager.xml rename to sample/src/main/res/layout/activity_ptr_viewpager.xml index 03c8eee7b..c29ea8b8e --- a/sample/res/layout/activity_ptr_viewpager.xml +++ b/sample/src/main/res/layout/activity_ptr_viewpager.xml @@ -5,7 +5,7 @@ - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/res/layout/layout_listview_in_viewpager.xml b/sample/src/main/res/layout/layout_listview_in_viewpager.xml similarity index 100% rename from sample/res/layout/layout_listview_in_viewpager.xml rename to sample/src/main/res/layout/layout_listview_in_viewpager.xml diff --git a/sample/src/main/res/layout/layout_swiplistview_item.xml b/sample/src/main/res/layout/layout_swiplistview_item.xml new file mode 100644 index 000000000..a12d36227 --- /dev/null +++ b/sample/src/main/res/layout/layout_swiplistview_item.xml @@ -0,0 +1,74 @@ + + + + + + + +