diff --git a/Android-PullToRefresh/.gitignore b/Android-PullToRefresh/.gitignore deleted file mode 100644 index 6a1f3548..00000000 --- a/Android-PullToRefresh/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -#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 -.DS_Store diff --git a/Android-PullToRefresh/LICENSE b/Android-PullToRefresh/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/README.md b/Android-PullToRefresh/README.md deleted file mode 100644 index b05891dd..00000000 --- a/Android-PullToRefresh/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED - -* * * - -# Pull To Refresh Views for Android - -![Screenshot](https://github.com/chrisbanes/Android-PullToRefresh/raw/master/header_graphic.png) - -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. - -## 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** - * **ExpandableListView** - * **GridView** - * **WebView** - * **ScrollView** - * **HorizontalScrollView** - * **ViewPager** - * 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! - -Repository at . - -## Sample Application -The sample application (the source is in the repository) has been published onto Google Play for easy access: - -[![Get it on Google Play](http://www.android.com/images/brand/get_it_on_play_logo_small.png)](http://play.google.com/store/apps/details?id=com.handmark.pulltorefresh.samples) - -## Usage -To begin using the library, please see the [Quick Start Guide](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Quick-Start-Guide) page. - -### Customisation -Please see the [Customisation](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Customisation) page for more information on how to change the behaviour and look of the View. - -### Pull Up to Refresh -By default this library is set to Pull Down to Refresh, but if you want to allow Pulling Up to Refresh then you can do so. You can even set the View to enable both Pulling Up and Pulling Down using the 'both' setting. See the [Customisation](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Customisation) page for more information on how to set this. - -## Apps -Want to see which Apps are already using Android-PullToRefresh? Have a look [here](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Apps). If you have an App which is not on the list, [let me know](http://www.senab.co.uk/contact/). - -## Changelog -Please see the new [Changelog](https://github.com/chrisbanes/Android-PullToRefresh/wiki/Changelog) page to see what's recently changed. - -## Pull Requests - -I will gladly accept pull requests for fixes and feature enhancements but please do them in the dev branch. The master branch is for the latest stable code, dev is where I try things out before releasing them as stable. Any pull requests that are against master from now on will be closed asking for you to do another pull against dev. - -## Acknowledgments - -* [Stefano Dacchille](https://github.com/stefanodacchille) -* [Steve Lhomme](https://github.com/robUx4) -* [Maxim Galkin](https://github.com/mgalkin) -* [Scorcher](https://github.com/Scorcher) - - -## License - - 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. \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/AndroidManifest.xml b/Android-PullToRefresh/extras/PullToRefreshListFragment/AndroidManifest.xml deleted file mode 100644 index 6745733d..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshListFragment/AndroidManifest.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/LICENSE b/Android-PullToRefresh/extras/PullToRefreshListFragment/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshListFragment/libs/android-support-v4.jar b/Android-PullToRefresh/extras/PullToRefreshListFragment/libs/android-support-v4.jar deleted file mode 100644 index feaf44f8..00000000 Binary files a/Android-PullToRefresh/extras/PullToRefreshListFragment/libs/android-support-v4.jar and /dev/null differ diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/pom.xml b/Android-PullToRefresh/extras/PullToRefreshListFragment/pom.xml deleted file mode 100644 index b67c8bbe..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshListFragment/project.properties b/Android-PullToRefresh/extras/PullToRefreshListFragment/project.properties deleted file mode 100644 index 927fba41..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml b/Android-PullToRefresh/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml deleted file mode 100644 index f59ab878..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshListFragment/res/layout/need_this_for_maven.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java b/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java deleted file mode 100644 index 4350f925..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * 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.extras.listfragment; - -import android.os.Bundle; -import android.support.v4.app.ListFragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AbsListView; -import android.widget.ListView; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; - -abstract class PullToRefreshBaseListFragment> extends ListFragment { - - private T mPullToRefreshListView; - - @Override - public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View layout = super.onCreateView(inflater, container, savedInstanceState); - - ListView lv = (ListView) layout.findViewById(android.R.id.list); - ViewGroup parent = (ViewGroup) lv.getParent(); - - // Remove ListView and add PullToRefreshListView in its place - int lvIndex = parent.indexOfChild(lv); - parent.removeViewAt(lvIndex); - mPullToRefreshListView = onCreatePullToRefreshListView(inflater, savedInstanceState); - parent.addView(mPullToRefreshListView, lvIndex, lv.getLayoutParams()); - - return layout; - } - - /** - * @return The {@link PullToRefreshBase} attached to this ListFragment. - */ - public final T getPullToRefreshListView() { - return mPullToRefreshListView; - } - - /** - * Returns the {@link PullToRefreshBase} which will replace the ListView - * created from ListFragment. You should override this method if you wish to - * customise the {@link PullToRefreshBase} from the default. - * - * @param inflater - LayoutInflater which can be used to inflate from XML. - * @param savedInstanceState - Bundle passed through from - * {@link ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle) - * onCreateView(...)} - * @return The {@link PullToRefreshBase} which will replace the ListView. - */ - protected abstract T onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState); - -} \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java b/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java deleted file mode 100644 index aca73a3e..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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.extras.listfragment; - -import android.os.Bundle; -import android.support.v4.app.ListFragment; -import android.view.LayoutInflater; - -import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView; - -/** - * A sample implementation of how to use {@link PullToRefreshExpandableListView} - * with {@link 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 - * method and return your customised instance. - * - * @author Chris Banes - * - */ -public class PullToRefreshExpandableListFragment extends PullToRefreshBaseListFragment { - - protected PullToRefreshExpandableListView onCreatePullToRefreshListView(LayoutInflater inflater, - Bundle savedInstanceState) { - return new PullToRefreshExpandableListView(getActivity()); - } - -} \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java b/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java deleted file mode 100644 index e544797f..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshListFragment/src/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * 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.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 - * {@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 - * return your customised instance. - * - * @author Chris Banes - * - */ -public class PullToRefreshListFragment extends PullToRefreshBaseListFragment { - - protected PullToRefreshListView onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState) { - return new PullToRefreshListView(getActivity()); - } - -} \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/AndroidManifest.xml b/Android-PullToRefresh/extras/PullToRefreshViewPager/AndroidManifest.xml deleted file mode 100644 index eaffd680..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshViewPager/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/ant.properties b/Android-PullToRefresh/extras/PullToRefreshViewPager/ant.properties deleted file mode 100644 index b0971e89..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshViewPager/libs/android-support-v4.jar b/Android-PullToRefresh/extras/PullToRefreshViewPager/libs/android-support-v4.jar deleted file mode 100644 index feaf44f8..00000000 Binary files a/Android-PullToRefresh/extras/PullToRefreshViewPager/libs/android-support-v4.jar and /dev/null differ diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/pom.xml b/Android-PullToRefresh/extras/PullToRefreshViewPager/pom.xml deleted file mode 100644 index 55978777..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshViewPager/proguard-project.txt b/Android-PullToRefresh/extras/PullToRefreshViewPager/proguard-project.txt deleted file mode 100644 index f2fe1559..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshViewPager/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# 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. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/project.properties b/Android-PullToRefresh/extras/PullToRefreshViewPager/project.properties deleted file mode 100644 index 927fba41..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml b/Android-PullToRefresh/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml deleted file mode 100644 index f59ab878..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshViewPager/res/layout/need_this_for_maven.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/res/values/ids.xml b/Android-PullToRefresh/extras/PullToRefreshViewPager/res/values/ids.xml deleted file mode 100644 index 81cebf0e..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshViewPager/res/values/ids.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java b/Android-PullToRefresh/extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java deleted file mode 100644 index d5f845b3..00000000 --- a/Android-PullToRefresh/extras/PullToRefreshViewPager/src/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * 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.extras.viewpager; - -import android.content.Context; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.AttributeSet; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; - -public class PullToRefreshViewPager extends PullToRefreshBase { - - public PullToRefreshViewPager(Context context) { - super(context); - } - - public PullToRefreshViewPager(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.HORIZONTAL; - } - - @Override - protected ViewPager createRefreshableView(Context context, AttributeSet attrs) { - ViewPager viewPager = new ViewPager(context, attrs); - viewPager.setId(R.id.viewpager); - return viewPager; - } - - @Override - protected boolean isReadyForPullStart() { - ViewPager refreshableView = getRefreshableView(); - - PagerAdapter adapter = refreshableView.getAdapter(); - if (null != adapter) { - return refreshableView.getCurrentItem() == 0; - } - - return false; - } - - @Override - protected boolean isReadyForPullEnd() { - ViewPager refreshableView = getRefreshableView(); - - PagerAdapter adapter = refreshableView.getAdapter(); - if (null != adapter) { - return refreshableView.getCurrentItem() == adapter.getCount() - 1; - } - - return false; - } -} diff --git a/Android-PullToRefresh/extras/pom.xml b/Android-PullToRefresh/extras/pom.xml deleted file mode 100644 index 78cab515..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/header_graphic.png b/Android-PullToRefresh/header_graphic.png deleted file mode 100644 index bf104c30..00000000 Binary files a/Android-PullToRefresh/header_graphic.png and /dev/null differ diff --git a/Android-PullToRefresh/library/AndroidManifest.xml b/Android-PullToRefresh/library/AndroidManifest.xml deleted file mode 100644 index c3db5673..00000000 --- a/Android-PullToRefresh/library/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/LICENSE b/Android-PullToRefresh/library/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/library/library.iml b/Android-PullToRefresh/library/library.iml deleted file mode 100644 index 6c31f46b..00000000 --- a/Android-PullToRefresh/library/library.iml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Android-PullToRefresh/library/pom.xml b/Android-PullToRefresh/library/pom.xml deleted file mode 100644 index 6b48e0ad..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/library/project.properties b/Android-PullToRefresh/library/project.properties deleted file mode 100644 index e61077f7..00000000 --- a/Android-PullToRefresh/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-17 -android.library=true diff --git a/Android-PullToRefresh/library/res/anim/slide_in_from_bottom.xml b/Android-PullToRefresh/library/res/anim/slide_in_from_bottom.xml deleted file mode 100644 index bb430ce9..00000000 --- a/Android-PullToRefresh/library/res/anim/slide_in_from_bottom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/Android-PullToRefresh/library/res/anim/slide_in_from_top.xml b/Android-PullToRefresh/library/res/anim/slide_in_from_top.xml deleted file mode 100644 index 52d91afc..00000000 --- a/Android-PullToRefresh/library/res/anim/slide_in_from_top.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/Android-PullToRefresh/library/res/anim/slide_out_to_bottom.xml b/Android-PullToRefresh/library/res/anim/slide_out_to_bottom.xml deleted file mode 100644 index 83eca5ad..00000000 --- a/Android-PullToRefresh/library/res/anim/slide_out_to_bottom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/Android-PullToRefresh/library/res/anim/slide_out_to_top.xml b/Android-PullToRefresh/library/res/anim/slide_out_to_top.xml deleted file mode 100644 index 5105ae1f..00000000 --- a/Android-PullToRefresh/library/res/anim/slide_out_to_top.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_flip.png b/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_flip.png deleted file mode 100644 index 0a2c0bd9..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_flip.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_rotate.png b/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_rotate.png deleted file mode 100644 index dc641b72..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-hdpi/default_ptr_rotate.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-hdpi/indicator_arrow.png b/Android-PullToRefresh/library/res/drawable-hdpi/indicator_arrow.png deleted file mode 100644 index 8ae79770..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-hdpi/indicator_arrow.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_flip.png b/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_flip.png deleted file mode 100644 index be696c1c..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_flip.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_rotate.png b/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_rotate.png deleted file mode 100644 index 95b22bd7..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-mdpi/default_ptr_rotate.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-mdpi/indicator_arrow.png b/Android-PullToRefresh/library/res/drawable-mdpi/indicator_arrow.png deleted file mode 100644 index 20fe2c12..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-mdpi/indicator_arrow.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_flip.png b/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_flip.png deleted file mode 100644 index 3e6ddba5..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_flip.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_rotate.png b/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_rotate.png deleted file mode 100644 index 00225c9a..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-xhdpi/default_ptr_rotate.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable-xhdpi/indicator_arrow.png b/Android-PullToRefresh/library/res/drawable-xhdpi/indicator_arrow.png deleted file mode 100644 index 810ff595..00000000 Binary files a/Android-PullToRefresh/library/res/drawable-xhdpi/indicator_arrow.png and /dev/null differ diff --git a/Android-PullToRefresh/library/res/drawable/indicator_bg_bottom.xml b/Android-PullToRefresh/library/res/drawable/indicator_bg_bottom.xml deleted file mode 100644 index 81a91aa6..00000000 --- a/Android-PullToRefresh/library/res/drawable/indicator_bg_bottom.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/drawable/indicator_bg_top.xml b/Android-PullToRefresh/library/res/drawable/indicator_bg_top.xml deleted file mode 100644 index 59fa9cfe..00000000 --- a/Android-PullToRefresh/library/res/drawable/indicator_bg_top.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_horizontal.xml b/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_horizontal.xml deleted file mode 100644 index f05bb033..00000000 --- a/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_horizontal.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_vertical.xml b/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_vertical.xml deleted file mode 100644 index 2185e2d6..00000000 --- a/Android-PullToRefresh/library/res/layout/pull_to_refresh_header_vertical.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/values-ar/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-ar/pull_refresh_strings.xml deleted file mode 100644 index 5b0b571c..00000000 --- a/Android-PullToRefresh/library/res/values-ar/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - اسحب للتحديث… - اترك للتحديث… - تحميل… - diff --git a/Android-PullToRefresh/library/res/values-cs/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-cs/pull_refresh_strings.xml deleted file mode 100644 index a8f0acea..00000000 --- a/Android-PullToRefresh/library/res/values-cs/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Tažením aktualizujete… - Uvolněním aktualizujete… - Načítání… - diff --git a/Android-PullToRefresh/library/res/values-de/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-de/pull_refresh_strings.xml deleted file mode 100644 index 3f773deb..00000000 --- a/Android-PullToRefresh/library/res/values-de/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Ziehen zum Aktualisieren… - Loslassen zum Aktualisieren… - Laden… - diff --git a/Android-PullToRefresh/library/res/values-es/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-es/pull_refresh_strings.xml deleted file mode 100644 index 6f85c100..00000000 --- a/Android-PullToRefresh/library/res/values-es/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Tirar para actualizar… - Soltar para actualizar… - Cargando… - diff --git a/Android-PullToRefresh/library/res/values-fi/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-fi/pull_refresh_strings.xml deleted file mode 100644 index 0381287b..00000000 --- a/Android-PullToRefresh/library/res/values-fi/pull_refresh_strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Päivitä vetämällä alas… - Päivitä vapauttamalla… - Päivitetään… - - - Päivitä vetämällä ylös… - @string/pull_to_refresh_release_label - @string/pull_to_refresh_refreshing_label - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/values-fr/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-fr/pull_refresh_strings.xml deleted file mode 100644 index e59f07ec..00000000 --- a/Android-PullToRefresh/library/res/values-fr/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Tirez pour rafraîchir… - Relâcher pour rafraîchir… - Chargement… - diff --git a/Android-PullToRefresh/library/res/values-he/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-he/pull_refresh_strings.xml deleted file mode 100644 index f22f7853..00000000 --- a/Android-PullToRefresh/library/res/values-he/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - משוך לרענון… - שחרר לרענון… - טוען… - diff --git a/Android-PullToRefresh/library/res/values-it/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-it/pull_refresh_strings.xml deleted file mode 100644 index 9eaa7495..00000000 --- a/Android-PullToRefresh/library/res/values-it/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Tira per aggiornare… - Rilascia per aggionare… - Caricamento… - diff --git a/Android-PullToRefresh/library/res/values-iw/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-iw/pull_refresh_strings.xml deleted file mode 100644 index f22f7853..00000000 --- a/Android-PullToRefresh/library/res/values-iw/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - משוך לרענון… - שחרר לרענון… - טוען… - diff --git a/Android-PullToRefresh/library/res/values-ja/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-ja/pull_refresh_strings.xml deleted file mode 100644 index 12415443..00000000 --- a/Android-PullToRefresh/library/res/values-ja/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 画面を引っ張って… - 指を離して更新… - 読み込み中… - diff --git a/Android-PullToRefresh/library/res/values-ko/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-ko/pull_refresh_strings.xml deleted file mode 100644 index 15d86d4d..00000000 --- a/Android-PullToRefresh/library/res/values-ko/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 당겨서 새로 고침… - 놓아서 새로 고침… - 로드 중… - diff --git a/Android-PullToRefresh/library/res/values-nl/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-nl/pull_refresh_strings.xml deleted file mode 100644 index 0701c9b4..00000000 --- a/Android-PullToRefresh/library/res/values-nl/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Sleep om te vernieuwen… - Loslaten om te vernieuwen… - Laden… - diff --git a/Android-PullToRefresh/library/res/values-pl/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-pl/pull_refresh_strings.xml deleted file mode 100644 index 7d474c18..00000000 --- a/Android-PullToRefresh/library/res/values-pl/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Pociągnij, aby odświeżyć… - Puść, aby odświeżyć… - Wczytywanie… - diff --git a/Android-PullToRefresh/library/res/values-pt-rBR/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-pt-rBR/pull_refresh_strings.xml deleted file mode 100644 index 1a4359a8..00000000 --- a/Android-PullToRefresh/library/res/values-pt-rBR/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Puxe para atualizar… - Libere para atualizar… - Carregando… - diff --git a/Android-PullToRefresh/library/res/values-pt/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-pt/pull_refresh_strings.xml deleted file mode 100644 index 71eea31a..00000000 --- a/Android-PullToRefresh/library/res/values-pt/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Puxe para atualizar… - Liberação para atualizar… - A carregar… - diff --git a/Android-PullToRefresh/library/res/values-ro/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-ro/pull_refresh_strings.xml deleted file mode 100644 index c89e80a9..00000000 --- a/Android-PullToRefresh/library/res/values-ro/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Trage pentru a reîmprospăta… - Eliberează pentru a reîmprospăta… - Încărcare… - diff --git a/Android-PullToRefresh/library/res/values-ru/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-ru/pull_refresh_strings.xml deleted file mode 100644 index ca364ff8..00000000 --- a/Android-PullToRefresh/library/res/values-ru/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Потяните для обновления… - Отпустите для обновления… - Загрузка… - diff --git a/Android-PullToRefresh/library/res/values-zh/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values-zh/pull_refresh_strings.xml deleted file mode 100644 index 397376be..00000000 --- a/Android-PullToRefresh/library/res/values-zh/pull_refresh_strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 下拉刷新… - 放开以刷新… - 正在载入… - diff --git a/Android-PullToRefresh/library/res/values/attrs.xml b/Android-PullToRefresh/library/res/values/attrs.xml deleted file mode 100644 index a3408ae7..00000000 --- a/Android-PullToRefresh/library/res/values/attrs.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/values/dimens.xml b/Android-PullToRefresh/library/res/values/dimens.xml deleted file mode 100644 index 24339b5b..00000000 --- a/Android-PullToRefresh/library/res/values/dimens.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 10dp - 12dp - 4dp - 24dp - 12dp - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/values/ids.xml b/Android-PullToRefresh/library/res/values/ids.xml deleted file mode 100644 index 26c9ae76..00000000 --- a/Android-PullToRefresh/library/res/values/ids.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/res/values/pull_refresh_strings.xml b/Android-PullToRefresh/library/res/values/pull_refresh_strings.xml deleted file mode 100644 index fe48f3bc..00000000 --- a/Android-PullToRefresh/library/res/values/pull_refresh_strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Pull to refresh… - Release to refresh… - Loading… - - - @string/pull_to_refresh_pull_label - @string/pull_to_refresh_release_label - @string/pull_to_refresh_refreshing_label - - \ No newline at end of file diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java deleted file mode 100644 index ff2a9572..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/ILoadingLayout.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.handmark.pulltorefresh.library; - -import android.graphics.Typeface; -import android.graphics.drawable.Drawable; - -public interface ILoadingLayout { - - /** - * Set the Last Updated Text. This displayed under the main label when - * Pulling - * - * @param label - Label to set - */ - public void setLastUpdatedLabel(CharSequence label); - - /** - * Set the drawable used in the loading layout. This is the same as calling - * setLoadingDrawable(drawable, Mode.BOTH) - * - * @param drawable - Drawable to display - */ - public void setLoadingDrawable(Drawable drawable); - - /** - * Set Text to show when the Widget is being Pulled - * setPullLabel(releaseLabel, Mode.BOTH) - * - * @param pullLabel - CharSequence to display - */ - public void setPullLabel(CharSequence pullLabel); - - /** - * Set Text to show when the Widget is refreshing - * setRefreshingLabel(releaseLabel, Mode.BOTH) - * - * @param refreshingLabel - CharSequence to display - */ - public void setRefreshingLabel(CharSequence refreshingLabel); - - /** - * Set Text to show when the Widget is being pulled, and will refresh when - * released. This is the same as calling - * setReleaseLabel(releaseLabel, Mode.BOTH) - * - * @param releaseLabel - CharSequence to display - */ - public void setReleaseLabel(CharSequence releaseLabel); - - /** - * Set's the Sets the typeface and style in which the text should be - * displayed. Please see - * {@link android.widget.TextView#setTypeface(Typeface) - * TextView#setTypeface(Typeface)}. - */ - public void setTextTypeface(Typeface tf); - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java deleted file mode 100644 index a06cdd7c..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/IPullToRefresh.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * 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; - -import android.view.View; -import android.view.animation.Interpolator; - -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnPullEventListener; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2; -import com.handmark.pulltorefresh.library.PullToRefreshBase.State; - -public interface IPullToRefresh { - - /** - * Demos the Pull-to-Refresh functionality to the user so that they are - * aware it is there. This could be useful when the user first opens your - * app, etc. The animation will only happen if the Refresh View (ListView, - * ScrollView, etc) is in a state where a Pull-to-Refresh could occur by a - * user's touch gesture (i.e. scrolled to the top/bottom). - * - * @return true - if the Demo has been started, false if not. - */ - public boolean demo(); - - /** - * Get the mode that this view is currently in. This is only really useful - * when using Mode.BOTH. - * - * @return Mode that the view is currently in - */ - public Mode getCurrentMode(); - - /** - * Returns whether the Touch Events are filtered or not. If true is - * returned, then the View will only use touch events where the difference - * in the Y-axis is greater than the difference in the X-axis. This means - * that the View will not interfere when it is used in a horizontal - * scrolling View (such as a ViewPager). - * - * @return boolean - true if the View is filtering Touch Events - */ - public boolean getFilterTouchEvents(); - - /** - * 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. - * - * @return Object which will proxy any calls you make on it, to all of the - * LoadingLayouts. - */ - public ILoadingLayout getLoadingLayoutProxy(); - - /** - * Returns a proxy object which allows you to call methods on the - * 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. - * - * @param includeStart - Whether to include the Start/Header Views - * @param includeEnd - Whether to include the End/Footer Views - * @return Object which will proxy any calls you make on it, to the - * LoadingLayouts included. - */ - public ILoadingLayout getLoadingLayoutProxy(boolean includeStart, boolean includeEnd); - - /** - * Get the mode that this view has been set to. If this returns - * Mode.BOTH, you can use getCurrentMode() to - * check which mode the view is currently in - * - * @return Mode that the view has been set to - */ - public Mode getMode(); - - /** - * Get the Wrapped Refreshable View. Anything returned here has already been - * added to the content view. - * - * @return The View which is currently wrapped - */ - public T getRefreshableView(); - - /** - * Get whether the 'Refreshing' View should be automatically shown when - * refreshing. Returns true by default. - * - * @return - true if the Refreshing View will be show - */ - public boolean getShowViewWhileRefreshing(); - - /** - * @return - The state that the View is currently in. - */ - public State getState(); - - /** - * Whether Pull-to-Refresh is enabled - * - * @return enabled - */ - public boolean isPullToRefreshEnabled(); - - /** - * Gets whether Overscroll support is enabled. This is different to - * Android's standard Overscroll support (the edge-glow) which is available - * from GINGERBREAD onwards - * - * @return true - if both PullToRefresh-OverScroll and Android's inbuilt - * OverScroll are enabled - */ - public boolean isPullToRefreshOverScrollEnabled(); - - /** - * Returns whether the Widget is currently in the Refreshing mState - * - * @return true if the Widget is currently refreshing - */ - public boolean isRefreshing(); - - /** - * Returns whether the widget has enabled scrolling on the Refreshable View - * while refreshing. - * - * @return true if the widget has enabled scrolling while refreshing - */ - public boolean isScrollingWhileRefreshingEnabled(); - - /** - * Mark the current Refresh as complete. Will Reset the UI and hide the - * Refreshing View - */ - public void onRefreshComplete(); - - /** - * Set the Touch Events to be filtered or not. If set to true, then the View - * will only use touch events where the difference in the Y-axis is greater - * than the difference in the X-axis. This means that the View will not - * interfere when it is used in a horizontal scrolling View (such as a - * ViewPager), but will restrict which types of finger scrolls will trigger - * the View. - * - * @param filterEvents - true if you want to filter Touch Events. Default is - * true. - */ - public void setFilterTouchEvents(boolean filterEvents); - - /** - * Set the mode of Pull-to-Refresh that this view will use. - * - * @param mode - Mode to set the View to - */ - public void setMode(Mode mode); - - /** - * Set OnPullEventListener for the Widget - * - * @param listener - Listener to be used when the Widget has a pull event to - * propogate. - */ - public void setOnPullEventListener(OnPullEventListener listener); - - /** - * Set OnRefreshListener for the Widget - * - * @param listener - Listener to be used when the Widget is set to Refresh - */ - public void setOnRefreshListener(OnRefreshListener listener); - - /** - * Set OnRefreshListener for the Widget - * - * @param listener - Listener to be used when the Widget is set to Refresh - */ - public void setOnRefreshListener(OnRefreshListener2 listener); - - /** - * Sets whether Overscroll support is enabled. This is different to - * Android's standard Overscroll support (the edge-glow). This setting only - * takes effect when running on device with Android v2.3 or greater. - * - * @param enabled - true if you want Overscroll enabled - */ - public void setPullToRefreshOverScrollEnabled(boolean enabled); - - /** - * Sets the Widget to be in the refresh state. The UI will be updated to - * show the 'Refreshing' view, and be scrolled to show such. - */ - public void setRefreshing(); - - /** - * Sets the Widget to be in the refresh state. The UI will be updated to - * show the 'Refreshing' view. - * - * @param doScroll - true if you want to force a scroll to the Refreshing - * view. - */ - public void setRefreshing(boolean doScroll); - - /** - * Sets the Animation Interpolator that is used for animated scrolling. - * Defaults to a DecelerateInterpolator - * - * @param interpolator - Interpolator to use - */ - public void setScrollAnimationInterpolator(Interpolator interpolator); - - /** - * By default the Widget disables scrolling on the Refreshable View while - * refreshing. This method can change this behaviour. - * - * @param scrollingWhileRefreshingEnabled - true if you want to enable - * scrolling while refreshing - */ - public void setScrollingWhileRefreshingEnabled(boolean scrollingWhileRefreshingEnabled); - - /** - * A mutator to enable/disable whether the 'Refreshing' View should be - * automatically shown when refreshing. - * - * @param showView - */ - public void setShowViewWhileRefreshing(boolean showView); - -} \ No newline at end of file diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java deleted file mode 100644 index 5f76645d..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java +++ /dev/null @@ -1,73 +0,0 @@ -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; - -public class LoadingLayoutProxy implements ILoadingLayout { - - private final HashSet mLoadingLayouts; - - LoadingLayoutProxy() { - mLoadingLayouts = new HashSet(); - } - - /** - * This allows you to add extra LoadingLayout instances to this proxy. This - * is only necessary if you keep your own instances, and want to have them - * included in any - * {@link PullToRefreshBase#createLoadingLayoutProxy(boolean, boolean) - * createLoadingLayoutProxy(...)} calls. - * - * @param layout - LoadingLayout to have included. - */ - public void addLayout(LoadingLayout layout) { - if (null != layout) { - mLoadingLayouts.add(layout); - } - } - - @Override - public void setLastUpdatedLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setLastUpdatedLabel(label); - } - } - - @Override - public void setLoadingDrawable(Drawable drawable) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setLoadingDrawable(drawable); - } - } - - @Override - public void setRefreshingLabel(CharSequence refreshingLabel) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setRefreshingLabel(refreshingLabel); - } - } - - @Override - public void setPullLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setPullLabel(label); - } - } - - @Override - public void setReleaseLabel(CharSequence label) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setReleaseLabel(label); - } - } - - public void setTextTypeface(Typeface tf) { - for (LoadingLayout layout : mLoadingLayouts) { - layout.setTextTypeface(tf); - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java deleted file mode 100644 index 52a20de2..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/OverscrollHelper.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.util.Log; -import android.view.View; - -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.State; - -@TargetApi(9) -public final class OverscrollHelper { - - static final String LOG_TAG = "OverscrollHelper"; - static final float DEFAULT_OVERSCROLL_SCALE = 1f; - - /** - * 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). - * - * @param view - PullToRefreshView that is calling this. - * @param deltaX - Change in X in pixels, passed through from from - * overScrollBy call - * @param scrollX - Current X scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param deltaY - Change in Y in pixels, passed through from from - * overScrollBy call - * @param scrollY - Current Y scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param isTouchEvent - true if this scroll operation is the result of a - * touch event, passed through from from overScrollBy call - */ - public static void overScrollBy(final PullToRefreshBase view, final int deltaX, final int scrollX, - final int deltaY, final int scrollY, final boolean isTouchEvent) { - overScrollBy(view, deltaX, scrollX, deltaY, scrollY, 0, isTouchEvent); - } - - /** - * Helper method for Overscrolling that encapsulates all of the necessary - * function. This version of the call is used for Views that need to specify - * a Scroll Range but scroll back to it's edge correctly. - * - * @param view - PullToRefreshView that is calling this. - * @param deltaX - Change in X in pixels, passed through from from - * overScrollBy call - * @param scrollX - Current X scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param deltaY - Change in Y in pixels, passed through from from - * overScrollBy call - * @param scrollY - Current Y scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param scrollRange - Scroll Range of the View, specifically needed for - * ScrollView - * @param isTouchEvent - true if this scroll operation is the result of a - * touch event, passed through from from overScrollBy call - */ - public static void overScrollBy(final PullToRefreshBase view, final int deltaX, final int scrollX, - final int deltaY, final int scrollY, final int scrollRange, final boolean isTouchEvent) { - overScrollBy(view, deltaX, scrollX, deltaY, scrollY, scrollRange, 0, DEFAULT_OVERSCROLL_SCALE, isTouchEvent); - } - - /** - * Helper method for Overscrolling that encapsulates all of the necessary - * function. This is the advanced version of the call. - * - * @param view - PullToRefreshView that is calling this. - * @param deltaX - Change in X in pixels, passed through from from - * overScrollBy call - * @param scrollX - Current X scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param deltaY - Change in Y in pixels, passed through from from - * overScrollBy call - * @param scrollY - Current Y scroll value in pixels before applying deltaY, - * passed through from from overScrollBy call - * @param scrollRange - Scroll Range of the View, specifically needed for - * ScrollView - * @param fuzzyThreshold - Threshold for which the values how fuzzy we - * should treat the other values. Needed for WebView as it - * doesn't always scroll back to it's edge. 0 = no fuzziness. - * @param scaleFactor - Scale Factor for overscroll amount - * @param isTouchEvent - true if this scroll operation is the result of a - * touch event, passed through from from overScrollBy call - */ - public static void overScrollBy(final PullToRefreshBase view, final int deltaX, final int scrollX, - final int deltaY, final int scrollY, final int scrollRange, final int fuzzyThreshold, - final float scaleFactor, final boolean isTouchEvent) { - - final int deltaValue, currentScrollValue, scrollValue; - switch (view.getPullToRefreshScrollDirection()) { - case HORIZONTAL: - deltaValue = deltaX; - scrollValue = scrollX; - currentScrollValue = view.getScrollX(); - break; - case VERTICAL: - default: - deltaValue = deltaY; - scrollValue = scrollY; - currentScrollValue = view.getScrollY(); - break; - } - - // Check that OverScroll is enabled and that we're not currently - // refreshing. - if (view.isPullToRefreshOverScrollEnabled() && !view.isRefreshing()) { - final Mode mode = view.getMode(); - - // Check that Pull-to-Refresh is enabled, and the event isn't from - // touch - if (mode.permitsPullToRefresh() && !isTouchEvent && deltaValue != 0) { - final int newScrollValue = (deltaValue + scrollValue); - - if (PullToRefreshBase.DEBUG) { - Log.d(LOG_TAG, "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY - + ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange - + ", CurrentScroll: " + currentScrollValue); - } - - if (newScrollValue < (0 - fuzzyThreshold)) { - // Check the mode supports the overscroll direction, and - // then move scroll - if (mode.showHeaderLoadingLayout()) { - // If we're currently at zero, we're about to start - // overscrolling, so change the state - if (currentScrollValue == 0) { - view.setState(State.OVERSCROLLING); - } - - view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue))); - } - } else if (newScrollValue > (scrollRange + fuzzyThreshold)) { - // Check the mode supports the overscroll direction, and - // then move scroll - if (mode.showFooterLoadingLayout()) { - // If we're currently at zero, we're about to start - // overscrolling, so change the state - if (currentScrollValue == 0) { - view.setState(State.OVERSCROLLING); - } - - view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue - scrollRange))); - } - } else if (Math.abs(newScrollValue) <= fuzzyThreshold - || Math.abs(newScrollValue - scrollRange) <= fuzzyThreshold) { - // Means we've stopped overscrolling, so scroll back to 0 - view.setState(State.RESET); - } - } else if (isTouchEvent && State.OVERSCROLLING == view.getState()) { - // This condition means that we were overscrolling from a fling, - // but the user has touched the View and is now overscrolling - // from touch instead. We need to just reset. - view.setState(State.RESET); - } - } - } - - static boolean isAndroidOverScrollEnabled(View view) { - return view.getOverScrollMode() != View.OVER_SCROLL_NEVER; - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java deleted file mode 100644 index 4a144d0c..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java +++ /dev/null @@ -1,473 +0,0 @@ -/******************************************************************************* - * 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; - -import android.content.Context; -import android.content.res.TypedArray; -import android.util.AttributeSet; -import android.util.Log; -import android.view.Gravity; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.widget.AbsListView; -import android.widget.AbsListView.OnScrollListener; -import android.widget.Adapter; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.FrameLayout; -import android.widget.LinearLayout; -import android.widget.ListAdapter; - -import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor; -import com.handmark.pulltorefresh.library.internal.IndicatorLayout; - -public abstract class PullToRefreshAdapterViewBase extends PullToRefreshBase implements - OnScrollListener { - - private static FrameLayout.LayoutParams convertEmptyViewLayoutParams(ViewGroup.LayoutParams lp) { - FrameLayout.LayoutParams newLp = null; - - if (null != lp) { - newLp = new FrameLayout.LayoutParams(lp); - - if (lp instanceof LinearLayout.LayoutParams) { - newLp.gravity = ((LinearLayout.LayoutParams) lp).gravity; - } else { - newLp.gravity = Gravity.CENTER; - } - } - - return newLp; - } - - private boolean mLastItemVisible; - private OnScrollListener mOnScrollListener; - private OnLastItemVisibleListener mOnLastItemVisibleListener; - private View mEmptyView; - - private IndicatorLayout mIndicatorIvTop; - private IndicatorLayout mIndicatorIvBottom; - - private boolean mShowIndicator; - private boolean mScrollEmptyView = true; - - public PullToRefreshAdapterViewBase(Context context) { - super(context); - mRefreshableView.setOnScrollListener(this); - } - - public PullToRefreshAdapterViewBase(Context context, AttributeSet attrs) { - super(context, attrs); - mRefreshableView.setOnScrollListener(this); - } - - public PullToRefreshAdapterViewBase(Context context, Mode mode) { - super(context, mode); - mRefreshableView.setOnScrollListener(this); - } - - public PullToRefreshAdapterViewBase(Context context, Mode mode, AnimationStyle animStyle) { - super(context, mode, animStyle); - mRefreshableView.setOnScrollListener(this); - } - - /** - * Gets whether an indicator graphic should be displayed when the View is in - * a state where a Pull-to-Refresh can happen. An example of this state is - * when the Adapter View is scrolled to the top and the mode is set to - * {@link Mode#PULL_FROM_START}. The default value is true if - * {@link PullToRefreshBase#isPullToRefreshOverScrollEnabled() - * isPullToRefreshOverScrollEnabled()} returns false. - * - * @return true if the indicators will be shown - */ - public boolean getShowIndicator() { - return mShowIndicator; - } - - public final void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, - final int totalItemCount) { - - if (DEBUG) { - Log.d(LOG_TAG, "First Visible: " + firstVisibleItem + ". Visible Count: " + visibleItemCount - + ". Total Items:" + totalItemCount); - } - - /** - * Set whether the Last Item is Visible. lastVisibleItemIndex is a - * zero-based index, so we minus one totalItemCount to check - */ - if (null != mOnLastItemVisibleListener) { - mLastItemVisible = (totalItemCount > 0) && (firstVisibleItem + visibleItemCount >= totalItemCount - 1); - } - - // If we're showing the indicator, check positions... - if (getShowIndicatorInternal()) { - updateIndicatorViewsVisibility(); - } - - // Finally call OnScrollListener if we have one - if (null != mOnScrollListener) { - mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); - } - } - - public final void onScrollStateChanged(final AbsListView view, final int state) { - /** - * Check that the scrolling has stopped, and that the last item is - * visible. - */ - if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { - mOnLastItemVisibleListener.onLastItemVisible(); - } - - if (null != mOnScrollListener) { - mOnScrollListener.onScrollStateChanged(view, state); - } - } - - /** - * Pass-through method for {@link PullToRefreshBase#getRefreshableView() - * getRefreshableView()}. - * {@link AdapterView#setAdapter(android.widget.Adapter)} - * setAdapter(adapter)}. This is just for convenience! - * - * @param adapter - Adapter to set - */ - public void setAdapter(ListAdapter adapter) { - ((AdapterView) mRefreshableView).setAdapter(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 - * Framework automatically sets the Empty View based on it's ID. - * - * @param newEmptyView - Empty View to be used - */ - public final void setEmptyView(View newEmptyView) { - FrameLayout refreshableViewWrapper = getRefreshableViewWrapper(); - - if (null != newEmptyView) { - // New view needs to be clickable so that Android recognizes it as a - // target for Touch Events - newEmptyView.setClickable(true); - - ViewParent newEmptyViewParent = newEmptyView.getParent(); - if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) { - ((ViewGroup) newEmptyViewParent).removeView(newEmptyView); - } - - // We need to convert any LayoutParams so that it works in our - // FrameLayout - FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams()); - if (null != lp) { - refreshableViewWrapper.addView(newEmptyView, lp); - } else { - refreshableViewWrapper.addView(newEmptyView); - } - } - - if (mRefreshableView instanceof EmptyViewMethodAccessor) { - ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView); - } else { - mRefreshableView.setEmptyView(newEmptyView); - } - mEmptyView = newEmptyView; - } - - /** - * Pass-through method for {@link PullToRefreshBase#getRefreshableView() - * getRefreshableView()}. - * {@link AdapterView#setOnItemClickListener(OnItemClickListener) - * setOnItemClickListener(listener)}. This is just for convenience! - * - * @param listener - OnItemClickListener to use - */ - public void setOnItemClickListener(OnItemClickListener listener) { - mRefreshableView.setOnItemClickListener(listener); - } - - public final void setOnLastItemVisibleListener(OnLastItemVisibleListener listener) { - mOnLastItemVisibleListener = listener; - } - - public final void setOnScrollListener(OnScrollListener listener) { - mOnScrollListener = listener; - } - - public final void setScrollEmptyView(boolean doScroll) { - mScrollEmptyView = doScroll; - } - - /** - * Sets whether an indicator graphic should be displayed when the View is in - * a state where a Pull-to-Refresh can happen. An example of this state is - * when the Adapter View is scrolled to the top and the mode is set to - * {@link Mode#PULL_FROM_START} - * - * @param showIndicator - true if the indicators should be shown. - */ - public void setShowIndicator(boolean showIndicator) { - mShowIndicator = showIndicator; - - if (getShowIndicatorInternal()) { - // If we're set to Show Indicator, add/update them - addIndicatorViews(); - } else { - // If not, then remove then - removeIndicatorViews(); - } - } - - @Override - protected void onPullToRefresh() { - super.onPullToRefresh(); - - if (getShowIndicatorInternal()) { - switch (getCurrentMode()) { - case PULL_FROM_END: - mIndicatorIvBottom.pullToRefresh(); - break; - case PULL_FROM_START: - mIndicatorIvTop.pullToRefresh(); - break; - default: - // NO-OP - break; - } - } - } - - protected void onRefreshing(boolean doScroll) { - super.onRefreshing(doScroll); - - if (getShowIndicatorInternal()) { - updateIndicatorViewsVisibility(); - } - } - - @Override - protected void onReleaseToRefresh() { - super.onReleaseToRefresh(); - - if (getShowIndicatorInternal()) { - switch (getCurrentMode()) { - case PULL_FROM_END: - mIndicatorIvBottom.releaseToRefresh(); - break; - case PULL_FROM_START: - mIndicatorIvTop.releaseToRefresh(); - break; - default: - // NO-OP - break; - } - } - } - - @Override - protected void onReset() { - super.onReset(); - - if (getShowIndicatorInternal()) { - updateIndicatorViewsVisibility(); - } - } - - @Override - protected void handleStyledAttributes(TypedArray a) { - // Set Show Indicator to the XML value, or default value - mShowIndicator = a.getBoolean(R.styleable.PullToRefresh_ptrShowIndicator, !isPullToRefreshOverScrollEnabled()); - } - - protected boolean isReadyForPullStart() { - return isFirstItemVisible(); - } - - protected boolean isReadyForPullEnd() { - return isLastItemVisible(); - } - - @Override - protected void onScrollChanged(int l, int t, int oldl, int oldt) { - super.onScrollChanged(l, t, oldl, oldt); - if (null != mEmptyView && !mScrollEmptyView) { - mEmptyView.scrollTo(-l, -t); - } - } - - @Override - protected void updateUIForMode() { - super.updateUIForMode(); - - // Check Indicator Views consistent with new Mode - if (getShowIndicatorInternal()) { - addIndicatorViews(); - } else { - removeIndicatorViews(); - } - } - - private void addIndicatorViews() { - Mode mode = getMode(); - FrameLayout refreshableViewWrapper = getRefreshableViewWrapper(); - - if (mode.showHeaderLoadingLayout() && null == mIndicatorIvTop) { - // If the mode can pull down, and we don't have one set already - mIndicatorIvTop = new IndicatorLayout(getContext(), Mode.PULL_FROM_START); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT); - params.rightMargin = getResources().getDimensionPixelSize(R.dimen.indicator_right_padding); - params.gravity = Gravity.TOP | Gravity.RIGHT; - refreshableViewWrapper.addView(mIndicatorIvTop, params); - - } else if (!mode.showHeaderLoadingLayout() && null != mIndicatorIvTop) { - // If we can't pull down, but have a View then remove it - refreshableViewWrapper.removeView(mIndicatorIvTop); - mIndicatorIvTop = null; - } - - if (mode.showFooterLoadingLayout() && null == mIndicatorIvBottom) { - // If the mode can pull down, and we don't have one set already - mIndicatorIvBottom = new IndicatorLayout(getContext(), Mode.PULL_FROM_END); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT); - params.rightMargin = getResources().getDimensionPixelSize(R.dimen.indicator_right_padding); - params.gravity = Gravity.BOTTOM | Gravity.RIGHT; - refreshableViewWrapper.addView(mIndicatorIvBottom, params); - - } else if (!mode.showFooterLoadingLayout() && null != mIndicatorIvBottom) { - // If we can't pull down, but have a View then remove it - refreshableViewWrapper.removeView(mIndicatorIvBottom); - mIndicatorIvBottom = null; - } - } - - private boolean getShowIndicatorInternal() { - return mShowIndicator && isPullToRefreshEnabled(); - } - - private boolean isFirstItemVisible() { - final Adapter adapter = mRefreshableView.getAdapter(); - - if (null == adapter || adapter.isEmpty()) { - if (DEBUG) { - Log.d(LOG_TAG, "isFirstItemVisible. Empty View."); - } - return true; - - } else { - - /** - * This check should really just be: - * mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView - * internally use a HeaderView which messes the positions up. For - * now we'll just add one to account for it and rely on the inner - * condition which checks getTop(). - */ - if (mRefreshableView.getFirstVisiblePosition() <= 1) { - final View firstVisibleChild = mRefreshableView.getChildAt(0); - if (firstVisibleChild != null) { - return firstVisibleChild.getTop() >= mRefreshableView.getTop(); - } - } - } - - return false; - } - - private boolean isLastItemVisible() { - final Adapter adapter = mRefreshableView.getAdapter(); - - if (null == adapter || adapter.isEmpty()) { - if (DEBUG) { - Log.d(LOG_TAG, "isLastItemVisible. Empty View."); - } - return true; - } else { - final int lastItemPosition = mRefreshableView.getCount() - 1; - final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition(); - - if (DEBUG) { - Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " + lastItemPosition + " Last Visible Pos: " - + lastVisiblePosition); - } - - /** - * This check should really just be: lastVisiblePosition == - * lastItemPosition, but PtRListView internally uses a FooterView - * which messes the positions up. For me we'll just subtract one to - * account for it and rely on the inner condition which checks - * getBottom(). - */ - if (lastVisiblePosition >= lastItemPosition - 1) { - final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition(); - final View lastVisibleChild = mRefreshableView.getChildAt(childIndex); - if (lastVisibleChild != null) { - return lastVisibleChild.getBottom() <= mRefreshableView.getBottom(); - } - } - } - - return false; - } - - private void removeIndicatorViews() { - if (null != mIndicatorIvTop) { - getRefreshableViewWrapper().removeView(mIndicatorIvTop); - mIndicatorIvTop = null; - } - - if (null != mIndicatorIvBottom) { - getRefreshableViewWrapper().removeView(mIndicatorIvBottom); - mIndicatorIvBottom = null; - } - } - - private void updateIndicatorViewsVisibility() { - if (null != mIndicatorIvTop) { - if (!isRefreshing() && isReadyForPullStart()) { - if (!mIndicatorIvTop.isVisible()) { - mIndicatorIvTop.show(); - } - } else { - if (mIndicatorIvTop.isVisible()) { - mIndicatorIvTop.hide(); - } - } - } - - if (null != mIndicatorIvBottom) { - if (!isRefreshing() && isReadyForPullEnd()) { - if (!mIndicatorIvBottom.isVisible()) { - mIndicatorIvBottom.show(); - } - } else { - if (mIndicatorIvBottom.isVisible()) { - mIndicatorIvBottom.hide(); - } - } - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java deleted file mode 100644 index 4d45c633..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ /dev/null @@ -1,1653 +0,0 @@ -/******************************************************************************* - * 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; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.os.Bundle; -import android.os.Parcelable; -import android.util.AttributeSet; -import android.util.Log; -import android.view.Gravity; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.view.animation.DecelerateInterpolator; -import android.view.animation.Interpolator; -import android.widget.FrameLayout; -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; - -public abstract class PullToRefreshBase extends LinearLayout implements IPullToRefresh { - - // =========================================================== - // Constants - // =========================================================== - - static final boolean DEBUG = false; - - static final boolean USE_HW_LAYERS = false; - - static final String LOG_TAG = "PullToRefresh"; - - static final float FRICTION = 2.0f; - - public static final int SMOOTH_SCROLL_DURATION_MS = 200; - public static final int SMOOTH_SCROLL_LONG_DURATION_MS = 325; - static final int DEMO_SCROLL_INTERVAL = 225; - - static final String STATE_STATE = "ptr_state"; - static final String STATE_MODE = "ptr_mode"; - static final String STATE_CURRENT_MODE = "ptr_current_mode"; - static final String STATE_SCROLLING_REFRESHING_ENABLED = "ptr_disable_scrolling"; - static final String STATE_SHOW_REFRESHING_VIEW = "ptr_show_refreshing_view"; - static final String STATE_SUPER = "ptr_super"; - - // =========================================================== - // Fields - // =========================================================== - - private int mTouchSlop; - private float mLastMotionX, mLastMotionY; - private float mInitialMotionX, mInitialMotionY; - - private boolean mIsBeingDragged = false; - private State mState = State.RESET; - private Mode mMode = Mode.getDefault(); - - private Mode mCurrentMode; - T mRefreshableView; - private FrameLayout mRefreshableViewWrapper; - - private boolean mShowViewWhileRefreshing = true; - private boolean mScrollingWhileRefreshingEnabled = false; - private boolean mFilterTouchEvents = true; - private boolean mOverScrollEnabled = true; - private boolean mLayoutVisibilityChangesEnabled = true; - - private Interpolator mScrollAnimationInterpolator; - private AnimationStyle mLoadingAnimationStyle = AnimationStyle.getDefault(); - - private LoadingLayout mHeaderLayout; - private LoadingLayout mFooterLayout; - - private OnRefreshListener mOnRefreshListener; - private OnRefreshListener2 mOnRefreshListener2; - private OnPullEventListener mOnPullEventListener; - - private SmoothScrollRunnable mCurrentSmoothScrollRunnable; - - // =========================================================== - // Constructors - // =========================================================== - - public PullToRefreshBase(Context context) { - super(context); - init(context, null); - } - - public PullToRefreshBase(Context context, AttributeSet attrs) { - super(context, attrs); - init(context, attrs); - } - - public PullToRefreshBase(Context context, Mode mode) { - super(context); - mMode = mode; - init(context, null); - } - - public PullToRefreshBase(Context context, Mode mode, AnimationStyle animStyle) { - super(context); - mMode = mode; - mLoadingAnimationStyle = animStyle; - init(context, null); - } - - @Override - public void addView(View child, int index, ViewGroup.LayoutParams params) { - if (DEBUG) { - Log.d(LOG_TAG, "addView: " + child.getClass().getSimpleName()); - } - - final T refreshableView = getRefreshableView(); - - if (refreshableView instanceof ViewGroup) { - ((ViewGroup) refreshableView).addView(child, index, params); - } else { - throw new UnsupportedOperationException("Refreshable View is not a ViewGroup so can't addView"); - } - } - - @Override - public final boolean demo() { - if (mMode.showHeaderLoadingLayout() && isReadyForPullStart()) { - smoothScrollToAndBack(-getHeaderSize() * 2); - return true; - } else if (mMode.showFooterLoadingLayout() && isReadyForPullEnd()) { - smoothScrollToAndBack(getFooterSize() * 2); - return true; - } - - return false; - } - - @Override - public final Mode getCurrentMode() { - return mCurrentMode; - } - - @Override - public final boolean getFilterTouchEvents() { - return mFilterTouchEvents; - } - - @Override - public final ILoadingLayout getLoadingLayoutProxy() { - return getLoadingLayoutProxy(true, true); - } - - @Override - public final ILoadingLayout getLoadingLayoutProxy(boolean includeStart, boolean includeEnd) { - return createLoadingLayoutProxy(includeStart, includeEnd); - } - - @Override - public final Mode getMode() { - return mMode; - } - - @Override - public final T getRefreshableView() { - return mRefreshableView; - } - - @Override - public final boolean getShowViewWhileRefreshing() { - return mShowViewWhileRefreshing; - } - - @Override - public final State getState() { - return mState; - } - - /** - * @deprecated See {@link #isScrollingWhileRefreshingEnabled()}. - */ - public final boolean isDisableScrollingWhileRefreshing() { - return !isScrollingWhileRefreshingEnabled(); - } - - @Override - public final boolean isPullToRefreshEnabled() { - return mMode.permitsPullToRefresh(); - } - - @Override - public final boolean isPullToRefreshOverScrollEnabled() { - return VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD && mOverScrollEnabled - && OverscrollHelper.isAndroidOverScrollEnabled(mRefreshableView); - } - - @Override - public final boolean isRefreshing() { - return mState == State.REFRESHING || mState == State.MANUAL_REFRESHING; - } - - @Override - public final boolean isScrollingWhileRefreshingEnabled() { - return mScrollingWhileRefreshingEnabled; - } - - @Override - public final boolean onInterceptTouchEvent(MotionEvent event) { - - if (!isPullToRefreshEnabled()) { - return false; - } - - final int action = event.getAction(); - - if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) { - mIsBeingDragged = false; - return false; - } - - if (action != MotionEvent.ACTION_DOWN && mIsBeingDragged) { - return true; - } - - switch (action) { - case MotionEvent.ACTION_MOVE: { - // If we're refreshing, and the flag is set. Eat all MOVE events - if (!mScrollingWhileRefreshingEnabled && isRefreshing()) { - return true; - } - - if (isReadyForPull()) { - final float y = event.getY(), x = event.getX(); - final float diff, oppositeDiff, absDiff; - - // We need to use the correct values, based on scroll - // direction - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - diff = x - mLastMotionX; - oppositeDiff = y - mLastMotionY; - break; - case VERTICAL: - default: - diff = y - mLastMotionY; - oppositeDiff = x - mLastMotionX; - break; - } - absDiff = Math.abs(diff); - - if (absDiff > mTouchSlop && (!mFilterTouchEvents || absDiff > Math.abs(oppositeDiff))) { - if (mMode.showHeaderLoadingLayout() && diff >= 1f && isReadyForPullStart()) { - mLastMotionY = y; - mLastMotionX = x; - mIsBeingDragged = true; - if (mMode == Mode.BOTH) { - mCurrentMode = Mode.PULL_FROM_START; - } - } else if (mMode.showFooterLoadingLayout() && diff <= -1f && isReadyForPullEnd()) { - mLastMotionY = y; - mLastMotionX = x; - mIsBeingDragged = true; - if (mMode == Mode.BOTH) { - mCurrentMode = Mode.PULL_FROM_END; - } - } - } - } - break; - } - case MotionEvent.ACTION_DOWN: { - if (isReadyForPull()) { - mLastMotionY = mInitialMotionY = event.getY(); - mLastMotionX = mInitialMotionX = event.getX(); - mIsBeingDragged = false; - } - break; - } - } - - return mIsBeingDragged; - } - - @Override - public final void onRefreshComplete() { - if (isRefreshing()) { - setState(State.RESET); - } - } - - @Override - public final boolean onTouchEvent(MotionEvent event) { - - if (!isPullToRefreshEnabled()) { - return false; - } - - // If we're refreshing, and the flag is set. Eat the event - if (!mScrollingWhileRefreshingEnabled && isRefreshing()) { - return true; - } - - if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) { - return false; - } - - switch (event.getAction()) { - case MotionEvent.ACTION_MOVE: { - if (mIsBeingDragged) { - mLastMotionY = event.getY(); - mLastMotionX = event.getX(); - pullEvent(); - return true; - } - break; - } - - case MotionEvent.ACTION_DOWN: { - if (isReadyForPull()) { - mLastMotionY = mInitialMotionY = event.getY(); - mLastMotionX = mInitialMotionX = event.getX(); - return true; - } - break; - } - - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: { - if (mIsBeingDragged) { - mIsBeingDragged = false; - - if (mState == State.RELEASE_TO_REFRESH - && (null != mOnRefreshListener || null != mOnRefreshListener2)) { - setState(State.REFRESHING, true); - return true; - } - - // If we're already refreshing, just scroll back to the top - if (isRefreshing()) { - smoothScrollTo(0); - return true; - } - - // If we haven't returned by here, then we're not in a state - // to pull, so just reset - setState(State.RESET); - - return true; - } - break; - } - } - - return false; - } - - public final void setScrollingWhileRefreshingEnabled(boolean allowScrollingWhileRefreshing) { - mScrollingWhileRefreshingEnabled = allowScrollingWhileRefreshing; - } - - /** - * @deprecated See {@link #setScrollingWhileRefreshingEnabled(boolean)} - */ - public void setDisableScrollingWhileRefreshing(boolean disableScrollingWhileRefreshing) { - setScrollingWhileRefreshingEnabled(!disableScrollingWhileRefreshing); - } - - @Override - public final void setFilterTouchEvents(boolean filterEvents) { - mFilterTouchEvents = filterEvents; - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy()}. - */ - public void setLastUpdatedLabel(CharSequence label) { - getLoadingLayoutProxy().setLastUpdatedLabel(label); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy()}. - */ - public void setLoadingDrawable(Drawable drawable) { - getLoadingLayoutProxy().setLoadingDrawable(drawable); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy(boolean, boolean)}. - */ - public void setLoadingDrawable(Drawable drawable, Mode mode) { - getLoadingLayoutProxy(mode.showHeaderLoadingLayout(), mode.showFooterLoadingLayout()).setLoadingDrawable( - drawable); - } - - @Override - public void setLongClickable(boolean longClickable) { - getRefreshableView().setLongClickable(longClickable); - } - - @Override - public final void setMode(Mode mode) { - if (mode != mMode) { - if (DEBUG) { - Log.d(LOG_TAG, "Setting mode to: " + mode); - } - mMode = mode; - updateUIForMode(); - } - } - - public void setOnPullEventListener(OnPullEventListener listener) { - mOnPullEventListener = listener; - } - - @Override - public final void setOnRefreshListener(OnRefreshListener listener) { - mOnRefreshListener = listener; - mOnRefreshListener2 = null; - } - - @Override - public final void setOnRefreshListener(OnRefreshListener2 listener) { - mOnRefreshListener2 = listener; - mOnRefreshListener = null; - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy()}. - */ - public void setPullLabel(CharSequence pullLabel) { - getLoadingLayoutProxy().setPullLabel(pullLabel); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy(boolean, boolean)}. - */ - public void setPullLabel(CharSequence pullLabel, Mode mode) { - getLoadingLayoutProxy(mode.showHeaderLoadingLayout(), mode.showFooterLoadingLayout()).setPullLabel(pullLabel); - } - - /** - * @param enable Whether Pull-To-Refresh should be used - * @deprecated This simple calls setMode with an appropriate mode based on - * the passed value. - */ - public final void setPullToRefreshEnabled(boolean enable) { - setMode(enable ? Mode.getDefault() : Mode.DISABLED); - } - - @Override - public final void setPullToRefreshOverScrollEnabled(boolean enabled) { - mOverScrollEnabled = enabled; - } - - @Override - public final void setRefreshing() { - setRefreshing(true); - } - - @Override - public final void setRefreshing(boolean doScroll) { - if (!isRefreshing()) { - setState(State.MANUAL_REFRESHING, doScroll); - } - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy()}. - */ - public void setRefreshingLabel(CharSequence refreshingLabel) { - getLoadingLayoutProxy().setRefreshingLabel(refreshingLabel); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy(boolean, boolean)}. - */ - public void setRefreshingLabel(CharSequence refreshingLabel, Mode mode) { - getLoadingLayoutProxy(mode.showHeaderLoadingLayout(), mode.showFooterLoadingLayout()).setRefreshingLabel( - refreshingLabel); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy()}. - */ - public void setReleaseLabel(CharSequence releaseLabel) { - setReleaseLabel(releaseLabel, Mode.BOTH); - } - - /** - * @deprecated You should now call this method on the result of - * {@link #getLoadingLayoutProxy(boolean, boolean)}. - */ - public void setReleaseLabel(CharSequence releaseLabel, Mode mode) { - getLoadingLayoutProxy(mode.showHeaderLoadingLayout(), mode.showFooterLoadingLayout()).setReleaseLabel( - releaseLabel); - } - - public void setScrollAnimationInterpolator(Interpolator interpolator) { - mScrollAnimationInterpolator = interpolator; - } - - @Override - public final void setShowViewWhileRefreshing(boolean showView) { - mShowViewWhileRefreshing = showView; - } - - /** - * @return Either {@link Orientation#VERTICAL} or - * {@link Orientation#HORIZONTAL} depending on the scroll direction. - */ - public abstract Orientation getPullToRefreshScrollDirection(); - - final void setState(State state, final boolean... params) { - mState = state; - if (DEBUG) { - Log.d(LOG_TAG, "State: " + mState.name()); - } - - switch (mState) { - case RESET: - onReset(); - break; - case PULL_TO_REFRESH: - onPullToRefresh(); - break; - case RELEASE_TO_REFRESH: - onReleaseToRefresh(); - break; - case REFRESHING: - case MANUAL_REFRESHING: - onRefreshing(params[0]); - break; - case OVERSCROLLING: - // NO-OP - break; - } - - // Call OnPullEventListener - if (null != mOnPullEventListener) { - mOnPullEventListener.onPullEvent(this, mState, mCurrentMode); - } - } - - /** - * Used internally for adding view. Need because we override addView to - * pass-through to the Refreshable View - */ - protected final void addViewInternal(View child, int index, ViewGroup.LayoutParams params) { - super.addView(child, index, params); - } - - /** - * Used internally for adding view. Need because we override addView to - * pass-through to the Refreshable View - */ - 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, - getPullToRefreshScrollDirection(), attrs); - layout.setVisibility(View.INVISIBLE); - return layout; - } - - /** - * Used internally for {@link #getLoadingLayoutProxy(boolean, boolean)}. - * Allows derivative classes to include any extra LoadingLayouts. - */ - protected LoadingLayoutProxy createLoadingLayoutProxy(final boolean includeStart, final boolean includeEnd) { - LoadingLayoutProxy proxy = new LoadingLayoutProxy(); - - if (includeStart && mMode.showHeaderLoadingLayout()) { - proxy.addLayout(mHeaderLayout); - } - if (includeEnd && mMode.showFooterLoadingLayout()) { - proxy.addLayout(mFooterLayout); - } - - return proxy; - } - - /** - * 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. - * - * @param context Context to create view with - * @param attrs AttributeSet from wrapped class. Means that anything you - * include in the XML layout declaration will be routed to the - * created View - * @return New instance of the Refreshable View - */ - protected abstract T createRefreshableView(Context context, AttributeSet attrs); - - protected final void disableLoadingLayoutVisibilityChanges() { - mLayoutVisibilityChangesEnabled = false; - } - - protected final LoadingLayout getFooterLayout() { - return mFooterLayout; - } - - protected final int getFooterSize() { - return mFooterLayout.getContentSize(); - } - - protected final LoadingLayout getHeaderLayout() { - return mHeaderLayout; - } - - protected final int getHeaderSize() { - return mHeaderLayout.getContentSize(); - } - - protected int getPullToRefreshScrollDuration() { - return SMOOTH_SCROLL_DURATION_MS; - } - - protected int getPullToRefreshScrollDurationLonger() { - return SMOOTH_SCROLL_LONG_DURATION_MS; - } - - protected FrameLayout getRefreshableViewWrapper() { - return mRefreshableViewWrapper; - } - - /** - * Allows Derivative classes to handle the XML Attrs without creating a - * TypedArray themsevles - * - * @param a - TypedArray of PullToRefresh Attributes - */ - protected void handleStyledAttributes(TypedArray a) { - } - - /** - * Implemented by derived class to return whether the View is in a state - * where the user can Pull to Refresh by scrolling from the end. - * - * @return true if the View is currently in the correct state (for example, - * bottom of a ListView) - */ - protected abstract boolean isReadyForPullEnd(); - - /** - * Implemented by derived class to return whether the View is in a state - * where the user can Pull to Refresh by scrolling from the start. - * - * @return true if the View is currently the correct state (for example, top - * of a ListView) - */ - protected abstract boolean isReadyForPullStart(); - - /** - * Called by {@link #onRestoreInstanceState(Parcelable)} so that derivative - * classes can handle their saved instance state. - * - * @param savedInstanceState - Bundle which contains saved instance state. - */ - protected void onPtrRestoreInstanceState(Bundle savedInstanceState) { - } - - /** - * Called by {@link #onSaveInstanceState()} so that derivative classes can - * save their instance state. - * - * @param saveState - Bundle to be updated with saved state. - */ - protected void onPtrSaveInstanceState(Bundle saveState) { - } - - /** - * Called when the UI has been to be updated to be in the - * {@link State#PULL_TO_REFRESH} state. - */ - protected void onPullToRefresh() { - switch (mCurrentMode) { - case PULL_FROM_END: - mFooterLayout.pullToRefresh(); - break; - case PULL_FROM_START: - mHeaderLayout.pullToRefresh(); - break; - default: - // NO-OP - break; - } - } - - /** - * Called when the UI has been to be updated to be in the - * {@link State#REFRESHING} or {@link State#MANUAL_REFRESHING} state. - * - * @param doScroll - Whether the UI should scroll for this event. - */ - protected void onRefreshing(final boolean doScroll) { - if (mMode.showHeaderLoadingLayout()) { - mHeaderLayout.refreshing(); - } - if (mMode.showFooterLoadingLayout()) { - mFooterLayout.refreshing(); - } - - if (doScroll) { - if (mShowViewWhileRefreshing) { - - // Call Refresh Listener when the Scroll has finished - OnSmoothScrollFinishedListener listener = new OnSmoothScrollFinishedListener() { - @Override - public void onSmoothScrollFinished() { - callRefreshListener(); - } - }; - - switch (mCurrentMode) { - case MANUAL_REFRESH_ONLY: - case PULL_FROM_END: - smoothScrollTo(getFooterSize(), listener); - break; - default: - case PULL_FROM_START: - smoothScrollTo(-getHeaderSize(), listener); - break; - } - } else { - smoothScrollTo(0); - } - } else { - // We're not scrolling, so just call Refresh Listener now - callRefreshListener(); - } - } - - /** - * Called when the UI has been to be updated to be in the - * {@link State#RELEASE_TO_REFRESH} state. - */ - protected void onReleaseToRefresh() { - switch (mCurrentMode) { - case PULL_FROM_END: - mFooterLayout.releaseToRefresh(); - break; - case PULL_FROM_START: - mHeaderLayout.releaseToRefresh(); - break; - default: - // NO-OP - break; - } - } - - /** - * Called when the UI has been to be updated to be in the - * {@link State#RESET} state. - */ - protected void onReset() { - mIsBeingDragged = false; - mLayoutVisibilityChangesEnabled = true; - - // Always reset both layouts, just in case... - mHeaderLayout.reset(); - mFooterLayout.reset(); - - smoothScrollTo(0); - } - - @Override - protected final void onRestoreInstanceState(Parcelable state) { - if (state instanceof Bundle) { - Bundle bundle = (Bundle) state; - - setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0))); - mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0)); - - mScrollingWhileRefreshingEnabled = bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false); - mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true); - - // Let super Restore Itself - super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER)); - - State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0)); - if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) { - setState(viewState, true); - } - - // Now let derivative classes restore their state - onPtrRestoreInstanceState(bundle); - return; - } - - super.onRestoreInstanceState(state); - } - - @Override - protected final Parcelable onSaveInstanceState() { - Bundle bundle = new Bundle(); - - // Let derivative classes get a chance to save state first, that way we - // can make sure they don't overrite any of our values - onPtrSaveInstanceState(bundle); - - bundle.putInt(STATE_STATE, mState.getIntValue()); - bundle.putInt(STATE_MODE, mMode.getIntValue()); - bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); - bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); - bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); - bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); - - return bundle; - } - - @Override - protected final void onSizeChanged(int w, int h, int oldw, int oldh) { - if (DEBUG) { - Log.d(LOG_TAG, String.format("onSizeChanged. W: %d, H: %d", w, h)); - } - - super.onSizeChanged(w, h, oldw, oldh); - - // We need to update the header/footer when our size changes - refreshLoadingViewsSize(); - - // Update the Refreshable View layout - refreshRefreshableViewSize(w, h); - - /** - * As we're currently in a Layout Pass, we need to schedule another one - * to layout any changes we've made here - */ - post(new Runnable() { - @Override - public void run() { - requestLayout(); - } - }); - } - - /** - * Re-measure the Loading Views height, and adjust internal padding as - * necessary - */ - protected final void refreshLoadingViewsSize() { - final int maximumPullScroll = (int) (getMaximumPullScroll() * 1.2f); - - int pLeft = getPaddingLeft(); - int pTop = getPaddingTop(); - int pRight = getPaddingRight(); - int pBottom = getPaddingBottom(); - - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - if (mMode.showHeaderLoadingLayout()) { - mHeaderLayout.setWidth(maximumPullScroll); - pLeft = -maximumPullScroll; - } else { - pLeft = 0; - } - - if (mMode.showFooterLoadingLayout()) { - mFooterLayout.setWidth(maximumPullScroll); - pRight = -maximumPullScroll; - } else { - pRight = 0; - } - break; - - case VERTICAL: - if (mMode.showHeaderLoadingLayout()) { - mHeaderLayout.setHeight(maximumPullScroll); - pTop = -maximumPullScroll; - } else { - pTop = 0; - } - - if (mMode.showFooterLoadingLayout()) { - mFooterLayout.setHeight(maximumPullScroll); - pBottom = -maximumPullScroll; - } else { - pBottom = 0; - } - break; - } - - if (DEBUG) { - Log.d(LOG_TAG, String.format("Setting Padding. L: %d, T: %d, R: %d, B: %d", pLeft, pTop, pRight, pBottom)); - } - setPadding(pLeft, pTop, pRight, pBottom); - } - - 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(); - - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - if (lp.width != width) { - lp.width = width; - mRefreshableViewWrapper.requestLayout(); - } - break; - case VERTICAL: - if (lp.height != height) { - lp.height = height; - mRefreshableViewWrapper.requestLayout(); - } - break; - } - } - - /** - * Helper method which just calls scrollTo() in the correct scrolling - * direction. - * - * @param value - New Scroll value - */ - protected final void setHeaderScroll(int value) { - if (DEBUG) { - Log.d(LOG_TAG, "setHeaderScroll: " + value); - } - - // Clamp value to with pull scroll range - final int maximumPullScroll = getMaximumPullScroll(); - value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value)); - - if (mLayoutVisibilityChangesEnabled) { - if (value < 0) { - mHeaderLayout.setVisibility(View.VISIBLE); - } else if (value > 0) { - mFooterLayout.setVisibility(View.VISIBLE); - } else { - mHeaderLayout.setVisibility(View.INVISIBLE); - mFooterLayout.setVisibility(View.INVISIBLE); - } - } - - if (USE_HW_LAYERS) { - /** - * Use a Hardware Layer on the Refreshable View if we've scrolled at - * all. We don't use them on the Header/Footer Views as they change - * often, which would negate any HW layer performance boost. - */ - ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE - : View.LAYER_TYPE_NONE); - } - - switch (getPullToRefreshScrollDirection()) { - case VERTICAL: - scrollTo(0, value); - break; - case HORIZONTAL: - scrollTo(value, 0); - break; - } - } - - /** - * Smooth Scroll to position using the default duration of - * {@value #SMOOTH_SCROLL_DURATION_MS} ms. - * - * @param scrollValue - Position to scroll to - */ - protected final void smoothScrollTo(int scrollValue) { - smoothScrollTo(scrollValue, getPullToRefreshScrollDuration()); - } - - /** - * Smooth Scroll to position using the default duration of - * {@value #SMOOTH_SCROLL_DURATION_MS} ms. - * - * @param scrollValue - Position to scroll to - * @param listener - Listener for scroll - */ - protected final void smoothScrollTo(int scrollValue, OnSmoothScrollFinishedListener listener) { - smoothScrollTo(scrollValue, getPullToRefreshScrollDuration(), 0, listener); - } - - /** - * Smooth Scroll to position using the longer default duration of - * {@value #SMOOTH_SCROLL_LONG_DURATION_MS} ms. - * - * @param scrollValue - Position to scroll to - */ - protected final void smoothScrollToLonger(int scrollValue) { - smoothScrollTo(scrollValue, getPullToRefreshScrollDurationLonger()); - } - - /** - * Updates the View State when the mode has been set. This does not do any - * checking that the mode is different to current state so always updates. - */ - protected void updateUIForMode() { - // We need to use the correct LayoutParam values, based on scroll - // direction - final LinearLayout.LayoutParams lp = getLoadingLayoutLayoutParams(); - - // Remove Header, and then add Header Loading View again if needed - if (this == mHeaderLayout.getParent()) { - removeView(mHeaderLayout); - } - if (mMode.showHeaderLoadingLayout()) { - addViewInternal(mHeaderLayout, 0, lp); - } - - // Remove Footer, and then add Footer Loading View again if needed - if (this == mFooterLayout.getParent()) { - removeView(mFooterLayout); - } - if (mMode.showFooterLoadingLayout()) { - addViewInternal(mFooterLayout, lp); - } - - // Hide Loading Views - refreshLoadingViewsSize(); - - // If we're not using Mode.BOTH, set mCurrentMode to mMode, otherwise - // set it to pull down - mCurrentMode = (mMode != Mode.BOTH) ? mMode : Mode.PULL_FROM_START; - } - - private void addRefreshableView(Context context, T refreshableView) { - mRefreshableViewWrapper = new FrameLayout(context); - mRefreshableViewWrapper.addView(refreshableView, ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT); - - addViewInternal(mRefreshableViewWrapper, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, - LayoutParams.MATCH_PARENT)); - } - - private void callRefreshListener() { - if (null != mOnRefreshListener) { - mOnRefreshListener.onRefresh(this); - } else if (null != mOnRefreshListener2) { - if (mCurrentMode == Mode.PULL_FROM_START) { - mOnRefreshListener2.onPullDownToRefresh(this); - } else if (mCurrentMode == Mode.PULL_FROM_END) { - mOnRefreshListener2.onPullUpToRefresh(this); - } - } - } - - @SuppressWarnings("deprecation") - private void init(Context context, AttributeSet attrs) { - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - setOrientation(LinearLayout.HORIZONTAL); - break; - case VERTICAL: - default: - setOrientation(LinearLayout.VERTICAL); - break; - } - - setGravity(Gravity.CENTER); - - ViewConfiguration config = ViewConfiguration.get(context); - mTouchSlop = config.getScaledTouchSlop(); - - // Styleables from XML - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PullToRefresh); - - if (a.hasValue(R.styleable.PullToRefresh_ptrMode)) { - mMode = Mode.mapIntToValue(a.getInteger(R.styleable.PullToRefresh_ptrMode, 0)); - } - - if (a.hasValue(R.styleable.PullToRefresh_ptrAnimationStyle)) { - mLoadingAnimationStyle = AnimationStyle.mapIntToValue(a.getInteger( - R.styleable.PullToRefresh_ptrAnimationStyle, 0)); - } - - // Refreshable View - // By passing the attrs, we can add ListView/GridView params via XML - mRefreshableView = createRefreshableView(context, attrs); - addRefreshableView(context, mRefreshableView); - - // We need to create now layouts now - mHeaderLayout = createLoadingLayout(context, Mode.PULL_FROM_START, a); - mFooterLayout = createLoadingLayout(context, Mode.PULL_FROM_END, a); - - /** - * Styleables from XML - */ - if (a.hasValue(R.styleable.PullToRefresh_ptrRefreshableViewBackground)) { - Drawable background = a.getDrawable(R.styleable.PullToRefresh_ptrRefreshableViewBackground); - if (null != background) { - mRefreshableView.setBackgroundDrawable(background); - } - } else if (a.hasValue(R.styleable.PullToRefresh_ptrAdapterViewBackground)) { - Utils.warnDeprecation("ptrAdapterViewBackground", "ptrRefreshableViewBackground"); - Drawable background = a.getDrawable(R.styleable.PullToRefresh_ptrAdapterViewBackground); - if (null != background) { - mRefreshableView.setBackgroundDrawable(background); - } - } - - if (a.hasValue(R.styleable.PullToRefresh_ptrOverScroll)) { - mOverScrollEnabled = a.getBoolean(R.styleable.PullToRefresh_ptrOverScroll, true); - } - - if (a.hasValue(R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled)) { - mScrollingWhileRefreshingEnabled = a.getBoolean( - R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled, false); - } - - // Let the derivative classes have a go at handling attributes, then - // recycle them... - handleStyledAttributes(a); - a.recycle(); - - // Finally update the UI for the modes - updateUIForMode(); - } - - private boolean isReadyForPull() { - switch (mMode) { - case PULL_FROM_START: - return isReadyForPullStart(); - case PULL_FROM_END: - return isReadyForPullEnd(); - case BOTH: - return isReadyForPullEnd() || isReadyForPullStart(); - default: - return false; - } - } - - /** - * Actions a Pull Event - * - * @return true if the Event has been handled, false if there has been no - * change - */ - private void pullEvent() { - final int newScrollValue; - final int itemDimension; - final float initialMotionValue, lastMotionValue; - - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - initialMotionValue = mInitialMotionX; - lastMotionValue = mLastMotionX; - break; - case VERTICAL: - default: - initialMotionValue = mInitialMotionY; - lastMotionValue = mLastMotionY; - break; - } - - switch (mCurrentMode) { - case PULL_FROM_END: - newScrollValue = Math.round(Math.max(initialMotionValue - lastMotionValue, 0) / FRICTION); - itemDimension = getFooterSize(); - break; - case PULL_FROM_START: - default: - newScrollValue = Math.round(Math.min(initialMotionValue - lastMotionValue, 0) / FRICTION); - itemDimension = getHeaderSize(); - break; - } - - setHeaderScroll(newScrollValue); - - if (newScrollValue != 0 && !isRefreshing()) { - float scale = Math.abs(newScrollValue) / (float) itemDimension; - switch (mCurrentMode) { - case PULL_FROM_END: - mFooterLayout.onPull(scale); - break; - case PULL_FROM_START: - default: - mHeaderLayout.onPull(scale); - break; - } - - if (mState != State.PULL_TO_REFRESH && itemDimension >= Math.abs(newScrollValue)) { - setState(State.PULL_TO_REFRESH); - } else if (mState == State.PULL_TO_REFRESH && itemDimension < Math.abs(newScrollValue)) { - setState(State.RELEASE_TO_REFRESH); - } - } - } - - private LinearLayout.LayoutParams getLoadingLayoutLayoutParams() { - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT); - case VERTICAL: - default: - return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - } - } - - private int getMaximumPullScroll() { - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - return Math.round(getWidth() / FRICTION); - case VERTICAL: - default: - return Math.round(getHeight() / FRICTION); - } - } - - /** - * Smooth Scroll to position using the specific duration - * - * @param scrollValue - Position to scroll to - * @param duration - Duration of animation in milliseconds - */ - private final void smoothScrollTo(int scrollValue, long duration) { - smoothScrollTo(scrollValue, duration, 0, null); - } - - private final void smoothScrollTo(int newScrollValue, long duration, long delayMillis, - OnSmoothScrollFinishedListener listener) { - if (null != mCurrentSmoothScrollRunnable) { - mCurrentSmoothScrollRunnable.stop(); - } - - final int oldScrollValue; - switch (getPullToRefreshScrollDirection()) { - case HORIZONTAL: - oldScrollValue = getScrollX(); - break; - case VERTICAL: - default: - oldScrollValue = getScrollY(); - break; - } - - if (oldScrollValue != newScrollValue) { - if (null == mScrollAnimationInterpolator) { - // Default interpolator is a Decelerate Interpolator - mScrollAnimationInterpolator = new DecelerateInterpolator(); - } - mCurrentSmoothScrollRunnable = new SmoothScrollRunnable(oldScrollValue, newScrollValue, duration, listener); - - if (delayMillis > 0) { - postDelayed(mCurrentSmoothScrollRunnable, delayMillis); - } else { - post(mCurrentSmoothScrollRunnable); - } - } - } - - private final void smoothScrollToAndBack(int y) { - smoothScrollTo(y, SMOOTH_SCROLL_DURATION_MS, 0, new OnSmoothScrollFinishedListener() { - - @Override - public void onSmoothScrollFinished() { - smoothScrollTo(0, SMOOTH_SCROLL_DURATION_MS, DEMO_SCROLL_INTERVAL, null); - } - }); - } - - public static enum AnimationStyle { - /** - * This is the default for Android-PullToRefresh. Allows you to use any - * drawable, which is automatically rotated and used as a Progress Bar. - */ - ROTATE, - - /** - * This is the old default, and what is commonly used on iOS. Uses an - * arrow image which flips depending on where the user has scrolled. - */ - FLIP; - - static AnimationStyle getDefault() { - return ROTATE; - } - - /** - * Maps an int to a specific mode. This is needed when saving state, or - * inflating the view from XML where the mode is given through a attr - * int. - * - * @param modeInt - int to map a Mode to - * @return Mode that modeInt maps to, or ROTATE by default. - */ - static AnimationStyle mapIntToValue(int modeInt) { - switch (modeInt) { - case 0x0: - default: - return ROTATE; - case 0x1: - return FLIP; - } - } - - LoadingLayout createLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { - switch (this) { - case ROTATE: - default: - return new RotateLoadingLayout(context, mode, scrollDirection, attrs); - case FLIP: - return new FlipLoadingLayout(context, mode, scrollDirection, attrs); - } - } - } - - public static enum Mode { - - /** - * Disable all Pull-to-Refresh gesture and Refreshing handling - */ - DISABLED(0x0), - - /** - * Only allow the user to Pull from the start of the Refreshable View to - * refresh. The start is either the Top or Left, depending on the - * scrolling direction. - */ - PULL_FROM_START(0x1), - - /** - * Only allow the user to Pull from the end of the Refreshable View to - * refresh. The start is either the Bottom or Right, depending on the - * scrolling direction. - */ - PULL_FROM_END(0x2), - - /** - * Allow the user to both Pull from the start, from the end to refresh. - */ - BOTH(0x3), - - /** - * Disables Pull-to-Refresh gesture handling, but allows manually - * setting the Refresh state via - * {@link PullToRefreshBase#setRefreshing() setRefreshing()}. - */ - MANUAL_REFRESH_ONLY(0x4); - - /** - * @deprecated Use {@link #PULL_FROM_START} from now on. - */ - public static Mode PULL_DOWN_TO_REFRESH = Mode.PULL_FROM_START; - - /** - * @deprecated Use {@link #PULL_FROM_END} from now on. - */ - public static Mode PULL_UP_TO_REFRESH = Mode.PULL_FROM_END; - - /** - * Maps an int to a specific mode. This is needed when saving state, or - * inflating the view from XML where the mode is given through a attr - * int. - * - * @param modeInt - int to map a Mode to - * @return Mode that modeInt maps to, or PULL_FROM_START by default. - */ - static Mode mapIntToValue(final int modeInt) { - for (Mode value : Mode.values()) { - if (modeInt == value.getIntValue()) { - return value; - } - } - - // If not, return default - return getDefault(); - } - - static Mode getDefault() { - return PULL_FROM_START; - } - - private int mIntValue; - - // The modeInt values need to match those from attrs.xml - Mode(int modeInt) { - mIntValue = modeInt; - } - - /** - * @return true if the mode permits Pull-to-Refresh - */ - boolean permitsPullToRefresh() { - return !(this == DISABLED || this == MANUAL_REFRESH_ONLY); - } - - /** - * @return true if this mode wants the Loading Layout Header to be shown - */ - public boolean showHeaderLoadingLayout() { - return this == PULL_FROM_START || this == BOTH; - } - - /** - * @return true if this mode wants the Loading Layout Footer to be shown - */ - public boolean showFooterLoadingLayout() { - return this == PULL_FROM_END || this == BOTH || this == MANUAL_REFRESH_ONLY; - } - - int getIntValue() { - return mIntValue; - } - - } - - // =========================================================== - // Inner, Anonymous Classes, and Enumerations - // =========================================================== - - /** - * Simple Listener that allows you to be notified when the user has scrolled - * to the end of the AdapterView. See ( - * {@link PullToRefreshAdapterViewBase#setOnLastItemVisibleListener}. - * - * @author Chris Banes - */ - public static interface OnLastItemVisibleListener { - - /** - * Called when the user has scrolled to the end of the list - */ - public void onLastItemVisible(); - - } - - /** - * Listener that allows you to be notified when the user has started or - * finished a touch event. Useful when you want to append extra UI events - * (such as sounds). See ( - * {@link PullToRefreshAdapterViewBase#setOnPullEventListener}. - * - * @author Chris Banes - */ - public static interface OnPullEventListener { - - /** - * Called when the internal state has been changed, usually by the user - * pulling. - * - * @param refreshView - View which has had it's state change. - * @param state - The new state of View. - * @param direction - One of {@link Mode#PULL_FROM_START} or - * {@link Mode#PULL_FROM_END} depending on which direction - * the user is pulling. Only useful when state is - * {@link State#PULL_TO_REFRESH} or - * {@link State#RELEASE_TO_REFRESH}. - */ - public void onPullEvent(final PullToRefreshBase refreshView, State state, Mode direction); - - } - - /** - * Simple Listener to listen for any callbacks to Refresh. - * - * @author Chris Banes - */ - public static interface OnRefreshListener { - - /** - * onRefresh will be called for both a Pull from start, and Pull from - * end - */ - public void onRefresh(final PullToRefreshBase refreshView); - - } - - /** - * An advanced version of the Listener to listen for callbacks to Refresh. - * This listener is different as it allows you to differentiate between Pull - * Ups, and Pull Downs. - * - * @author Chris Banes - */ - public static interface OnRefreshListener2 { - // TODO These methods need renaming to START/END rather than DOWN/UP - - /** - * onPullDownToRefresh will be called only when the user has Pulled from - * the start, and released. - */ - public void onPullDownToRefresh(final PullToRefreshBase refreshView); - - /** - * onPullUpToRefresh will be called only when the user has Pulled from - * the end, and released. - */ - public void onPullUpToRefresh(final PullToRefreshBase refreshView); - - } - - public static enum Orientation { - VERTICAL, HORIZONTAL - } - - public static enum State { - - /** - * When the UI is in a state which means that user is not interacting - * with the Pull-to-Refresh function. - */ - RESET(0x0), - - /** - * When the UI is being pulled by the user, but has not been pulled far - * enough so that it refreshes when released. - */ - PULL_TO_REFRESH(0x1), - - /** - * When the UI is being pulled by the user, and has - * been pulled far enough so that it will refresh when released. - */ - RELEASE_TO_REFRESH(0x2), - - /** - * When the UI is currently refreshing, caused by a pull gesture. - */ - REFRESHING(0x8), - - /** - * When the UI is currently refreshing, caused by a call to - * {@link PullToRefreshBase#setRefreshing() setRefreshing()}. - */ - MANUAL_REFRESHING(0x9), - - /** - * When the UI is currently overscrolling, caused by a fling on the - * Refreshable View. - */ - OVERSCROLLING(0x10); - - /** - * Maps an int to a specific state. This is needed when saving state. - * - * @param stateInt - int to map a State to - * @return State that stateInt maps to - */ - static State mapIntToValue(final int stateInt) { - for (State value : State.values()) { - if (stateInt == value.getIntValue()) { - return value; - } - } - - // If not, return default - return RESET; - } - - private int mIntValue; - - State(int intValue) { - mIntValue = intValue; - } - - int getIntValue() { - return mIntValue; - } - } - - final class SmoothScrollRunnable implements Runnable { - private final Interpolator mInterpolator; - private final int mScrollToY; - private final int mScrollFromY; - private final long mDuration; - private OnSmoothScrollFinishedListener mListener; - - private boolean mContinueRunning = true; - private long mStartTime = -1; - private int mCurrentY = -1; - - public SmoothScrollRunnable(int fromY, int toY, long duration, OnSmoothScrollFinishedListener listener) { - mScrollFromY = fromY; - mScrollToY = toY; - mInterpolator = mScrollAnimationInterpolator; - mDuration = duration; - mListener = listener; - } - - @Override - public void run() { - - /** - * Only set mStartTime if this is the first time we're starting, - * else actually calculate the Y delta - */ - if (mStartTime == -1) { - mStartTime = System.currentTimeMillis(); - } else { - - /** - * We do do all calculations in long to reduce software float - * calculations. We use 1000 as it gives us good accuracy and - * small rounding errors - */ - long normalizedTime = (1000 * (System.currentTimeMillis() - mStartTime)) / mDuration; - normalizedTime = Math.max(Math.min(normalizedTime, 1000), 0); - - final int deltaY = Math.round((mScrollFromY - mScrollToY) - * mInterpolator.getInterpolation(normalizedTime / 1000f)); - mCurrentY = mScrollFromY - deltaY; - setHeaderScroll(mCurrentY); - } - - // If we're not at the target Y, keep going... - if (mContinueRunning && mScrollToY != mCurrentY) { - ViewCompat.postOnAnimation(PullToRefreshBase.this, this); - } else { - if (null != mListener) { - mListener.onSmoothScrollFinished(); - } - } - } - - public void stop() { - mContinueRunning = false; - removeCallbacks(this); - } - } - - static interface OnSmoothScrollFinishedListener { - void onSmoothScrollFinished(); - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java deleted file mode 100644 index 649020c6..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ExpandableListView; - -import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor; - -public class PullToRefreshExpandableListView extends PullToRefreshAdapterViewBase { - - public PullToRefreshExpandableListView(Context context) { - super(context); - } - - public PullToRefreshExpandableListView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshExpandableListView(Context context, Mode mode) { - super(context, mode); - } - - public PullToRefreshExpandableListView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.VERTICAL; - } - - @Override - protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) { - final ExpandableListView lv; - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - lv = new InternalExpandableListViewSDK9(context, attrs); - } else { - lv = new InternalExpandableListView(context, attrs); - } - - // Set it to this so it can be used in ListActivity/ListFragment - lv.setId(android.R.id.list); - return lv; - } - - class InternalExpandableListView extends ExpandableListView implements EmptyViewMethodAccessor { - - public InternalExpandableListView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - public void setEmptyView(View emptyView) { - PullToRefreshExpandableListView.this.setEmptyView(emptyView); - } - - @Override - public void setEmptyViewInternal(View emptyView) { - super.setEmptyView(emptyView); - } - } - - @TargetApi(9) - final class InternalExpandableListViewSDK9 extends InternalExpandableListView { - - public InternalExpandableListViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshExpandableListView.this, deltaX, scrollX, deltaY, scrollY, - isTouchEvent); - - return returnValue; - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshGridView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshGridView.java deleted file mode 100644 index f9506889..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshGridView.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.util.AttributeSet; -import android.view.View; -import android.widget.GridView; - -import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor; - -public class PullToRefreshGridView extends PullToRefreshAdapterViewBase { - - public PullToRefreshGridView(Context context) { - super(context); - } - - public PullToRefreshGridView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshGridView(Context context, Mode mode) { - super(context, mode); - } - - public PullToRefreshGridView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.VERTICAL; - } - - @Override - protected final GridView createRefreshableView(Context context, AttributeSet attrs) { - final GridView gv; - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - gv = new InternalGridViewSDK9(context, attrs); - } else { - gv = new InternalGridView(context, attrs); - } - - // Use Generated ID (from res/values/ids.xml) - gv.setId(R.id.gridview); - return gv; - } - - class InternalGridView extends GridView implements EmptyViewMethodAccessor { - - public InternalGridView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - public void setEmptyView(View emptyView) { - PullToRefreshGridView.this.setEmptyView(emptyView); - } - - @Override - public void setEmptyViewInternal(View emptyView) { - super.setEmptyView(emptyView); - } - } - - @TargetApi(9) - final class InternalGridViewSDK9 extends InternalGridView { - - public InternalGridViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshGridView.this, deltaX, scrollX, deltaY, scrollY, isTouchEvent); - - return returnValue; - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java deleted file mode 100644 index 40a2a5b1..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.util.AttributeSet; -import android.view.View; -import android.widget.HorizontalScrollView; - -public class PullToRefreshHorizontalScrollView extends PullToRefreshBase { - - public PullToRefreshHorizontalScrollView(Context context) { - super(context); - } - - public PullToRefreshHorizontalScrollView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshHorizontalScrollView(Context context, Mode mode) { - super(context, mode); - } - - public PullToRefreshHorizontalScrollView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.HORIZONTAL; - } - - @Override - protected HorizontalScrollView createRefreshableView(Context context, AttributeSet attrs) { - HorizontalScrollView scrollView; - - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - scrollView = new InternalHorizontalScrollViewSDK9(context, attrs); - } else { - scrollView = new HorizontalScrollView(context, attrs); - } - - scrollView.setId(R.id.scrollview); - return scrollView; - } - - @Override - protected boolean isReadyForPullStart() { - return mRefreshableView.getScrollX() == 0; - } - - @Override - protected boolean isReadyForPullEnd() { - View scrollViewChild = mRefreshableView.getChildAt(0); - return null != scrollViewChild && mRefreshableView.getScrollX() >= (scrollViewChild.getWidth() - getWidth()); - } - - @TargetApi(9) - final class InternalHorizontalScrollViewSDK9 extends HorizontalScrollView { - - public InternalHorizontalScrollViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshHorizontalScrollView.this, deltaX, scrollX, deltaY, scrollY, - getScrollRange(), isTouchEvent); - - return returnValue; - } - - /** - * Taken from the AOSP ScrollView source - */ - private int getScrollRange() { - int scrollRange = 0; - if (getChildCount() > 0) { - View child = getChildAt(0); - scrollRange = Math.max(0, child.getWidth() - (getWidth() - getPaddingLeft() - getPaddingRight())); - } - return scrollRange; - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java deleted file mode 100644 index 0aa9a27d..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshListView.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.util.AttributeSet; -import android.view.Gravity; -import android.view.MotionEvent; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ListAdapter; -import android.widget.ListView; - -import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor; -import com.handmark.pulltorefresh.library.internal.LoadingLayout; - -public class PullToRefreshListView extends PullToRefreshAdapterViewBase { - - private LoadingLayout mHeaderLoadingView; - private LoadingLayout mFooterLoadingView; - - private FrameLayout mLvFooterLoadingFrame; - - private boolean mListViewExtrasEnabled; - - public PullToRefreshListView(Context context) { - super(context); - } - - public PullToRefreshListView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshListView(Context context, Mode mode) { - super(context, mode); - } - - public PullToRefreshListView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.VERTICAL; - } - - @Override - protected void onRefreshing(final boolean doScroll) { - /** - * If we're not showing the Refreshing view, or the list is empty, the - * the header/footer views won't show so we use the normal method. - */ - ListAdapter adapter = mRefreshableView.getAdapter(); - if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty()) { - super.onRefreshing(doScroll); - return; - } - - super.onRefreshing(false); - - final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView; - final int selection, scrollToY; - - switch (getCurrentMode()) { - case MANUAL_REFRESH_ONLY: - case PULL_FROM_END: - origLoadingView = getFooterLayout(); - listViewLoadingView = mFooterLoadingView; - oppositeListViewLoadingView = mHeaderLoadingView; - selection = mRefreshableView.getCount() - 1; - scrollToY = getScrollY() - getFooterSize(); - break; - case PULL_FROM_START: - default: - origLoadingView = getHeaderLayout(); - listViewLoadingView = mHeaderLoadingView; - oppositeListViewLoadingView = mFooterLoadingView; - selection = 0; - scrollToY = getScrollY() + getHeaderSize(); - break; - } - - // Hide our original Loading View - origLoadingView.reset(); - origLoadingView.hideAllViews(); - - // Make sure the opposite end is hidden too - oppositeListViewLoadingView.setVisibility(View.GONE); - - // Show the ListView Loading View and set it to refresh. - listViewLoadingView.setVisibility(View.VISIBLE); - listViewLoadingView.refreshing(); - - if (doScroll) { - // We need to disable the automatic visibility changes for now - disableLoadingLayoutVisibilityChanges(); - - // We scroll slightly so that the ListView's header/footer is at the - // same Y position as our normal header/footer - setHeaderScroll(scrollToY); - - // Make sure the ListView is scrolled to show the loading - // header/footer - mRefreshableView.setSelection(selection); - - // Smooth scroll as normal - smoothScrollTo(0); - } - } - - @Override - protected void onReset() { - /** - * If the extras are not enabled, just call up to super and return. - */ - if (!mListViewExtrasEnabled) { - super.onReset(); - return; - } - - final LoadingLayout originalLoadingLayout, listViewLoadingLayout; - final int scrollToHeight, selection; - final boolean scrollLvToEdge; - - switch (getCurrentMode()) { - case MANUAL_REFRESH_ONLY: - case PULL_FROM_END: - originalLoadingLayout = getFooterLayout(); - listViewLoadingLayout = mFooterLoadingView; - selection = mRefreshableView.getCount() - 1; - scrollToHeight = getFooterSize(); - scrollLvToEdge = Math.abs(mRefreshableView.getLastVisiblePosition() - selection) <= 1; - break; - case PULL_FROM_START: - default: - originalLoadingLayout = getHeaderLayout(); - listViewLoadingLayout = mHeaderLoadingView; - scrollToHeight = -getHeaderSize(); - selection = 0; - scrollLvToEdge = Math.abs(mRefreshableView.getFirstVisiblePosition() - selection) <= 1; - break; - } - - // If the ListView header loading layout is showing, then we need to - // flip so that the original one is showing instead - if (listViewLoadingLayout.getVisibility() == View.VISIBLE) { - - // Set our Original View to Visible - originalLoadingLayout.showInvisibleViews(); - - // Hide the ListView Header/Footer - listViewLoadingLayout.setVisibility(View.GONE); - - /** - * Scroll so the View is at the same Y as the ListView - * header/footer, but only scroll if: we've pulled to refresh, it's - * positioned correctly - */ - if (scrollLvToEdge && getState() != State.MANUAL_REFRESHING) { - mRefreshableView.setSelection(selection); - setHeaderScroll(scrollToHeight); - } - } - - // Finally, call up to super - super.onReset(); - } - - @Override - protected LoadingLayoutProxy createLoadingLayoutProxy(final boolean includeStart, final boolean includeEnd) { - LoadingLayoutProxy proxy = super.createLoadingLayoutProxy(includeStart, includeEnd); - - if (mListViewExtrasEnabled) { - final Mode mode = getMode(); - - if (includeStart && mode.showHeaderLoadingLayout()) { - proxy.addLayout(mHeaderLoadingView); - } - if (includeEnd && mode.showFooterLoadingLayout()) { - proxy.addLayout(mFooterLoadingView); - } - } - - return proxy; - } - - protected ListView createListView(Context context, AttributeSet attrs) { - final ListView lv; - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - lv = new InternalListViewSDK9(context, attrs); - } else { - lv = new InternalListView(context, attrs); - } - return lv; - } - - @Override - protected ListView createRefreshableView(Context context, AttributeSet attrs) { - ListView lv = createListView(context, attrs); - - // Set it to this so it can be used in ListActivity/ListFragment - lv.setId(android.R.id.list); - return lv; - } - - @Override - protected void handleStyledAttributes(TypedArray a) { - super.handleStyledAttributes(a); - - mListViewExtrasEnabled = a.getBoolean(R.styleable.PullToRefresh_ptrListViewExtrasEnabled, true); - - if (mListViewExtrasEnabled) { - final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, - FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); - - // Create Loading Views ready for use later - FrameLayout frame = new FrameLayout(getContext()); - mHeaderLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_START, a); - mHeaderLoadingView.setVisibility(View.GONE); - frame.addView(mHeaderLoadingView, lp); - mRefreshableView.addHeaderView(frame, null, false); - - mLvFooterLoadingFrame = new FrameLayout(getContext()); - mFooterLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_END, a); - mFooterLoadingView.setVisibility(View.GONE); - mLvFooterLoadingFrame.addView(mFooterLoadingView, lp); - - /** - * If the value for Scrolling While Refreshing hasn't been - * explicitly set via XML, enable Scrolling While Refreshing. - */ - if (!a.hasValue(R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled)) { - setScrollingWhileRefreshingEnabled(true); - } - } - } - - @TargetApi(9) - final class InternalListViewSDK9 extends InternalListView { - - public InternalListViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshListView.this, deltaX, scrollX, deltaY, scrollY, isTouchEvent); - - return returnValue; - } - } - - protected class InternalListView extends ListView implements EmptyViewMethodAccessor { - - private boolean mAddedLvFooter = false; - - public InternalListView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected void dispatchDraw(Canvas canvas) { - /** - * This is a bit hacky, but Samsung's ListView has got a bug in it - * when using Header/Footer Views and the list is empty. This masks - * the issue so that it doesn't cause an FC. See Issue #66. - */ - try { - super.dispatchDraw(canvas); - } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); - } - } - - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - /** - * This is a bit hacky, but Samsung's ListView has got a bug in it - * when using Header/Footer Views and the list is empty. This masks - * the issue so that it doesn't cause an FC. See Issue #66. - */ - try { - return super.dispatchTouchEvent(ev); - } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); - return false; - } - } - - @Override - public void setAdapter(ListAdapter adapter) { - // Add the Footer View at the last possible moment - if (null != mLvFooterLoadingFrame && !mAddedLvFooter) { - addFooterView(mLvFooterLoadingFrame, null, false); - mAddedLvFooter = true; - } - - super.setAdapter(adapter); - } - - @Override - public void setEmptyView(View emptyView) { - PullToRefreshListView.this.setEmptyView(emptyView); - } - - @Override - public void setEmptyViewInternal(View emptyView) { - super.setEmptyView(emptyView); - } - - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java deleted file mode 100644 index 873577bb..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ScrollView; - -public class PullToRefreshScrollView extends PullToRefreshBase { - - public PullToRefreshScrollView(Context context) { - super(context); - } - - public PullToRefreshScrollView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshScrollView(Context context, Mode mode) { - super(context, mode); - } - - public PullToRefreshScrollView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.VERTICAL; - } - - @Override - protected ScrollView createRefreshableView(Context context, AttributeSet attrs) { - ScrollView scrollView; - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - scrollView = new InternalScrollViewSDK9(context, attrs); - } else { - scrollView = new ScrollView(context, attrs); - } - - scrollView.setId(R.id.scrollview); - return scrollView; - } - - @Override - protected boolean isReadyForPullStart() { - return mRefreshableView.getScrollY() == 0; - } - - @Override - protected boolean isReadyForPullEnd() { - View scrollViewChild = mRefreshableView.getChildAt(0); - return null != scrollViewChild && mRefreshableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight()); - } - - @TargetApi(9) - final class InternalScrollViewSDK9 extends ScrollView { - - public InternalScrollViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshScrollView.this, deltaX, scrollX, deltaY, scrollY, - getScrollRange(), isTouchEvent); - - return returnValue; - } - - /** - * Taken from the AOSP ScrollView source - */ - private int getScrollRange() { - int scrollRange = 0; - if (getChildCount() > 0) { - View child = getChildAt(0); - scrollRange = Math.max(0, child.getHeight() - (getHeight() - getPaddingBottom() - getPaddingTop())); - } - return scrollRange; - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java deleted file mode 100644 index 3f873de0..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/PullToRefreshWebView.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * 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; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.os.Bundle; -import android.util.AttributeSet; -import android.util.FloatMath; -import android.webkit.WebChromeClient; -import android.webkit.WebView; - -public class PullToRefreshWebView extends PullToRefreshBase { - - private static final OnRefreshListener defaultOnRefreshListener = new OnRefreshListener() { - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - refreshView.getRefreshableView().reload(); - } - - }; - - private final WebChromeClient defaultWebChromeClient = new WebChromeClient() { - - @Override - public void onProgressChanged(WebView view, int newProgress) { - if (newProgress == 100) { - onRefreshComplete(); - } - } - - }; - - public PullToRefreshWebView(Context context) { - super(context); - - /** - * Added so that by default, Pull-to-Refresh refreshes the page - */ - setOnRefreshListener(defaultOnRefreshListener); - mRefreshableView.setWebChromeClient(defaultWebChromeClient); - } - - public PullToRefreshWebView(Context context, AttributeSet attrs) { - super(context, attrs); - - /** - * Added so that by default, Pull-to-Refresh refreshes the page - */ - setOnRefreshListener(defaultOnRefreshListener); - mRefreshableView.setWebChromeClient(defaultWebChromeClient); - } - - public PullToRefreshWebView(Context context, Mode mode) { - super(context, mode); - - /** - * Added so that by default, Pull-to-Refresh refreshes the page - */ - setOnRefreshListener(defaultOnRefreshListener); - mRefreshableView.setWebChromeClient(defaultWebChromeClient); - } - - public PullToRefreshWebView(Context context, Mode mode, AnimationStyle style) { - super(context, mode, style); - - /** - * Added so that by default, Pull-to-Refresh refreshes the page - */ - setOnRefreshListener(defaultOnRefreshListener); - mRefreshableView.setWebChromeClient(defaultWebChromeClient); - } - - @Override - public final Orientation getPullToRefreshScrollDirection() { - return Orientation.VERTICAL; - } - - @Override - protected WebView createRefreshableView(Context context, AttributeSet attrs) { - WebView webView; - if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { - webView = new InternalWebViewSDK9(context, attrs); - } else { - webView = new WebView(context, attrs); - } - - webView.setId(R.id.webview); - return webView; - } - - @Override - protected boolean isReadyForPullStart() { - return mRefreshableView.getScrollY() == 0; - } - - @Override - protected boolean isReadyForPullEnd() { - float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); - return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); - } - - @Override - protected void onPtrRestoreInstanceState(Bundle savedInstanceState) { - super.onPtrRestoreInstanceState(savedInstanceState); - mRefreshableView.restoreState(savedInstanceState); - } - - @Override - protected void onPtrSaveInstanceState(Bundle saveState) { - super.onPtrSaveInstanceState(saveState); - mRefreshableView.saveState(saveState); - } - - @TargetApi(9) - final class InternalWebViewSDK9 extends WebView { - - // WebView doesn't always scroll back to it's edge so we add some - // fuzziness - static final int OVERSCROLL_FUZZY_THRESHOLD = 2; - - // WebView seems quite reluctant to overscroll so we use the scale - // factor to scale it's value - static final float OVERSCROLL_SCALE_FACTOR = 1.5f; - - public InternalWebViewSDK9(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, - int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - - final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, - scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); - - // Does all of the hard work... - OverscrollHelper.overScrollBy(PullToRefreshWebView.this, deltaX, scrollX, deltaY, scrollY, - getScrollRange(), OVERSCROLL_FUZZY_THRESHOLD, OVERSCROLL_SCALE_FACTOR, isTouchEvent); - - return returnValue; - } - - private int getScrollRange() { - return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()) - - (getHeight() - getPaddingBottom() - getPaddingTop())); - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java deleted file mode 100644 index 78192037..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * 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; - -import java.util.concurrent.atomic.AtomicBoolean; - -import android.content.Context; -import android.util.AttributeSet; -import android.webkit.WebView; - -import com.handmark.pulltorefresh.library.PullToRefreshWebView; - -/** - * 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: - *

- *

- *

- *

- * 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() {
- *   var result = ...  // Probably using the .scrollTop DOM attribute
- *   ptr.isReadyForPullDownResponse(result);
- * }
- * 
- * function isReadyForPullUp() {
- *   var result = ...  // Probably using the .scrollBottom DOM attribute
- *   ptr.isReadyForPullUpResponse(result);
- * }
- * 
- * - * @author Chris Banes - */ -public class PullToRefreshWebView2 extends PullToRefreshWebView { - - static final String JS_INTERFACE_PKG = "ptr"; - static final String DEF_JS_READY_PULL_DOWN_CALL = "javascript:isReadyForPullDown();"; - static final String DEF_JS_READY_PULL_UP_CALL = "javascript:isReadyForPullUp();"; - - public PullToRefreshWebView2(Context context) { - super(context); - } - - public PullToRefreshWebView2(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PullToRefreshWebView2(Context context, Mode mode) { - super(context, mode); - } - - private JsValueCallback mJsCallback; - private final AtomicBoolean mIsReadyForPullDown = new AtomicBoolean(false); - private final AtomicBoolean mIsReadyForPullUp = new AtomicBoolean(false); - - @Override - protected WebView createRefreshableView(Context context, AttributeSet attrs) { - WebView webView = super.createRefreshableView(context, attrs); - - // Need to add JS Interface so we can get the response back - mJsCallback = new JsValueCallback(); - webView.addJavascriptInterface(mJsCallback, JS_INTERFACE_PKG); - - return webView; - } - - @Override - protected boolean isReadyForPullStart() { - // Call Javascript... - getRefreshableView().loadUrl(DEF_JS_READY_PULL_DOWN_CALL); - - // Response will be given to JsValueCallback, which will update - // mIsReadyForPullDown - - return mIsReadyForPullDown.get(); - } - - @Override - protected boolean isReadyForPullEnd() { - // Call Javascript... - getRefreshableView().loadUrl(DEF_JS_READY_PULL_UP_CALL); - - // Response will be given to JsValueCallback, which will update - // mIsReadyForPullUp - - return mIsReadyForPullUp.get(); - } - - /** - * Used for response from Javascript - * - * @author Chris Banes - */ - final class JsValueCallback { - - public void isReadyForPullUpResponse(boolean response) { - mIsReadyForPullUp.set(response); - } - - public void isReadyForPullDownResponse(boolean response) { - mIsReadyForPullDown.set(response); - } - } -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java deleted file mode 100644 index 1574f25e..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/extras/SoundPullEventListener.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * 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; - -import java.util.HashMap; - -import android.content.Context; -import android.media.MediaPlayer; -import android.view.View; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.State; - -public class SoundPullEventListener implements PullToRefreshBase.OnPullEventListener { - - private final Context mContext; - private final HashMap mSoundMap; - - private MediaPlayer mCurrentMediaPlayer; - - /** - * Constructor - * - * @param context - Context - */ - public SoundPullEventListener(Context context) { - mContext = context; - mSoundMap = new HashMap(); - } - - @Override - public final void onPullEvent(PullToRefreshBase refreshView, State event, Mode direction) { - Integer soundResIdObj = mSoundMap.get(event); - if (null != soundResIdObj) { - playSound(soundResIdObj); - } - } - - /** - * 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. - * - * @param event - The event for which the sound will be played. - * @param resId - Resource Id of the sound file to be played (e.g. - * R.raw.pull_sound) - */ - public void addSoundEvent(State event, int resId) { - mSoundMap.put(event, resId); - } - - /** - * Clears all of the previously set sounds and events. - */ - public void clearSounds() { - mSoundMap.clear(); - } - - /** - * Gets the current (or last) MediaPlayer instance. - */ - public MediaPlayer getCurrentMediaPlayer() { - return mCurrentMediaPlayer; - } - - private void playSound(int resId) { - // Stop current player, if there's one playing - if (null != mCurrentMediaPlayer) { - mCurrentMediaPlayer.stop(); - mCurrentMediaPlayer.release(); - } - - mCurrentMediaPlayer = MediaPlayer.create(mContext, resId); - if (null != mCurrentMediaPlayer) { - mCurrentMediaPlayer.start(); - } - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java deleted file mode 100644 index 369f21e8..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/EmptyViewMethodAccessor.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.view.View; - -/** - * Interface that allows PullToRefreshBase to hijack the call to - * AdapterView.setEmptyView() - * - * @author chris - */ -public interface EmptyViewMethodAccessor { - - /** - * Calls upto AdapterView.setEmptyView() - * - * @param emptyView - to set as Empty View - */ - public void setEmptyViewInternal(View emptyView); - - /** - * Should call PullToRefreshBase.setEmptyView() which will then - * automatically call through to setEmptyViewInternal() - * - * @param emptyView - to set as Empty View - */ - public void setEmptyView(View emptyView); - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java deleted file mode 100644 index fef31605..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/FlipLoadingLayout.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Matrix; -import android.graphics.drawable.Drawable; -import android.view.View; -import android.view.ViewGroup; -import android.view.animation.Animation; -import android.view.animation.RotateAnimation; -import android.widget.ImageView.ScaleType; - -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation; -import com.handmark.pulltorefresh.library.R; - -@SuppressLint("ViewConstructor") -public class FlipLoadingLayout extends LoadingLayout { - - static final int FLIP_ANIMATION_DURATION = 150; - - private final Animation mRotateAnimation, mResetRotateAnimation; - - public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) { - super(context, mode, scrollDirection, attrs); - - final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180; - - mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f); - mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); - mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION); - mRotateAnimation.setFillAfter(true); - - mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f); - mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); - mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION); - mResetRotateAnimation.setFillAfter(true); - } - - @Override - protected void onLoadingDrawableSet(Drawable imageDrawable) { - if (null != imageDrawable) { - final int dHeight = imageDrawable.getIntrinsicHeight(); - final int dWidth = imageDrawable.getIntrinsicWidth(); - - /** - * We need to set the width/height of the ImageView so that it is - * square with each side the size of the largest drawable dimension. - * This is so that it doesn't clip when rotated. - */ - ViewGroup.LayoutParams lp = mHeaderImage.getLayoutParams(); - lp.width = lp.height = Math.max(dHeight, dWidth); - mHeaderImage.requestLayout(); - - /** - * We now rotate the Drawable so that is at the correct rotation, - * and is centered. - */ - mHeaderImage.setScaleType(ScaleType.MATRIX); - Matrix matrix = new Matrix(); - matrix.postTranslate((lp.width - dWidth) / 2f, (lp.height - dHeight) / 2f); - matrix.postRotate(getDrawableRotationAngle(), lp.width / 2f, lp.height / 2f); - mHeaderImage.setImageMatrix(matrix); - } - } - - @Override - protected void onPullImpl(float scaleOfLayout) { - // NO-OP - } - - @Override - protected void pullToRefreshImpl() { - // Only start reset Animation, we've previously show the rotate anim - if (mRotateAnimation == mHeaderImage.getAnimation()) { - mHeaderImage.startAnimation(mResetRotateAnimation); - } - } - - @Override - protected void refreshingImpl() { - mHeaderImage.clearAnimation(); - mHeaderImage.setVisibility(View.INVISIBLE); - mHeaderProgress.setVisibility(View.VISIBLE); - } - - @Override - protected void releaseToRefreshImpl() { - mHeaderImage.startAnimation(mRotateAnimation); - } - - @Override - protected void resetImpl() { - mHeaderImage.clearAnimation(); - mHeaderProgress.setVisibility(View.GONE); - mHeaderImage.setVisibility(View.VISIBLE); - } - - @Override - protected int getDefaultDrawableResId() { - return R.drawable.default_ptr_flip; - } - - private float getDrawableRotationAngle() { - float angle = 0f; - switch (mMode) { - case PULL_FROM_END: - if (mScrollDirection == Orientation.HORIZONTAL) { - angle = 90f; - } else { - angle = 180f; - } - break; - - case PULL_FROM_START: - if (mScrollDirection == Orientation.HORIZONTAL) { - angle = 270f; - } - break; - - default: - break; - } - - return angle; - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java deleted file mode 100644 index a9069f2a..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/IndicatorLayout.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.Matrix; -import android.graphics.drawable.Drawable; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.Animation.AnimationListener; -import android.view.animation.AnimationUtils; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; -import android.view.animation.RotateAnimation; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.ImageView.ScaleType; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.R; - -@SuppressLint("ViewConstructor") -public class IndicatorLayout extends FrameLayout implements AnimationListener { - - static final int DEFAULT_ROTATION_ANIMATION_DURATION = 150; - - private Animation mInAnim, mOutAnim; - private ImageView mArrowImageView; - - private final Animation mRotateAnimation, mResetRotateAnimation; - - public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) { - super(context); - mArrowImageView = new ImageView(context); - - Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow); - mArrowImageView.setImageDrawable(arrowD); - - final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding); - mArrowImageView.setPadding(padding, padding, padding, padding); - addView(mArrowImageView); - - int inAnimResId, outAnimResId; - switch (mode) { - case PULL_FROM_END: - inAnimResId = R.anim.slide_in_from_bottom; - outAnimResId = R.anim.slide_out_to_bottom; - setBackgroundResource(R.drawable.indicator_bg_bottom); - - // Rotate Arrow so it's pointing the correct way - mArrowImageView.setScaleType(ScaleType.MATRIX); - Matrix matrix = new Matrix(); - matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f); - mArrowImageView.setImageMatrix(matrix); - break; - default: - case PULL_FROM_START: - inAnimResId = R.anim.slide_in_from_top; - outAnimResId = R.anim.slide_out_to_top; - setBackgroundResource(R.drawable.indicator_bg_top); - break; - } - - mInAnim = AnimationUtils.loadAnimation(context, inAnimResId); - mInAnim.setAnimationListener(this); - - mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId); - mOutAnim.setAnimationListener(this); - - final Interpolator interpolator = new LinearInterpolator(); - mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, - 0.5f); - mRotateAnimation.setInterpolator(interpolator); - mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); - mRotateAnimation.setFillAfter(true); - - mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f); - mResetRotateAnimation.setInterpolator(interpolator); - mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION); - mResetRotateAnimation.setFillAfter(true); - - } - - public final boolean isVisible() { - Animation currentAnim = getAnimation(); - if (null != currentAnim) { - return mInAnim == currentAnim; - } - - return getVisibility() == View.VISIBLE; - } - - public void hide() { - startAnimation(mOutAnim); - } - - public void show() { - mArrowImageView.clearAnimation(); - startAnimation(mInAnim); - } - - @Override - public void onAnimationEnd(Animation animation) { - if (animation == mOutAnim) { - mArrowImageView.clearAnimation(); - setVisibility(View.GONE); - } else if (animation == mInAnim) { - setVisibility(View.VISIBLE); - } - - clearAnimation(); - } - - @Override - public void onAnimationRepeat(Animation animation) { - // NO-OP - } - - @Override - public void onAnimationStart(Animation animation) { - setVisibility(View.VISIBLE); - } - - public void releaseToRefresh() { - mArrowImageView.startAnimation(mRotateAnimation); - } - - public void pullToRefresh() { - mArrowImageView.startAnimation(mResetRotateAnimation); - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java deleted file mode 100644 index 53423790..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/LoadingLayout.java +++ /dev/null @@ -1,399 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.ColorStateList; -import android.content.res.TypedArray; -import android.graphics.Typeface; -import android.graphics.drawable.AnimationDrawable; -import android.graphics.drawable.Drawable; -import android.text.TextUtils; -import android.util.TypedValue; -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; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.handmark.pulltorefresh.library.ILoadingLayout; -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 { - - static final String LOG_TAG = "PullToRefresh-LoadingLayout"; - - static final Interpolator ANIMATION_INTERPOLATOR = new LinearInterpolator(); - - private FrameLayout mInnerLayout; - - protected final ImageView mHeaderImage; - protected final ProgressBar mHeaderProgress; - - private boolean mUseIntrinsicAnimation; - - private final TextView mHeaderText; - private final TextView mSubHeaderText; - - protected final Mode mMode; - protected final Orientation mScrollDirection; - - private CharSequence mPullLabel; - private CharSequence mRefreshingLabel; - private CharSequence mReleaseLabel; - - public LoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) { - super(context); - mMode = mode; - mScrollDirection = scrollDirection; - - switch (scrollDirection) { - case HORIZONTAL: - LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_horizontal, this); - break; - case VERTICAL: - default: - LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header_vertical, this); - break; - } - - mInnerLayout = (FrameLayout) findViewById(R.id.fl_inner); - mHeaderText = (TextView) mInnerLayout.findViewById(R.id.pull_to_refresh_text); - mHeaderProgress = (ProgressBar) mInnerLayout.findViewById(R.id.pull_to_refresh_progress); - 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(); - - switch (mode) { - case PULL_FROM_END: - lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.TOP : Gravity.LEFT; - - // Load in labels - mPullLabel = context.getString(R.string.pull_to_refresh_from_bottom_pull_label); - mRefreshingLabel = context.getString(R.string.pull_to_refresh_from_bottom_refreshing_label); - mReleaseLabel = context.getString(R.string.pull_to_refresh_from_bottom_release_label); - break; - - case PULL_FROM_START: - default: - lp.gravity = scrollDirection == Orientation.VERTICAL ? Gravity.BOTTOM : Gravity.RIGHT; - - // Load in labels - mPullLabel = context.getString(R.string.pull_to_refresh_pull_label); - mRefreshingLabel = context.getString(R.string.pull_to_refresh_refreshing_label); - mReleaseLabel = context.getString(R.string.pull_to_refresh_release_label); - break; - } - - if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) { - Drawable background = attrs.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground); - if (null != background) { - ViewCompat.setBackground(this, background); - } - } - - if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance)) { - TypedValue styleID = new TypedValue(); - attrs.getValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance, styleID); - setTextAppearance(styleID.data); - } - if (attrs.hasValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance)) { - TypedValue styleID = new TypedValue(); - attrs.getValue(R.styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID); - setSubTextAppearance(styleID.data); - } - - // Text Color attrs need to be set after TextAppearance attrs - if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextColor)) { - ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderTextColor); - if (null != colors) { - setTextColor(colors); - } - } - if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderSubTextColor)) { - ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderSubTextColor); - if (null != colors) { - setSubTextColor(colors); - } - } - - // Try and get defined drawable from Attrs - Drawable imageDrawable = null; - if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawable)) { - imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawable); - } - - // Check Specific Drawable from Attrs, these overrite the generic - // drawable attr above - switch (mode) { - case PULL_FROM_START: - default: - if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableStart)) { - imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableStart); - } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableTop)) { - Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart"); - imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableTop); - } - break; - - case PULL_FROM_END: - if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableEnd)) { - imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableEnd); - } else if (attrs.hasValue(R.styleable.PullToRefresh_ptrDrawableBottom)) { - Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd"); - imageDrawable = attrs.getDrawable(R.styleable.PullToRefresh_ptrDrawableBottom); - } - break; - } - - // If we don't have a user defined drawable, load the default - if (null == imageDrawable) { - imageDrawable = context.getResources().getDrawable(getDefaultDrawableResId()); - } - - // Set Drawable, and save width/height - setLoadingDrawable(imageDrawable); - - reset(); - } - - public final void setHeight(int height) { - ViewGroup.LayoutParams lp = getLayoutParams(); - - if (lp != null) { - lp.height = height; - requestLayout(); - } - } - - public final void setWidth(int width) { - ViewGroup.LayoutParams lp = getLayoutParams(); - - if (lp != null) { - lp.width = width; - requestLayout(); - } - } - - public final int getContentSize() { - switch (mScrollDirection) { - case HORIZONTAL: - return mInnerLayout.getWidth(); - case VERTICAL: - default: - return mInnerLayout.getHeight(); - } - } - - 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); - } - } - - public final void onPull(float scaleOfLayout) { - if (!mUseIntrinsicAnimation) { - onPullImpl(scaleOfLayout); - } - } - - public final void pullToRefresh() { - if (null != mHeaderText) { - mHeaderText.setText(mPullLabel); - } - - // Now call the callback - pullToRefreshImpl(); - } - - public final void refreshing() { - if (null != mHeaderText) { - mHeaderText.setText(mRefreshingLabel); - } - - if (mUseIntrinsicAnimation) { - ((AnimationDrawable) mHeaderImage.getDrawable()).start(); - } else { - // Now call the callback - refreshingImpl(); - } - - if (null != mSubHeaderText) { - mSubHeaderText.setVisibility(View.GONE); - } - } - - public final void releaseToRefresh() { - if (null != mHeaderText) { - mHeaderText.setText(mReleaseLabel); - } - - // Now call the callback - releaseToRefreshImpl(); - } - - public final void reset() { - if (null != mHeaderText) { - mHeaderText.setText(mPullLabel); - } - mHeaderImage.setVisibility(View.VISIBLE); - - if (mUseIntrinsicAnimation) { - ((AnimationDrawable) mHeaderImage.getDrawable()).stop(); - } else { - // Now call the callback - resetImpl(); - } - - if (null != mSubHeaderText) { - if (TextUtils.isEmpty(mSubHeaderText.getText())) { - mSubHeaderText.setVisibility(View.GONE); - } else { - mSubHeaderText.setVisibility(View.VISIBLE); - } - } - } - - @Override - public void setLastUpdatedLabel(CharSequence label) { - setSubHeaderText(label); - } - - public final void setLoadingDrawable(Drawable imageDrawable) { - // Set Drawable - mHeaderImage.setImageDrawable(imageDrawable); - mUseIntrinsicAnimation = (imageDrawable instanceof AnimationDrawable); - - // Now call the callback - onLoadingDrawableSet(imageDrawable); - } - - public void setPullLabel(CharSequence pullLabel) { - mPullLabel = pullLabel; - } - - public void setRefreshingLabel(CharSequence refreshingLabel) { - mRefreshingLabel = refreshingLabel; - } - - public void setReleaseLabel(CharSequence releaseLabel) { - mReleaseLabel = releaseLabel; - } - - @Override - 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 - */ - - protected abstract int getDefaultDrawableResId(); - - protected abstract void onLoadingDrawableSet(Drawable imageDrawable); - - protected abstract void onPullImpl(float scaleOfLayout); - - protected abstract void pullToRefreshImpl(); - - protected abstract void refreshingImpl(); - - protected abstract void releaseToRefreshImpl(); - - protected abstract void resetImpl(); - - private void setSubHeaderText(CharSequence label) { - if (null != mSubHeaderText) { - if (TextUtils.isEmpty(label)) { - mSubHeaderText.setVisibility(View.GONE); - } else { - mSubHeaderText.setText(label); - - // Only set it to Visible if we're GONE, otherwise VISIBLE will - // be set soon - if (View.GONE == mSubHeaderText.getVisibility()) { - mSubHeaderText.setVisibility(View.VISIBLE); - } - } - } - } - - private void setSubTextAppearance(int value) { - if (null != mSubHeaderText) { - mSubHeaderText.setTextAppearance(getContext(), value); - } - } - - private void setSubTextColor(ColorStateList color) { - if (null != mSubHeaderText) { - mSubHeaderText.setTextColor(color); - } - } - - private void setTextAppearance(int value) { - if (null != mHeaderText) { - mHeaderText.setTextAppearance(getContext(), value); - } - if (null != mSubHeaderText) { - mSubHeaderText.setTextAppearance(getContext(), value); - } - } - - private void setTextColor(ColorStateList color) { - if (null != mHeaderText) { - mHeaderText.setTextColor(color); - } - if (null != mSubHeaderText) { - mSubHeaderText.setTextColor(color); - } - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java deleted file mode 100644 index bda7b2fc..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/RotateLoadingLayout.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Matrix; -import android.graphics.drawable.Drawable; -import android.view.animation.Animation; -import android.view.animation.RotateAnimation; -import android.widget.ImageView.ScaleType; - -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation; -import com.handmark.pulltorefresh.library.R; - -public class RotateLoadingLayout extends LoadingLayout { - - static final int ROTATION_ANIMATION_DURATION = 1200; - - private final Animation mRotateAnimation; - private final Matrix mHeaderImageMatrix; - - private float mRotationPivotX, mRotationPivotY; - - private final boolean mRotateDrawableWhilePulling; - - public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { - super(context, mode, scrollDirection, attrs); - - mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true); - - mHeaderImage.setScaleType(ScaleType.MATRIX); - mHeaderImageMatrix = new Matrix(); - mHeaderImage.setImageMatrix(mHeaderImageMatrix); - - mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, - 0.5f); - mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); - mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION); - mRotateAnimation.setRepeatCount(Animation.INFINITE); - mRotateAnimation.setRepeatMode(Animation.RESTART); - } - - public void onLoadingDrawableSet(Drawable imageDrawable) { - if (null != imageDrawable) { - mRotationPivotX = Math.round(imageDrawable.getIntrinsicWidth() / 2f); - mRotationPivotY = Math.round(imageDrawable.getIntrinsicHeight() / 2f); - } - } - - protected void onPullImpl(float scaleOfLayout) { - float angle; - if (mRotateDrawableWhilePulling) { - angle = scaleOfLayout * 90f; - } else { - angle = Math.max(0f, Math.min(180f, scaleOfLayout * 360f - 180f)); - } - - mHeaderImageMatrix.setRotate(angle, mRotationPivotX, mRotationPivotY); - mHeaderImage.setImageMatrix(mHeaderImageMatrix); - } - - @Override - protected void refreshingImpl() { - mHeaderImage.startAnimation(mRotateAnimation); - } - - @Override - protected void resetImpl() { - mHeaderImage.clearAnimation(); - resetImageRotation(); - } - - private void resetImageRotation() { - if (null != mHeaderImageMatrix) { - mHeaderImageMatrix.reset(); - mHeaderImage.setImageMatrix(mHeaderImageMatrix); - } - } - - @Override - protected void pullToRefreshImpl() { - // NO-OP - } - - @Override - protected void releaseToRefreshImpl() { - // NO-OP - } - - @Override - protected int getDefaultDrawableResId() { - return R.drawable.default_ptr_rotate; - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/Utils.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/Utils.java deleted file mode 100644 index 73432189..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/Utils.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.handmark.pulltorefresh.library.internal; - -import android.util.Log; - -public class Utils { - - static final String LOG_TAG = "PullToRefresh"; - - public static void warnDeprecation(String depreacted, String replacement) { - Log.w(LOG_TAG, "You're using the deprecated " + depreacted + " attr, please switch over to " + replacement); - } - -} diff --git a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/ViewCompat.java b/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/ViewCompat.java deleted file mode 100644 index 618bace0..00000000 --- a/Android-PullToRefresh/library/src/com/handmark/pulltorefresh/library/internal/ViewCompat.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * 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.internal; - -import android.annotation.TargetApi; -import android.graphics.drawable.Drawable; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.view.View; - -@SuppressWarnings("deprecation") -public class ViewCompat { - - public static void postOnAnimation(View view, Runnable runnable) { - if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { - SDK16.postOnAnimation(view, runnable); - } else { - view.postDelayed(runnable, 16); - } - } - - public static void setBackground(View view, Drawable background) { - if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { - SDK16.setBackground(view, background); - } else { - view.setBackgroundDrawable(background); - } - } - - public static void setLayerType(View view, int layerType) { - if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { - SDK11.setLayerType(view, layerType); - } - } - - @TargetApi(11) - static class SDK11 { - - public static void setLayerType(View view, int layerType) { - view.setLayerType(layerType, null); - } - } - - @TargetApi(16) - static class SDK16 { - - public static void postOnAnimation(View view, Runnable runnable) { - view.postOnAnimation(runnable); - } - - public static void setBackground(View view, Drawable background) { - view.setBackground(background); - } - - } - -} diff --git a/Android-PullToRefresh/pom.xml b/Android-PullToRefresh/pom.xml deleted file mode 100644 index 1a755fea..00000000 --- a/Android-PullToRefresh/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/Android-PullToRefresh/sample/AndroidManifest.xml b/Android-PullToRefresh/sample/AndroidManifest.xml deleted file mode 100644 index af06dffa..00000000 --- a/Android-PullToRefresh/sample/AndroidManifest.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/LICENSE b/Android-PullToRefresh/sample/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/Android-PullToRefresh/sample/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/Android-PullToRefresh/sample/assets/ptr_webview2_sample.html b/Android-PullToRefresh/sample/assets/ptr_webview2_sample.html deleted file mode 100644 index ca55914b..00000000 --- a/Android-PullToRefresh/sample/assets/ptr_webview2_sample.html +++ /dev/null @@ -1,28 +0,0 @@ - - -PullToRefreshWebView2 Sample - - - - - - -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin mauris varius lacus porttitor eget blandit massa facilisis. Nulla pellentesque odio sed purus fermentum vitae viverra orci faucibus. Sed ullamcorper condimentum vulputate. Curabitur sit amet convallis velit. Vestibulum posuere eleifend risus ac adipiscing. Nam pulvinar nulla a velit faucibus imperdiet. Praesent eget nisi ac justo blandit sagittis. Maecenas at leo nisi, nec varius nisl.

-

In hac habitasse platea dictumst. Morbi neque tortor, vestibulum sed viverra a, luctus vel lorem. Nunc turpis eros, varius eget commodo et, euismod at eros. Sed tincidunt mi purus, vel posuere dui. Vestibulum ante lectus, porta sed mattis bibendum, scelerisque cursus sapien. Cras ultrices imperdiet fermentum. Aenean nisi nulla, euismod non blandit ac, dictum quis libero. Morbi consectetur tempor mollis. Suspendisse eget nunc arcu, vel ullamcorper augue. Integer malesuada, diam nec faucibus mollis, nisl velit euismod enim, ac mattis justo neque sit amet mauris. Vivamus pretium imperdiet pharetra.

-

Integer sagittis augue sit amet lectus pulvinar sit amet commodo tortor mattis. Maecenas quis tellus eget ante eleifend sollicitudin non et nibh. Maecenas luctus euismod tristique. Fusce in odio nec diam blandit facilisis. Sed nec arcu eros. Vivamus quis tortor a metus tempus aliquam eget volutpat magna. Pellentesque id ultrices dolor. Sed blandit aliquet quam. Phasellus dapibus euismod vulputate. Aenean blandit, elit vitae vestibulum tincidunt, metus dui accumsan nulla, sit amet vehicula mauris lacus in est. Etiam dignissim pellentesque nulla vel malesuada. Cras vel lorem justo.

-

Sed condimentum nisl sit amet libero vestibulum hendrerit. Duis auctor tempus placerat. Proin velit ante, ornare nec dictum nec, hendrerit eu arcu. Etiam ut diam ornare quam venenatis pulvinar vitae vel leo. Vivamus consectetur, ante id interdum rhoncus, magna eros pulvinar lacus, a gravida nibh arcu vitae eros. Nulla scelerisque laoreet feugiat. Mauris sit amet gravida felis.

-

Nulla ac dolor sapien, vestibulum venenatis justo. Cras placerat velit vitae nibh pellentesque ultricies. Suspendisse adipiscing enim eu justo iaculis eu pretium urna fermentum. Duis porttitor nunc non nunc mattis vestibulum. Etiam elit tellus, feugiat in bibendum eget, adipiscing nec metus. Ut ut sem lacus, quis faucibus diam. Curabitur a nulla fermentum tortor dignissim posuere. Fusce faucibus ante ut sem imperdiet imperdiet eget vitae lorem. Etiam fringilla ornare ipsum, in sagittis quam ornare vitae. Nullam venenatis orci sit amet sapien adipiscing gravida. Proin turpis lectus, hendrerit vitae vehicula ut, auctor ac lectus. Pellentesque sollicitudin blandit ligula quis commodo. Mauris vulputate lectus in velit luctus aliquam. Quisque eget tincidunt elit. Quisque et augue quam, sed scelerisque eros.

- - - - diff --git a/Android-PullToRefresh/sample/libs/android-support-v4.jar b/Android-PullToRefresh/sample/libs/android-support-v4.jar deleted file mode 100644 index feaf44f8..00000000 Binary files a/Android-PullToRefresh/sample/libs/android-support-v4.jar and /dev/null differ diff --git a/Android-PullToRefresh/sample/pom.xml b/Android-PullToRefresh/sample/pom.xml deleted file mode 100644 index dafd460f..00000000 --- a/Android-PullToRefresh/sample/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - 4.0.0 - - com.github.chrisbanes.pulltorefresh - sample - apk - Android-PullToRefresh Sample - - - com.github.chrisbanes.pulltorefresh - parent - 2.1.2-SNAPSHOT - - - - - com.google.android - android - - - ${project.groupId} - library - apklib - ${project.version} - - - ${project.groupId} - extra-listfragment - apklib - ${project.version} - - - ${project.groupId} - extra-viewpager - apklib - ${project.version} - - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - org.apache.maven.plugins - maven-eclipse-plugin - - - com.google.android:android - commons-logging:commons-logging - xerces:xmlParserAPIs - xpp3:xpp3 - - - - - - diff --git a/Android-PullToRefresh/sample/project.properties b/Android-PullToRefresh/sample/project.properties deleted file mode 100644 index 87f8ddd3..00000000 --- a/Android-PullToRefresh/sample/project.properties +++ /dev/null @@ -1,14 +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.reference.1=../library -android.library.reference.2=../extras/PullToRefreshListFragment -android.library.reference.3=../extras/PullToRefreshViewPager diff --git a/Android-PullToRefresh/sample/res/drawable-hdpi/android.png b/Android-PullToRefresh/sample/res/drawable-hdpi/android.png deleted file mode 100644 index 08acbfc5..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-hdpi/android.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable-hdpi/icon.png b/Android-PullToRefresh/sample/res/drawable-hdpi/icon.png deleted file mode 100644 index e3684bd6..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable-ldpi/icon.png b/Android-PullToRefresh/sample/res/drawable-ldpi/icon.png deleted file mode 100644 index 66fd3887..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable-mdpi/icon.png b/Android-PullToRefresh/sample/res/drawable-mdpi/icon.png deleted file mode 100644 index 4b843b5b..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable-nodpi/wallpaper.jpg b/Android-PullToRefresh/sample/res/drawable-nodpi/wallpaper.jpg deleted file mode 100644 index 6bc52926..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-nodpi/wallpaper.jpg and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable-xhdpi/android.png b/Android-PullToRefresh/sample/res/drawable-xhdpi/android.png deleted file mode 100644 index 0941b379..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable-xhdpi/android.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/drawable/icon.png b/Android-PullToRefresh/sample/res/drawable/icon.png deleted file mode 100644 index 8074c4c5..00000000 Binary files a/Android-PullToRefresh/sample/res/drawable/icon.png and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_expandable_list.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_expandable_list.xml deleted file mode 100644 index d366c344..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_expandable_list.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_grid.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_grid.xml deleted file mode 100644 index c4876aef..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_grid.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_horizontalscrollview.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_horizontalscrollview.xml deleted file mode 100644 index 5f9307b1..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_horizontalscrollview.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_list.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_list.xml deleted file mode 100644 index 289448f1..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_list.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_list_fragment.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_list_fragment.xml deleted file mode 100644 index e3cf94b4..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_list_fragment.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_list_in_vp.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_list_in_vp.xml deleted file mode 100644 index a0473768..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_list_in_vp.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_scrollview.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_scrollview.xml deleted file mode 100644 index 9aaefe37..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_scrollview.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_viewpager.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_viewpager.xml deleted file mode 100644 index 03c8eee7..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_viewpager.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_webview.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_webview.xml deleted file mode 100644 index c0d23821..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_webview.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/activity_ptr_webview2.xml b/Android-PullToRefresh/sample/res/layout/activity_ptr_webview2.xml deleted file mode 100644 index a9bd1ef2..00000000 --- a/Android-PullToRefresh/sample/res/layout/activity_ptr_webview2.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/layout/layout_listview_in_viewpager.xml b/Android-PullToRefresh/sample/res/layout/layout_listview_in_viewpager.xml deleted file mode 100644 index 3bfc689d..00000000 --- a/Android-PullToRefresh/sample/res/layout/layout_listview_in_viewpager.xml +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/Android-PullToRefresh/sample/res/raw/pull_event.mp3 b/Android-PullToRefresh/sample/res/raw/pull_event.mp3 deleted file mode 100644 index 075ad08e..00000000 Binary files a/Android-PullToRefresh/sample/res/raw/pull_event.mp3 and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/raw/refreshing_sound.mp3 b/Android-PullToRefresh/sample/res/raw/refreshing_sound.mp3 deleted file mode 100644 index 9ebe0b61..00000000 Binary files a/Android-PullToRefresh/sample/res/raw/refreshing_sound.mp3 and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/raw/reset_sound.mp3 b/Android-PullToRefresh/sample/res/raw/reset_sound.mp3 deleted file mode 100644 index 8e4c9e3a..00000000 Binary files a/Android-PullToRefresh/sample/res/raw/reset_sound.mp3 and /dev/null differ diff --git a/Android-PullToRefresh/sample/res/values/strings.xml b/Android-PullToRefresh/sample/res/values/strings.xml deleted file mode 100644 index d2e134d7..00000000 --- a/Android-PullToRefresh/sample/res/values/strings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Hello World, PullToRefreshActivity! - pulltorefreshexample - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin mauris varius lacus porttitor eget blandit massa facilisis. Nulla pellentesque odio sed purus fermentum vitae viverra orci faucibus. Sed ullamcorper condimentum vulputate. Curabitur sit amet convallis velit. Vestibulum posuere eleifend risus ac adipiscing. Nam pulvinar nulla a velit faucibus imperdiet. Praesent eget nisi ac justo blandit sagittis. Maecenas at leo nisi, nec varius nisl.\nIn hac habitasse platea dictumst. Morbi neque tortor, vestibulum sed viverra a, luctus vel lorem. Nunc turpis eros, varius eget commodo et, euismod at eros. Sed tincidunt mi purus, vel posuere dui. Vestibulum ante lectus, porta sed mattis bibendum, scelerisque cursus sapien. Cras ultrices imperdiet fermentum. Aenean nisi nulla, euismod non blandit ac, dictum quis libero. Morbi consectetur tempor mollis. Suspendisse eget nunc arcu, vel ullamcorper augue. Integer malesuada, diam nec faucibus mollis, nisl velit euismod enim, ac mattis justo neque sit amet mauris. Vivamus pretium imperdiet pharetra.\nInteger sagittis augue sit amet lectus pulvinar sit amet commodo tortor mattis. Maecenas quis tellus eget ante eleifend sollicitudin non et nibh. Maecenas luctus euismod tristique. Fusce in odio nec diam blandit facilisis. Sed nec arcu eros. Vivamus quis tortor a metus tempus aliquam eget volutpat magna. Pellentesque id ultrices dolor. Sed blandit aliquet quam. Phasellus dapibus euismod vulputate. Aenean blandit, elit vitae vestibulum tincidunt, metus dui accumsan nulla, sit amet vehicula mauris lacus in est. Etiam dignissim pellentesque nulla vel malesuada. Cras vel lorem justo.\nSed condimentum nisl sit amet libero vestibulum hendrerit. Duis auctor tempus placerat. Proin velit ante, ornare nec dictum nec, hendrerit eu arcu. Etiam ut diam ornare quam venenatis pulvinar vitae vel leo. Vivamus consectetur, ante id interdum rhoncus, magna eros pulvinar lacus, a gravida nibh arcu vitae eros. Nulla scelerisque laoreet feugiat. Mauris sit amet gravida felis.\nNulla ac dolor sapien, vestibulum venenatis justo. Cras placerat velit vitae nibh pellentesque ultricies. Suspendisse adipiscing enim eu justo iaculis eu pretium urna fermentum. Duis porttitor nunc non nunc mattis vestibulum. Etiam elit tellus, feugiat in bibendum eget, adipiscing nec metus. Ut ut sem lacus, quis faucibus diam. Curabitur a nulla fermentum tortor dignissim posuere. Fusce faucibus ante ut sem imperdiet imperdiet eget vitae lorem. Etiam fringilla ornare ipsum, in sagittis quam ornare vitae. Nullam venenatis orci sit amet sapien adipiscing gravida. Proin turpis lectus, hendrerit vitae vehicula ut, auctor ac lectus. Pellentesque sollicitudin blandit ligula quis commodo. Mauris vulputate lectus in velit luctus aliquam. Quisque eget tincidunt elit. Quisque et augue quam, sed scelerisque eros. - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/res/values/styles.xml b/Android-PullToRefresh/sample/res/values/styles.xml deleted file mode 100644 index 609c2762..00000000 --- a/Android-PullToRefresh/sample/res/values/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java deleted file mode 100644 index 8eb47bc9..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/LauncherActivity.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.ListActivity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.ListView; - -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" }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, options)); - } - - @Override - protected void onListItemClick(ListView l, View v, int position, long id) { - Intent intent; - - switch (position) { - default: - case 0: - intent = new Intent(this, PullToRefreshListActivity.class); - break; - case 1: - intent = new Intent(this, PullToRefreshExpandableListActivity.class); - break; - case 2: - intent = new Intent(this, PullToRefreshGridActivity.class); - break; - case 3: - intent = new Intent(this, PullToRefreshWebViewActivity.class); - break; - case 4: - intent = new Intent(this, PullToRefreshScrollViewActivity.class); - break; - case 5: - intent = new Intent(this, PullToRefreshHorizontalScrollViewActivity.class); - break; - case 6: - intent = new Intent(this, PullToRefreshViewPagerActivity.class); - break; - case 7: - intent = new Intent(this, PullToRefreshListFragmentActivity.class); - break; - case 8: - intent = new Intent(this, PullToRefreshWebView2Activity.class); - break; - case 9: - intent = new Intent(this, PullToRefreshListInViewPagerActivity.class); - break; - } - - startActivity(intent); - } - -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java deleted file mode 100644 index 05de38c8..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import android.app.ExpandableListActivity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.widget.ExpandableListView; -import android.widget.SimpleExpandableListAdapter; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView; - -public final class PullToRefreshExpandableListActivity extends ExpandableListActivity { - private static final String KEY = "key"; - - private List> groupData = new ArrayList>(); - private List>> childData = new ArrayList>>(); - - private PullToRefreshExpandableListView mPullRefreshListView; - private SimpleExpandableListAdapter mAdapter; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_expandable_list); - - mPullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list); - - // Set a listener to be invoked when the list should be refreshed. - mPullRefreshListView.setOnRefreshListener(new OnRefreshListener() { - @Override - public void onRefresh(PullToRefreshBase refreshView) { - // Do work to refresh the list here. - new GetDataTask().execute(); - } - }); - - for (String group : mGroupStrings) { - Map groupMap1 = new HashMap(); - groupData.add(groupMap1); - groupMap1.put(KEY, group); - - List> childList = new ArrayList>(); - for (String string : mChildStrings) { - Map childMap = new HashMap(); - childList.add(childMap); - childMap.put(KEY, string); - } - childData.add(childList); - } - - mAdapter = new SimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1, - new String[] { KEY }, new int[] { android.R.id.text1 }, childData, - android.R.layout.simple_expandable_list_item_2, new String[] { KEY }, new int[] { android.R.id.text1 }); - setListAdapter(mAdapter); - } - - private class GetDataTask extends AsyncTask { - - @Override - protected String[] doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - return mChildStrings; - } - - @Override - protected void onPostExecute(String[] result) { - Map newMap = new HashMap(); - newMap.put(KEY, "Added after refresh..."); - groupData.add(newMap); - - List> childList = new ArrayList>(); - for (String string : mChildStrings) { - Map childMap = new HashMap(); - childMap.put(KEY, string); - childList.add(childMap); - } - childData.add(childList); - - mAdapter.notifyDataSetChanged(); - - // Call onRefreshComplete when the list has been refreshed. - mPullRefreshListView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - - private String[] mChildStrings = { "Child One", "Child Two", "Child Three", "Child Four", "Child Five", "Child Six" }; - - private String[] mGroupStrings = { "Group One", "Group Two", "Group Three" }; -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java deleted file mode 100644 index 9d87e357..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshGridActivity.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import java.util.Arrays; -import java.util.LinkedList; - -import android.app.Activity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.view.Gravity; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.ArrayAdapter; -import android.widget.GridView; -import android.widget.TextView; -import android.widget.Toast; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2; -import com.handmark.pulltorefresh.library.PullToRefreshGridView; - -public final class PullToRefreshGridActivity extends Activity { - - static final int MENU_SET_MODE = 0; - - private LinkedList mListItems; - private PullToRefreshGridView mPullRefreshGridView; - private GridView mGridView; - private ArrayAdapter mAdapter; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_grid); - - mPullRefreshGridView = (PullToRefreshGridView) findViewById(R.id.pull_refresh_grid); - mGridView = mPullRefreshGridView.getRefreshableView(); - - // Set a listener to be invoked when the list should be refreshed. - mPullRefreshGridView.setOnRefreshListener(new OnRefreshListener2() { - - @Override - public void onPullDownToRefresh(PullToRefreshBase refreshView) { - Toast.makeText(PullToRefreshGridActivity.this, "Pull Down!", Toast.LENGTH_SHORT).show(); - new GetDataTask().execute(); - } - - @Override - public void onPullUpToRefresh(PullToRefreshBase refreshView) { - Toast.makeText(PullToRefreshGridActivity.this, "Pull Up!", Toast.LENGTH_SHORT).show(); - new GetDataTask().execute(); - } - - }); - - mListItems = new LinkedList(); - - TextView tv = new TextView(this); - tv.setGravity(Gravity.CENTER); - tv.setText("Empty View, Pull Down/Up to Add Items"); - mPullRefreshGridView.setEmptyView(tv); - - mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mListItems); - mGridView.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. - mPullRefreshGridView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, MENU_SET_MODE, 0, - mPullRefreshGridView.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(mPullRefreshGridView.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: - mPullRefreshGridView - .setMode(mPullRefreshGridView.getMode() == Mode.BOTH ? Mode.PULL_FROM_START - : Mode.BOTH); - break; - } - - return super.onOptionsItemSelected(item); - } - - private String[] mStrings = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler" }; -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java deleted file mode 100644 index 81e21652..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshHorizontalScrollViewActivity.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.Activity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.widget.HorizontalScrollView; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshHorizontalScrollView; - -public final class PullToRefreshHorizontalScrollViewActivity extends Activity { - - PullToRefreshHorizontalScrollView mPullRefreshScrollView; - HorizontalScrollView mScrollView; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_horizontalscrollview); - - mPullRefreshScrollView = (PullToRefreshHorizontalScrollView) findViewById(R.id.pull_refresh_horizontalscrollview); - mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener() { - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - new GetDataTask().execute(); - } - }); - - mScrollView = mPullRefreshScrollView.getRefreshableView(); - } - - private class GetDataTask extends AsyncTask { - - @Override - protected String[] doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return null; - } - - @Override - protected void onPostExecute(String[] result) { - // Do some stuff here - - // Call onRefreshComplete when the list has been refreshed. - mPullRefreshScrollView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java deleted file mode 100644 index 13b572ea..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListActivity.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import java.util.Arrays; -import java.util.LinkedList; - -import android.app.ListActivity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.text.format.DateUtils; -import android.view.ContextMenu; -import android.view.ContextMenu.ContextMenuInfo; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.AdapterView.AdapterContextMenuInfo; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.Toast; - -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; - -public final class PullToRefreshListActivity extends ListActivity { - - static final int MENU_MANUAL_REFRESH = 0; - static final int MENU_DISABLE_SCROLL = 1; - static final int MENU_SET_MODE = 2; - static final int MENU_DEMO = 3; - - private LinkedList mListItems; - private PullToRefreshListView mPullRefreshListView; - private ArrayAdapter mAdapter; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_list); - - mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list); - - // Set a listener to be invoked when the list should be refreshed. - mPullRefreshListView.setOnRefreshListener(new OnRefreshListener() { - @Override - public void onRefresh(PullToRefreshBase refreshView) { - String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(), - DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); - - // Update the LastUpdatedLabel - refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label); - - // Do work to refresh the list here. - new GetDataTask().execute(); - } - }); - - // Add an end-of-list listener - mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() { - - @Override - public void onLastItemVisible() { - Toast.makeText(PullToRefreshListActivity.this, "End of List!", Toast.LENGTH_SHORT).show(); - } - }); - - ListView actualListView = mPullRefreshListView.getRefreshableView(); - - // Need to use the Actual ListView when registering for Context Menu - registerForContextMenu(actualListView); - - mListItems = new LinkedList(); - mListItems.addAll(Arrays.asList(mStrings)); - - mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mListItems); - - /** - * Add Sound Event Listener - */ - SoundPullEventListener soundListener = new SoundPullEventListener(this); - soundListener.addSoundEvent(State.PULL_TO_REFRESH, R.raw.pull_event); - soundListener.addSoundEvent(State.RESET, R.raw.reset_sound); - soundListener.addSoundEvent(State.REFRESHING, R.raw.refreshing_sound); - mPullRefreshListView.setOnPullEventListener(soundListener); - - // You can also just use setListAdapter(mAdapter) or - // mPullRefreshListView.setAdapter(mAdapter) - actualListView.setAdapter(mAdapter); - } - - private class GetDataTask extends AsyncTask { - - @Override - protected String[] doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return mStrings; - } - - @Override - protected void onPostExecute(String[] result) { - mListItems.addFirst("Added after refresh..."); - mAdapter.notifyDataSetChanged(); - - // Call onRefreshComplete when the list has been refreshed. - mPullRefreshListView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, MENU_MANUAL_REFRESH, 0, "Manual Refresh"); - menu.add(0, MENU_DISABLE_SCROLL, 1, - mPullRefreshListView.isScrollingWhileRefreshingEnabled() ? "Disable Scrolling while Refreshing" - : "Enable Scrolling while Refreshing"); - menu.add(0, MENU_SET_MODE, 0, mPullRefreshListView.getMode() == Mode.BOTH ? "Change to MODE_PULL_DOWN" - : "Change to MODE_PULL_BOTH"); - menu.add(0, MENU_DEMO, 0, "Demo"); - return super.onCreateOptionsMenu(menu); - } - - @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { - AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; - - menu.setHeaderTitle("Item: " + getListView().getItemAtPosition(info.position)); - menu.add("Item 1"); - menu.add("Item 2"); - menu.add("Item 3"); - menu.add("Item 4"); - - super.onCreateContextMenu(menu, v, menuInfo); - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - MenuItem disableItem = menu.findItem(MENU_DISABLE_SCROLL); - disableItem - .setTitle(mPullRefreshListView.isScrollingWhileRefreshingEnabled() ? "Disable Scrolling while Refreshing" - : "Enable Scrolling while Refreshing"); - - MenuItem setModeItem = menu.findItem(MENU_SET_MODE); - setModeItem.setTitle(mPullRefreshListView.getMode() == Mode.BOTH ? "Change to MODE_FROM_START" - : "Change to MODE_PULL_BOTH"); - - return super.onPrepareOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - - switch (item.getItemId()) { - case MENU_MANUAL_REFRESH: - new GetDataTask().execute(); - mPullRefreshListView.setRefreshing(false); - break; - case MENU_DISABLE_SCROLL: - mPullRefreshListView.setScrollingWhileRefreshingEnabled(!mPullRefreshListView - .isScrollingWhileRefreshingEnabled()); - break; - case MENU_SET_MODE: - mPullRefreshListView.setMode(mPullRefreshListView.getMode() == Mode.BOTH ? Mode.PULL_FROM_START - : Mode.BOTH); - break; - case MENU_DEMO: - mPullRefreshListView.demo(); - break; - } - - return super.onOptionsItemSelected(item); - } - - private String[] mStrings = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler", "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler" }; -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java deleted file mode 100644 index 4361c604..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListFragmentActivity.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import java.util.Arrays; -import java.util.LinkedList; - -import android.os.AsyncTask; -import android.os.Bundle; -import android.support.v4.app.FragmentActivity; -import android.widget.ArrayAdapter; -import android.widget.ListView; - -import com.handmark.pulltorefresh.extras.listfragment.PullToRefreshListFragment; -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshListView; - -public final class PullToRefreshListFragmentActivity extends FragmentActivity implements OnRefreshListener { - - private LinkedList mListItems; - private ArrayAdapter mAdapter; - - private PullToRefreshListFragment mPullRefreshListFragment; - private PullToRefreshListView mPullRefreshListView; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_list_fragment); - - mPullRefreshListFragment = (PullToRefreshListFragment) getSupportFragmentManager().findFragmentById( - R.id.frag_ptr_list); - - // Get PullToRefreshListView from Fragment - mPullRefreshListView = mPullRefreshListFragment.getPullToRefreshListView(); - - // Set a listener to be invoked when the list should be refreshed. - mPullRefreshListView.setOnRefreshListener(this); - - // You can also just use mPullRefreshListFragment.getListView() - ListView actualListView = mPullRefreshListView.getRefreshableView(); - - mListItems = new LinkedList(); - mListItems.addAll(Arrays.asList(mStrings)); - mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mListItems); - - // You can also just use setListAdapter(mAdapter) or - // mPullRefreshListView.setAdapter(mAdapter) - actualListView.setAdapter(mAdapter); - - mPullRefreshListFragment.setListShown(true); - } - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - // Do work to refresh the list here. - new GetDataTask().execute(); - } - - private class GetDataTask extends AsyncTask { - - @Override - protected String[] doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return mStrings; - } - - @Override - protected void onPostExecute(String[] result) { - mListItems.addFirst("Added after refresh..."); - mAdapter.notifyDataSetChanged(); - - // Call onRefreshComplete when the list has been refreshed. - mPullRefreshListView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - - private String[] mStrings = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler", "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler" }; -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java deleted file mode 100644 index 45b9b1e3..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshListInViewPagerActivity.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.handmark.pulltorefresh.samples; - -import java.util.Arrays; - -import android.app.Activity; -import android.content.Context; -import android.os.AsyncTask; -import android.os.Bundle; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; -import android.widget.ArrayAdapter; -import android.widget.ListAdapter; -import android.widget.ListView; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshListView; - -public class PullToRefreshListInViewPagerActivity extends Activity implements OnRefreshListener { - - private static final String[] STRINGS = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", - "Ackawi", "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler", "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", - "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", - "Allgauer Emmentaler" }; - - private ViewPager mViewPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_list_in_vp); - - mViewPager = (ViewPager) findViewById(R.id.vp_list); - mViewPager.setAdapter(new ListViewPagerAdapter()); - } - - private class ListViewPagerAdapter extends PagerAdapter { - - @Override - public View instantiateItem(ViewGroup container, int position) { - Context context = container.getContext(); - - PullToRefreshListView plv = (PullToRefreshListView) LayoutInflater.from(context).inflate( - R.layout.layout_listview_in_viewpager, container, false); - - ListAdapter adapter = new ArrayAdapter(context, android.R.layout.simple_list_item_1, - Arrays.asList(STRINGS)); - plv.setAdapter(adapter); - - plv.setOnRefreshListener(PullToRefreshListInViewPagerActivity.this); - - // Now just add ListView to ViewPager and return it - container.addView(plv, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - - return plv; - } - - @Override - public void destroyItem(ViewGroup container, int position, Object object) { - container.removeView((View) object); - } - - @Override - public boolean isViewFromObject(View view, Object object) { - return view == object; - } - - @Override - public int getCount() { - return 3; - } - - } - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - new GetDataTask(refreshView).execute(); - } - - private static class GetDataTask extends AsyncTask { - - PullToRefreshBase mRefreshedView; - - public GetDataTask(PullToRefreshBase refreshedView) { - mRefreshedView = refreshedView; - } - - @Override - protected Void doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return null; - } - - @Override - protected void onPostExecute(Void result) { - mRefreshedView.onRefreshComplete(); - super.onPostExecute(result); - } - } - -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java deleted file mode 100644 index 008b920d..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshScrollViewActivity.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.Activity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.widget.ScrollView; - -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; -import com.handmark.pulltorefresh.library.PullToRefreshScrollView; - -public final class PullToRefreshScrollViewActivity extends Activity { - - PullToRefreshScrollView mPullRefreshScrollView; - ScrollView mScrollView; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_scrollview); - - mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.pull_refresh_scrollview); - mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener() { - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - new GetDataTask().execute(); - } - }); - - mScrollView = mPullRefreshScrollView.getRefreshableView(); - } - - private class GetDataTask extends AsyncTask { - - @Override - protected String[] doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return null; - } - - @Override - protected void onPostExecute(String[] result) { - // Do some stuff here - - // Call onRefreshComplete when the list has been refreshed. - mPullRefreshScrollView.onRefreshComplete(); - - super.onPostExecute(result); - } - } - -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java deleted file mode 100644 index df05fddc..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.Activity; -import android.os.AsyncTask; -import android.os.Bundle; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; -import android.widget.ImageView; - -import com.handmark.pulltorefresh.extras.viewpager.PullToRefreshViewPager; -import com.handmark.pulltorefresh.library.PullToRefreshBase; -import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; - -public class PullToRefreshViewPagerActivity extends Activity implements OnRefreshListener { - - private PullToRefreshViewPager mPullToRefreshViewPager; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_viewpager); - - mPullToRefreshViewPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager); - mPullToRefreshViewPager.setOnRefreshListener(this); - - ViewPager vp = mPullToRefreshViewPager.getRefreshableView(); - vp.setAdapter(new SamplePagerAdapter()); - } - - @Override - public void onRefresh(PullToRefreshBase refreshView) { - new GetDataTask().execute(); - } - - static class SamplePagerAdapter extends PagerAdapter { - - private static int[] sDrawables = { R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper, - R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper }; - - @Override - public int getCount() { - return sDrawables.length; - } - - @Override - public View instantiateItem(ViewGroup container, int position) { - ImageView imageView = new ImageView(container.getContext()); - imageView.setImageResource(sDrawables[position]); - - // Now just add ImageView to ViewPager and return it - container.addView(imageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - - return imageView; - } - - @Override - public void destroyItem(ViewGroup container, int position, Object object) { - container.removeView((View) object); - } - - @Override - public boolean isViewFromObject(View view, Object object) { - return view == object; - } - } - - private class GetDataTask extends AsyncTask { - - @Override - protected Void doInBackground(Void... params) { - // Simulates a background job. - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - return null; - } - - @Override - protected void onPostExecute(Void result) { - mPullToRefreshViewPager.onRefreshComplete(); - super.onPostExecute(result); - } - } - -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java deleted file mode 100644 index 786f1954..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebView2Activity.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.Activity; -import android.os.Bundle; -import android.webkit.WebView; -import android.webkit.WebViewClient; - -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 { - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_webview2); - - PullToRefreshWebView2 pullRefreshWebView = (PullToRefreshWebView2) findViewById(R.id.pull_refresh_webview2); - pullRefreshWebView.setOnRefreshListener(this); - - WebView webView = pullRefreshWebView.getRefreshableView(); - webView.getSettings().setJavaScriptEnabled(true); - webView.setWebViewClient(new SampleWebViewClient()); - - // 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"); - } - - private static class SampleWebViewClient extends WebViewClient { - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - view.loadUrl(url); - return true; - } - } - - @Override - public void onRefresh(final PullToRefreshBase refreshView) { - // This is very contrived example, we just wait 2 seconds, then call - // onRefreshComplete() - refreshView.postDelayed(new Runnable() { - @Override - public void run() { - refreshView.onRefreshComplete(); - } - }, 2 * 1000); - } -} diff --git a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java b/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java deleted file mode 100644 index 1a42a06a..00000000 --- a/Android-PullToRefresh/sample/src/com/handmark/pulltorefresh/samples/PullToRefreshWebViewActivity.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * 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.samples; - -import android.app.Activity; -import android.os.Bundle; -import android.webkit.WebView; -import android.webkit.WebViewClient; - -import com.handmark.pulltorefresh.library.PullToRefreshWebView; - -public final class PullToRefreshWebViewActivity extends Activity { - - PullToRefreshWebView mPullRefreshWebView; - WebView mWebView; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_ptr_webview); - - mPullRefreshWebView = (PullToRefreshWebView) findViewById(R.id.pull_refresh_webview); - mWebView = mPullRefreshWebView.getRefreshableView(); - - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.setWebViewClient(new SampleWebViewClient()); - mWebView.loadUrl("http://www.google.com"); - - } - - private static class SampleWebViewClient extends WebViewClient { - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - view.loadUrl(url); - return true; - } - } - -} diff --git a/android-menudrawer-master/.gitignore b/android-menudrawer-master/.gitignore deleted file mode 100644 index fdb137a8..00000000 --- a/android-menudrawer-master/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -/* - -!.gitignore -!.travis.yml -!CHANGELOG.md -!README.md -!LICENSE -!checkstyle.xml -!pom.xml - -!art/ - -!library/ -library/* -!library/src/ -!library/res/ -!library/AndroidManifest.xml -!library/build.xml -!library/pom.xml -!library/project.properties - -!samples/ -samples/* -!samples/src/ -!samples/res/ -!samples/libs/ -!samples/AndroidManifest.xml -!samples/build.xml -!samples/pom.xml -!samples/project.properties diff --git a/android-menudrawer-master/.travis.yml b/android-menudrawer-master/.travis.yml deleted file mode 100644 index ee6ec5ca..00000000 --- a/android-menudrawer-master/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: java - -notifications: - email: false - -before_install: - - wget http://dl.google.com/android/android-sdk_r21.0.1-linux.tgz - - tar -zxf android-sdk_r21.0.1-linux.tgz - - export ANDROID_HOME=~/builds/SimonVT/android-menudrawer/android-sdk-linux - - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools - - TOOLS=$(android list sdk --no-ui | grep "Android SDK Platform-tools" | cut -d"-" -f1) - - android update sdk --filter "$TOOLS" --no-ui --force - - SDK=$(android list sdk --no-ui | grep ", API 16," | cut -d"-" -f1) - - android update sdk --filter "$SDK" --no-ui --force - -install: - - "mvn package --quiet -DskipTests" - - "mvn verify" diff --git a/android-menudrawer-master/CHANGELOG.md b/android-menudrawer-master/CHANGELOG.md deleted file mode 100644 index a570a8e4..00000000 --- a/android-menudrawer-master/CHANGELOG.md +++ /dev/null @@ -1,44 +0,0 @@ -Change Log -========== - -Version 2.0.2 *(2013-03-31)* ----------------------------- - * Added listener that makes it possible to disabllow intercepting touch events over - certain views - * Added setter for the maximum animation duration - * Added getter for menu size - * Added methods that enable/disable indicator animation - * Fix: Removed log statements - * Fix: Drawing the active indicator might cause crash if the active view is not a - child of the MenuDrawer - * Fix: Crash in static drawer if no active indicator bitmap was set - -Version 2.0.1 *(2013-02-12)* ----------------------------- - * Indicator now animates between active views - * Fixed restoring state for right/bottom drawer - -Version 2.0.0 *(2013-01-23)* ----------------------------- - - * Major API changes - - * All classes are now in the net.simonvt.menudrawer package. - * MenuDrawerManager no longet exists. Menu is added with MenuDrawer#attach(...). - * Drawer position is now selected with Position enums instead of int constants. - * Width methods/attributes have been renamed to 'size'. - - * Added top/bottom drawer. - * Added static (non-draggable, always visible) drawers. - * The touch bezel size is now configurable with MenuDrawer#setTouchBezelSize(int). - * MenuDrawer#saveState() now only required when dragging the entire window. - * Drawers can now be used in XML layouts. - * Fix: Scroller class caused conflicts with other libraries. - * Fix: No more overdraw when the drawer is closed. - * Fix: Content no longer falls behind when slowly dragging. - - -Version 1.0.0 *(2012-10-30)* ----------------------------- - -Initial release. diff --git a/android-menudrawer-master/LICENSE b/android-menudrawer-master/LICENSE deleted file mode 100644 index 7a4a3ea2..00000000 --- a/android-menudrawer-master/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. \ No newline at end of file diff --git a/android-menudrawer-master/README.md b/android-menudrawer-master/README.md deleted file mode 100644 index 17732748..00000000 --- a/android-menudrawer-master/README.md +++ /dev/null @@ -1,96 +0,0 @@ -MenuDrawer -========== - -A slide-out menu implementation, which allows users to navigate between views -in your app. Most commonly the menu is revealed by either dragging the edge -of the screen, or clicking the 'up' button in the action bar. - - -Features --------- - - * The menu can be positioned along all four edges. - * Supports attaching an always visible, non-draggable menu, which is useful - on e.g. tablets. - * The menu can wrap both the content and the entire window. - * Allows the drawer to be opened by dragging the edge, the entire screen or - not at all. - * Can be used in XML layouts. - * Indicator that shows which screen is currently visible. - - -Usage -===== - -This library is very simple to use. It requires no extension of custom classes, -it's simply added to an activity by calling one of the `MenuDrawer#attach(...)` -methods. - -For more examples on how to use this library, check out the sample app. - - -Left menu ---------- -```java -public class SampleActivity extends Activity { - - private MenuDrawer mDrawer; - - @Override - protected void onCreate(Bundle state) { - super.onCreate(state); - mDrawer = MenuDrawer.attach(this); - mDrawer.setContentView(R.layout.activity_sample); - mDrawer.setMenuView(R.layout.menu_sample); - } -} -``` - - -Right menu ----------- -```java -public class SampleActivity extends Activity { - - private MenuDrawer mDrawer; - - @Override - protected void onCreate(Bundle state) { - super.onCreate(state); - mDrawer = MenuDrawer.attach(this, Position.RIGHT); - mDrawer.setContentView(R.layout.activity_sample); - mDrawer.setMenuView(R.layout.menu_sample); - } -} -``` - - -Credits -======= - - * Cyril Mottier for his [articles][1] on the pattern - - -License -======= - - Copyright 2012 Simon Vig Therkildsen - - 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. - - - - - - - [1]: http://android.cyrilmottier.com/?p=658 diff --git a/android-menudrawer-master/art/menu_arrow.svg b/android-menudrawer-master/art/menu_arrow.svg deleted file mode 100644 index 05f205a3..00000000 --- a/android-menudrawer-master/art/menu_arrow.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/android-menudrawer-master/checkstyle.xml b/android-menudrawer-master/checkstyle.xml deleted file mode 100644 index e5fb679c..00000000 --- a/android-menudrawer-master/checkstyle.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/library/AndroidManifest.xml b/android-menudrawer-master/library/AndroidManifest.xml deleted file mode 100644 index a77d28a9..00000000 --- a/android-menudrawer-master/library/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/android-menudrawer-master/library/build.xml b/android-menudrawer-master/library/build.xml deleted file mode 100644 index e5eb1dc0..00000000 --- a/android-menudrawer-master/library/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/library/library1.iml b/android-menudrawer-master/library/library1.iml deleted file mode 100644 index 6c31f46b..00000000 --- a/android-menudrawer-master/library/library1.iml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/library/pom.xml b/android-menudrawer-master/library/pom.xml deleted file mode 100644 index b5bd8810..00000000 --- a/android-menudrawer-master/library/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - - net.simonvt - android-menudrawer-parent - 2.0.3-SNAPSHOT - ../pom.xml - - - android-menudrawer - Android MenuDrawer - apklib - - - - com.google.android - android - provided - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - - diff --git a/android-menudrawer-master/library/project.properties b/android-menudrawer-master/library/project.properties deleted file mode 100644 index c81c2d97..00000000 --- a/android-menudrawer-master/library/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-17 - diff --git a/android-menudrawer-master/library/res/values/attrs.xml b/android-menudrawer-master/library/res/values/attrs.xml deleted file mode 100644 index c8ec7797..00000000 --- a/android-menudrawer-master/library/res/values/attrs.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/library/res/values/colors.xml b/android-menudrawer-master/library/res/values/colors.xml deleted file mode 100644 index 2866c6ab..00000000 --- a/android-menudrawer-master/library/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - #FF555555 - - diff --git a/android-menudrawer-master/library/res/values/ids.xml b/android-menudrawer-master/library/res/values/ids.xml deleted file mode 100644 index c6001910..00000000 --- a/android-menudrawer-master/library/res/values/ids.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/library/res/values/styles.xml b/android-menudrawer-master/library/res/values/styles.xml deleted file mode 100644 index 415be6d2..00000000 --- a/android-menudrawer-master/library/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomDrawer.java deleted file mode 100644 index 17f41e2c..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomDrawer.java +++ /dev/null @@ -1,226 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class BottomDrawer extends VerticalDrawer { - - private int mIndicatorLeft; - - BottomDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public BottomDrawer(Context context) { - super(context); - } - - public BottomDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public BottomDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public void openMenu(boolean animate) { - animateOffsetTo(-mMenuSize, 0, animate); - } - - @Override - public void closeMenu(boolean animate) { - animateOffsetTo(0, 0, animate); - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, - new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - final int width = r - l; - final int height = b - t; - final int offsetPixels = (int) mOffsetPixels; - final int menuSize = mMenuSize; - - mMenuContainer.layout(0, height - menuSize, width, height); - offsetMenu(offsetPixels); - - if (USE_TRANSLATIONS) { - mContentContainer.layout(0, 0, width, height); - } else { - mContentContainer.layout(0, offsetPixels, width, height + offsetPixels); - } - } - - /** - * Offsets the menu relative to its original position based on the position of the content. - * - * @param offsetPixels The number of pixels the content if offset. - */ - private void offsetMenu(int offsetPixels) { - if (mOffsetMenu && mMenuSize != 0) { - final int height = getHeight(); - final int menuSize = mMenuSize; - final float openRatio = (menuSize + (float) offsetPixels) / menuSize; - - if (USE_TRANSLATIONS) { - if (offsetPixels != 0) { - final int offset = (int) (0.25f * (openRatio * menuSize)); - mMenuContainer.setTranslationY(offset); - } else { - mMenuContainer.setTranslationY(height + menuSize); - } - - } else { - final int oldMenuTop = mMenuContainer.getTop(); - final int offsetBy = (int) (0.25f * (openRatio * menuSize)); - final int offset = height - mMenuSize + offsetBy - oldMenuTop; - mMenuContainer.offsetTopAndBottom(offset); - mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE); - } - } - } - - @Override - protected void drawDropShadow(Canvas canvas, int offsetPixels) { - final int width = getWidth(); - final int height = getHeight(); - - mDropShadowDrawable.setBounds(0, height + offsetPixels, width, height + offsetPixels + mDropShadowSize); - mDropShadowDrawable.draw(canvas); - } - - @Override - protected void drawMenuOverlay(Canvas canvas, int offsetPixels) { - final int width = getWidth(); - final int height = getHeight(); - final float openRatio = ((float) Math.abs(offsetPixels)) / mMenuSize; - - mMenuOverlay.setBounds(0, height + offsetPixels, width, height); - mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * (1.f - openRatio))); - mMenuOverlay.draw(canvas); - } - - @Override - protected void drawIndicator(Canvas canvas, int offsetPixels) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int height = getHeight(); - final int menuHeight = mMenuSize; - final int indicatorHeight = mActiveIndicator.getHeight(); - - final float openRatio = ((float) Math.abs(offsetPixels)) / menuHeight; - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - final int indicatorWidth = mActiveIndicator.getWidth(); - - final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio)); - final int interpolatedHeight = (int) (indicatorHeight * interpolatedRatio); - - final int indicatorBottom = height + offsetPixels + interpolatedHeight; - final int indicatorTop = indicatorBottom - indicatorHeight; - if (mIndicatorAnimating) { - final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - final int startLeft = mIndicatorStartPos; - final int diff = finalLeft - startLeft; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorLeft = startLeft + startOffset; - } else { - mIndicatorLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - } - - canvas.save(); - canvas.clipRect(mIndicatorLeft, height + offsetPixels, mIndicatorLeft + indicatorWidth, - indicatorBottom); - canvas.drawBitmap(mActiveIndicator, mIndicatorLeft, indicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorLeft; - } - - @Override - protected void initPeekScroller() { - final int dx = -mMenuSize / 3; - mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION); - } - - @Override - protected void onOffsetPixelsChanged(int offsetPixels) { - if (USE_TRANSLATIONS) { - mContentContainer.setTranslationY(offsetPixels); - offsetMenu(offsetPixels); - invalidate(); - } else { - mContentContainer.offsetTopAndBottom(offsetPixels - mContentContainer.getTop()); - offsetMenu(offsetPixels); - invalidate(); - } - } - - ////////////////////////////////////////////////////////////////////// - // Touch handling - ////////////////////////////////////////////////////////////////////// - - @Override - protected boolean isContentTouch(MotionEvent ev) { - return ev.getY() < getHeight() + mOffsetPixels; - } - - @Override - protected boolean onDownAllowDrag(MotionEvent ev) { - final int height = getHeight(); - return (!mMenuVisible && mInitialMotionY >= height - mTouchSize) - || (mMenuVisible && mInitialMotionY <= height + mOffsetPixels); - } - - @Override - protected boolean onMoveAllowDrag(MotionEvent ev, float diff) { - final int height = getHeight(); - return (!mMenuVisible && mInitialMotionY >= height - mTouchSize && (diff < 0)) - || (mMenuVisible && mInitialMotionY <= height + mOffsetPixels); - } - - @Override - protected void onMoveEvent(float dx) { - setOffsetPixels(Math.max(Math.min(mOffsetPixels + dx, 0), -mMenuSize)); - } - - @Override - protected void onUpEvent(MotionEvent ev) { - final int offsetPixels = (int) mOffsetPixels; - - if (mIsDragging) { - mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity); - final int initialVelocity = (int) mVelocityTracker.getXVelocity(); - mLastMotionY = ev.getY(); - animateOffsetTo(mVelocityTracker.getYVelocity() < 0 ? -mMenuSize : 0, initialVelocity, - true); - - // Close the menu when content is clicked while the menu is visible. - } else if (mMenuVisible && ev.getY() < getHeight() + offsetPixels) { - closeMenu(); - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomStaticDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomStaticDrawer.java deleted file mode 100644 index df4b5f49..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BottomStaticDrawer.java +++ /dev/null @@ -1,85 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; - -public class BottomStaticDrawer extends StaticDrawer { - - private int mIndicatorLeft; - - BottomStaticDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public BottomStaticDrawer(Context context) { - super(context); - } - - public BottomStaticDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public BottomStaticDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - super.initDrawer(context, attrs, defStyle); - mPosition = Position.BOTTOM; - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void drawIndicator(Canvas canvas) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int height = getHeight(); - final int menuHeight = mMenuSize; - final int indicatorHeight = mActiveIndicator.getHeight(); - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - final int indicatorWidth = mActiveIndicator.getWidth(); - - final int indicatorTop = height - menuHeight; - final int indicatorBottom = indicatorTop + indicatorHeight; - if (mIndicatorAnimating) { - final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - final int startLeft = mIndicatorStartPos; - final int diff = finalLeft - startLeft; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorLeft = startLeft + startOffset; - } else { - mIndicatorLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - } - - canvas.save(); - canvas.clipRect(mIndicatorLeft, indicatorTop, mIndicatorLeft + indicatorWidth, - indicatorBottom); - canvas.drawBitmap(mActiveIndicator, mIndicatorLeft, indicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorLeft; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BuildLayerFrameLayout.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/BuildLayerFrameLayout.java deleted file mode 100644 index 45f5aa13..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/BuildLayerFrameLayout.java +++ /dev/null @@ -1,99 +0,0 @@ -package net.simonvt.menudrawer; - -import android.content.Context; -import android.graphics.Canvas; -import android.util.AttributeSet; -import android.widget.FrameLayout; - -/** - * FrameLayout which caches the hardware layer if available. - *

- * If it's not posted twice the layer either wont be built on start, or it'll be built twice. - */ -public class BuildLayerFrameLayout extends FrameLayout { - - private boolean mChanged; - - private boolean mHardwareLayersEnabled = true; - - private boolean mAttached; - - private boolean mFirst = true; - - public BuildLayerFrameLayout(Context context) { - super(context); - if (MenuDrawer.USE_TRANSLATIONS) { - setLayerType(LAYER_TYPE_HARDWARE, null); - } - } - - public BuildLayerFrameLayout(Context context, AttributeSet attrs) { - super(context, attrs); - if (MenuDrawer.USE_TRANSLATIONS) { - setLayerType(LAYER_TYPE_HARDWARE, null); - } - } - - public BuildLayerFrameLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - if (MenuDrawer.USE_TRANSLATIONS) { - setLayerType(LAYER_TYPE_HARDWARE, null); - } - } - - void setHardwareLayersEnabled(boolean enabled) { - mHardwareLayersEnabled = enabled; - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - mAttached = true; - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - mAttached = false; - } - - @Override - protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - - if (MenuDrawer.USE_TRANSLATIONS && mHardwareLayersEnabled) { - post(new Runnable() { - @Override - public void run() { - mChanged = true; - invalidate(); - } - }); - } - } - - @Override - protected void dispatchDraw(Canvas canvas) { - super.dispatchDraw(canvas); - - if (mChanged && MenuDrawer.USE_TRANSLATIONS) { - post(new Runnable() { - @Override - public void run() { - if (mAttached) { - final int layerType = getLayerType(); - // If it's already a hardware layer, it'll be built anyway. - if (layerType != LAYER_TYPE_HARDWARE || mFirst) { - mFirst = false; - setLayerType(LAYER_TYPE_HARDWARE, null); - buildLayer(); - setLayerType(LAYER_TYPE_NONE, null); - } - } - } - }); - - mChanged = false; - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/ColorDrawable.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/ColorDrawable.java deleted file mode 100644 index 10a35e7f..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/ColorDrawable.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * 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 net.simonvt.menudrawer; - -import android.content.res.Resources; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.Paint; -import android.graphics.PixelFormat; -import android.graphics.drawable.Drawable; - -/** - * A specialized Drawable that fills the Canvas with a specified color. - * Note that a ColorDrawable ignores the ColorFilter. - *

- *

It can be defined in an XML file with the <color> element.

- * - * @attr ref android.R.styleable#ColorDrawable_color - */ -public class ColorDrawable extends Drawable { - - private ColorState mState; - private final Paint mPaint = new Paint(); - - /** Creates a new black ColorDrawable. */ - public ColorDrawable() { - this(null); - } - - /** - * Creates a new ColorDrawable with the specified color. - * - * @param color The color to draw. - */ - public ColorDrawable(int color) { - this(null); - setColor(color); - } - - private ColorDrawable(ColorState state) { - mState = new ColorState(state); - } - - @Override - public int getChangingConfigurations() { - return super.getChangingConfigurations() | mState.mChangingConfigurations; - } - - @Override - public void draw(Canvas canvas) { - if ((mState.mUseColor >>> 24) != 0) { - mPaint.setColor(mState.mUseColor); - canvas.drawRect(getBounds(), mPaint); - } - } - - /** - * Gets the drawable's color value. - * - * @return int The color to draw. - */ - public int getColor() { - return mState.mUseColor; - } - - /** - * Sets the drawable's color value. This action will clobber the results of prior calls to - * {@link #setAlpha(int)} on this object, which side-affected the underlying color. - * - * @param color The color to draw. - */ - public void setColor(int color) { - if (mState.mBaseColor != color || mState.mUseColor != color) { - invalidateSelf(); - mState.mBaseColor = mState.mUseColor = color; - } - } - - /** - * Returns the alpha value of this drawable's color. - * - * @return A value between 0 and 255. - */ - public int getAlpha() { - return mState.mUseColor >>> 24; - } - - /** - * Sets the color's alpha value. - * - * @param alpha The alpha value to set, between 0 and 255. - */ - public void setAlpha(int alpha) { - alpha += alpha >> 7; // make it 0..256 - int baseAlpha = mState.mBaseColor >>> 24; - int useAlpha = baseAlpha * alpha >> 8; - int oldUseColor = mState.mUseColor; - mState.mUseColor = (mState.mBaseColor << 8 >>> 8) | (useAlpha << 24); - if (oldUseColor != mState.mUseColor) { - invalidateSelf(); - } - } - - /** - * Setting a color filter on a ColorDrawable has no effect. - * - * @param colorFilter Ignore. - */ - public void setColorFilter(ColorFilter colorFilter) { - } - - public int getOpacity() { - switch (mState.mUseColor >>> 24) { - case 255: - return PixelFormat.OPAQUE; - case 0: - return PixelFormat.TRANSPARENT; - } - return PixelFormat.TRANSLUCENT; - } - - @Override - public ConstantState getConstantState() { - mState.mChangingConfigurations = getChangingConfigurations(); - return mState; - } - - static final class ColorState extends ConstantState { - - int mBaseColor; // base color, independent of setAlpha() - int mUseColor; // basecolor modulated by setAlpha() - int mChangingConfigurations; - - ColorState(ColorState state) { - if (state != null) { - mBaseColor = state.mBaseColor; - mUseColor = state.mUseColor; - } - } - - @Override - public Drawable newDrawable() { - return new ColorDrawable(this); - } - - @Override - public Drawable newDrawable(Resources res) { - return new ColorDrawable(this); - } - - @Override - public int getChangingConfigurations() { - return mChangingConfigurations; - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/DraggableDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/DraggableDrawer.java deleted file mode 100644 index 77fc98e5..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/DraggableDrawer.java +++ /dev/null @@ -1,672 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.os.Build; -import android.os.Bundle; -import android.os.Parcelable; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.VelocityTracker; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.Interpolator; - -public abstract class DraggableDrawer extends MenuDrawer { - - /** - * Key used when saving menu visibility state. - */ - private static final String STATE_MENU_VISIBLE = "net.simonvt.menudrawer.MenuDrawer.menuVisible"; - - /** - * Interpolator used for stretching/retracting the active indicator. - */ - protected static final Interpolator INDICATOR_INTERPOLATOR = new AccelerateInterpolator(); - - /** - * Interpolator used for peeking at the drawer. - */ - private static final Interpolator PEEK_INTERPOLATOR = new PeekInterpolator(); - - /** - * The maximum alpha of the dark menu overlay used for dimming the menu. - */ - protected static final int MAX_MENU_OVERLAY_ALPHA = 185; - - /** - * Default delay from {@link #peekDrawer()} is called until first animation is run. - */ - private static final long DEFAULT_PEEK_START_DELAY = 5000; - - /** - * Default delay between each subsequent animation, after {@link #peekDrawer()} has been called. - */ - private static final long DEFAULT_PEEK_DELAY = 10000; - - /** - * The duration of the peek animation. - */ - protected static final int PEEK_DURATION = 5000; - - /** - * Distance in dp from closed position from where the drawer is considered closed with regards to touch events. - */ - private static final int CLOSE_ENOUGH = 3; - - /** - * Slop before starting a drag. - */ - protected int mTouchSlop; - - /** - * Runnable used when the peek animation is running. - */ - protected final Runnable mPeekRunnable = new Runnable() { - @Override - public void run() { - peekDrawerInvalidate(); - } - }; - - /** - * Runnable used when animating the drawer open/closed. - */ - private final Runnable mDragRunnable = new Runnable() { - @Override - public void run() { - postAnimationInvalidate(); - } - }; - - /** - * Current left position of the content. - */ - protected float mOffsetPixels; - - /** - * Indicates whether the drawer is currently being dragged. - */ - protected boolean mIsDragging; - - /** - * The initial X position of a drag. - */ - protected float mInitialMotionX; - - /** - * The initial Y position of a drag. - */ - protected float mInitialMotionY; - - /** - * The last X position of a drag. - */ - protected float mLastMotionX = -1; - - /** - * The last Y position of a drag. - */ - protected float mLastMotionY = -1; - - /** - * Default delay between each subsequent animation, after {@link #peekDrawer()} has been called. - */ - protected long mPeekDelay; - - /** - * Scroller used for the peek drawer animation. - */ - protected Scroller mPeekScroller; - - /** - * Velocity tracker used when animating the drawer open/closed after a drag. - */ - protected VelocityTracker mVelocityTracker; - - /** - * Maximum velocity allowed when animating the drawer open/closed. - */ - protected int mMaxVelocity; - - /** - * Indicates whether the menu should be offset when dragging the drawer. - */ - protected boolean mOffsetMenu = true; - - /** - * Distance in px from closed position from where the drawer is considered closed with regards to touch events. - */ - protected int mCloseEnough; - - /** - * Runnable used for first call to {@link #startPeek()} after {@link #peekDrawer()} has been called. - */ - private Runnable mPeekStartRunnable; - - /** - * Scroller used when animating the drawer open/closed. - */ - private Scroller mScroller; - - /** - * Indicates whether the current layer type is {@link android.view.View#LAYER_TYPE_HARDWARE}. - */ - private boolean mLayerTypeHardware; - - DraggableDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public DraggableDrawer(Context context) { - super(context); - } - - public DraggableDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public DraggableDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - super.initDrawer(context, attrs, defStyle); - - final ViewConfiguration configuration = ViewConfiguration.get(context); - mTouchSlop = configuration.getScaledTouchSlop(); - mMaxVelocity = configuration.getScaledMaximumFlingVelocity(); - - mScroller = new Scroller(context, MenuDrawer.SMOOTH_INTERPOLATOR); - mPeekScroller = new Scroller(context, DraggableDrawer.PEEK_INTERPOLATOR); - - mCloseEnough = dpToPx(DraggableDrawer.CLOSE_ENOUGH); - } - - public void toggleMenu(boolean animate) { - if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) { - closeMenu(animate); - } else if (mDrawerState == STATE_CLOSED || mDrawerState == STATE_CLOSING) { - openMenu(animate); - } - } - - public boolean isMenuVisible() { - return mMenuVisible; - } - - public void setMenuSize(final int size) { - mMenuSize = size; - mMenuSizeSet = true; - if (mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING) { - setOffsetPixels(mMenuSize); - } - requestLayout(); - invalidate(); - } - - public void setOffsetMenuEnabled(boolean offsetMenu) { - if (offsetMenu != mOffsetMenu) { - mOffsetMenu = offsetMenu; - requestLayout(); - invalidate(); - } - } - - public boolean getOffsetMenuEnabled() { - return mOffsetMenu; - } - - public void peekDrawer() { - peekDrawer(DEFAULT_PEEK_START_DELAY, DEFAULT_PEEK_DELAY); - } - - public void peekDrawer(long delay) { - peekDrawer(DEFAULT_PEEK_START_DELAY, delay); - } - - public void peekDrawer(final long startDelay, final long delay) { - if (startDelay < 0) { - throw new IllegalArgumentException("startDelay must be zero or larger."); - } - if (delay < 0) { - throw new IllegalArgumentException("delay must be zero or larger"); - } - - removeCallbacks(mPeekRunnable); - removeCallbacks(mPeekStartRunnable); - - mPeekDelay = delay; - mPeekStartRunnable = new Runnable() { - @Override - public void run() { - startPeek(); - } - }; - postDelayed(mPeekStartRunnable, startDelay); - } - - public void setHardwareLayerEnabled(boolean enabled) { - if (enabled != mHardwareLayersEnabled) { - mHardwareLayersEnabled = enabled; - mMenuContainer.setHardwareLayersEnabled(enabled); - mContentContainer.setHardwareLayersEnabled(enabled); - stopLayerTranslation(); - } - } - - public int getTouchMode() { - return mTouchMode; - } - - public void setTouchMode(int mode) { - if (mTouchMode != mode) { - mTouchMode = mode; - updateTouchAreaSize(); - } - } - - public void setTouchBezelSize(int size) { - mTouchBezelSize = size; - } - - public int getTouchBezelSize() { - return mTouchBezelSize; - } - - /** - * Sets the number of pixels the content should be offset. - * - * @param offsetPixels The number of pixels to offset the content by. - */ - protected void setOffsetPixels(float offsetPixels) { - final int oldOffset = (int) mOffsetPixels; - final int newOffset = (int) offsetPixels; - - mOffsetPixels = offsetPixels; - - if (newOffset != oldOffset) { - onOffsetPixelsChanged(newOffset); - mMenuVisible = newOffset != 0; - } - } - - /** - * Called when the number of pixels the content should be offset by has changed. - * - * @param offsetPixels The number of pixels to offset the content by. - */ - protected abstract void onOffsetPixelsChanged(int offsetPixels); - - /** - * If possible, set the layer type to {@link android.view.View#LAYER_TYPE_HARDWARE}. - */ - protected void startLayerTranslation() { - if (USE_TRANSLATIONS && mHardwareLayersEnabled && !mLayerTypeHardware) { - mLayerTypeHardware = true; - mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null); - mMenuContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null); - } - } - - /** - * If the current layer type is {@link android.view.View#LAYER_TYPE_HARDWARE}, this will set it to - * {@link View#LAYER_TYPE_NONE}. - */ - private void stopLayerTranslation() { - if (mLayerTypeHardware) { - mLayerTypeHardware = false; - mContentContainer.setLayerType(View.LAYER_TYPE_NONE, null); - mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null); - } - } - - /** - * Compute the touch area based on the touch mode. - */ - protected void updateTouchAreaSize() { - if (mTouchMode == TOUCH_MODE_BEZEL) { - mTouchSize = mTouchBezelSize; - } else if (mTouchMode == TOUCH_MODE_FULLSCREEN) { - mTouchSize = getMeasuredWidth(); - } else { - mTouchSize = 0; - } - } - - /** - * Called when a drag has been ended. - */ - protected void endDrag() { - mIsDragging = false; - - if (mVelocityTracker != null) { - mVelocityTracker.recycle(); - mVelocityTracker = null; - } - } - - /** - * Stops ongoing animation of the drawer. - */ - protected void stopAnimation() { - removeCallbacks(mDragRunnable); - mScroller.abortAnimation(); - stopLayerTranslation(); - } - - /** - * Called when a drawer animation has successfully completed. - */ - private void completeAnimation() { - mScroller.abortAnimation(); - final int finalX = mScroller.getFinalX(); - setOffsetPixels(finalX); - setDrawerState(finalX == 0 ? STATE_CLOSED : STATE_OPEN); - stopLayerTranslation(); - } - - /** - * Moves the drawer to the position passed. - * - * @param position The position the content is moved to. - * @param velocity Optional velocity if called by releasing a drag event. - * @param animate Whether the move is animated. - */ - protected void animateOffsetTo(int position, int velocity, boolean animate) { - endDrag(); - endPeek(); - - final int startX = (int) mOffsetPixels; - final int dx = position - startX; - if (dx == 0 || !animate) { - setOffsetPixels(position); - setDrawerState(position == 0 ? STATE_CLOSED : STATE_OPEN); - stopLayerTranslation(); - return; - } - - int duration; - - velocity = Math.abs(velocity); - if (velocity > 0) { - duration = 4 * Math.round(1000.f * Math.abs((float) dx / velocity)); - } else { - duration = (int) (600.f * Math.abs((float) dx / mMenuSize)); - } - - duration = Math.min(duration, mMaxAnimationDuration); - - if (dx > 0) { - setDrawerState(STATE_OPENING); - mScroller.startScroll(startX, 0, dx, 0, duration); - } else { - setDrawerState(STATE_CLOSING); - mScroller.startScroll(startX, 0, dx, 0, duration); - } - - startLayerTranslation(); - - postAnimationInvalidate(); - } - - /** - * Callback when each frame in the drawer animation should be drawn. - */ - private void postAnimationInvalidate() { - if (mScroller.computeScrollOffset()) { - final int oldX = (int) mOffsetPixels; - final int x = mScroller.getCurrX(); - - if (x != oldX) setOffsetPixels(x); - if (x != mScroller.getFinalX()) { - postOnAnimation(mDragRunnable); - return; - } - } - - completeAnimation(); - } - - /** - * Starts peek drawer animation. - */ - protected void startPeek() { - initPeekScroller(); - - startLayerTranslation(); - peekDrawerInvalidate(); - } - - protected abstract void initPeekScroller(); - - /** - * Callback when each frame in the peek drawer animation should be drawn. - */ - private void peekDrawerInvalidate() { - if (mPeekScroller.computeScrollOffset()) { - final int oldX = (int) mOffsetPixels; - final int x = mPeekScroller.getCurrX(); - if (x != oldX) setOffsetPixels(x); - - if (!mPeekScroller.isFinished()) { - postOnAnimation(mPeekRunnable); - return; - - } else if (mPeekDelay > 0) { - mPeekStartRunnable = new Runnable() { - @Override - public void run() { - startPeek(); - } - }; - postDelayed(mPeekStartRunnable, mPeekDelay); - } - } - - completePeek(); - } - - /** - * Called when the peek drawer animation has successfully completed. - */ - private void completePeek() { - mPeekScroller.abortAnimation(); - - setOffsetPixels(0); - - setDrawerState(STATE_CLOSED); - stopLayerTranslation(); - } - - /** - * Stops ongoing peek drawer animation. - */ - protected void endPeek() { - removeCallbacks(mPeekStartRunnable); - removeCallbacks(mPeekRunnable); - stopLayerTranslation(); - } - - protected boolean isCloseEnough() { - return Math.abs(mOffsetPixels) <= mCloseEnough; - } - - /** - * Returns true if the touch event occurs over the content. - * - * @param ev The motion event. - * @return True if the touch event occurred over the content, false otherwise. - */ - protected abstract boolean isContentTouch(MotionEvent ev); - - /** - * Returns true if dragging the content should be allowed. - * - * @param ev The motion event. - * @return True if dragging the content should be allowed, false otherwise. - */ - protected abstract boolean onDownAllowDrag(MotionEvent ev); - - /** - * Tests scrollability within child views of v given a delta of dx. - * - * @param v View to test for horizontal scrollability - * @param checkV Whether the view should be checked for draggability - * @param dx Delta scrolled in pixels - * @param x X coordinate of the active touch point - * @param y Y coordinate of the active touch point - * @return true if child views of v can be scrolled by delta of dx. - */ - protected boolean canChildScrollHorizontally(View v, boolean checkV, int dx, int x, int y) { - if (v instanceof ViewGroup) { - final ViewGroup group = (ViewGroup) v; - - final int count = group.getChildCount(); - // Count backwards - let topmost views consume scroll distance first. - for (int i = count - 1; i >= 0; i--) { - final View child = group.getChildAt(i); - - final int childLeft = child.getLeft() + supportGetTranslationX(child); - final int childRight = child.getRight() + supportGetTranslationX(child); - final int childTop = child.getTop() + supportGetTranslationY(child); - final int childBottom = child.getBottom() + supportGetTranslationY(child); - - if (x >= childLeft && x < childRight && y >= childTop && y < childBottom - && canChildScrollHorizontally(child, true, dx, x - childLeft, y - childTop)) { - return true; - } - } - } - - return checkV && mOnInterceptMoveEventListener.isViewDraggable(v, dx, x, y); - } - - /** - * Tests scrollability within child views of v given a delta of dx. - * - * @param v View to test for horizontal scrollability - * @param checkV Whether the view should be checked for draggability - * @param dx Delta scrolled in pixels - * @param x X coordinate of the active touch point - * @param y Y coordinate of the active touch point - * @return true if child views of v can be scrolled by delta of dx. - */ - protected boolean canChildScrollVertically(View v, boolean checkV, int dx, int x, int y) { - if (v instanceof ViewGroup) { - final ViewGroup group = (ViewGroup) v; - - final int count = group.getChildCount(); - // Count backwards - let topmost views consume scroll distance first. - for (int i = count - 1; i >= 0; i--) { - final View child = group.getChildAt(i); - - final int childLeft = child.getLeft() + supportGetTranslationX(child); - final int childRight = child.getRight() + supportGetTranslationX(child); - final int childTop = child.getTop() + supportGetTranslationY(child); - final int childBottom = child.getBottom() + supportGetTranslationY(child); - - if (x >= childLeft && x < childRight && y >= childTop && y < childBottom - && canChildScrollVertically(child, true, dx, x - childLeft, y - childTop)) { - return true; - } - } - } - - return checkV && mOnInterceptMoveEventListener.isViewDraggable(v, dx, x, y); - } - - private int supportGetTranslationY(View v) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - return (int) v.getTranslationY(); - } - - return 0; - } - - private int supportGetTranslationX(View v) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - return (int) v.getTranslationX(); - } - - return 0; - } - - /** - * Returns true if dragging the content should be allowed. - * - * @param ev The motion event. - * @return True if dragging the content should be allowed, false otherwise. - */ - protected abstract boolean onMoveAllowDrag(MotionEvent ev, float dx); - - /** - * Called when a move event has happened while dragging the content is in progress. - * - * @param dx The X difference between the last motion event and the current motion event. - */ - protected abstract void onMoveEvent(float dx); - - /** - * Called when {@link android.view.MotionEvent#ACTION_UP} of {@link android.view.MotionEvent#ACTION_CANCEL} is - * delivered to {@link net.simonvt.menudrawer.MenuDrawer#onTouchEvent(android.view.MotionEvent)}. - * - * @param ev The motion event. - */ - protected abstract void onUpEvent(MotionEvent ev); - - @Override - protected void dispatchDraw(Canvas canvas) { - super.dispatchDraw(canvas); - final int offsetPixels = (int) mOffsetPixels; - - if (offsetPixels != 0) drawMenuOverlay(canvas, offsetPixels); - if (mDropShadowEnabled) drawDropShadow(canvas, offsetPixels); - if (mActiveIndicator != null) drawIndicator(canvas, offsetPixels); - } - - /** - * Called when the content drop shadow should be drawn. - * - * @param canvas The canvas on which to draw. - * @param offsetPixels Value in pixels indicating the offset. - */ - protected abstract void drawDropShadow(Canvas canvas, int offsetPixels); - - /** - * Called when the menu overlay should be drawn. - * - * @param canvas The canvas on which to draw. - * @param offsetPixels Value in pixels indicating the offset. - */ - protected abstract void drawMenuOverlay(Canvas canvas, int offsetPixels); - - /** - * Called when the active indicator should be drawn. - * - * @param canvas The canvas on which to draw. - * @param offsetPixels Value in pixels indicating the offset. - */ - protected abstract void drawIndicator(Canvas canvas, int offsetPixels); - - void saveState(Bundle state) { - final boolean menuVisible = mDrawerState == STATE_OPEN || mDrawerState == STATE_OPENING; - state.putBoolean(STATE_MENU_VISIBLE, menuVisible); - } - - public void restoreState(Parcelable in) { - super.restoreState(in); - Bundle state = (Bundle) in; - final boolean menuOpen = state.getBoolean(STATE_MENU_VISIBLE); - if (menuOpen) { - openMenu(false); - } else { - setOffsetPixels(0); - } - mDrawerState = menuOpen ? STATE_OPEN : STATE_CLOSED; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/FloatScroller.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/FloatScroller.java deleted file mode 100644 index df5b445c..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/FloatScroller.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2006 The Android Open Source Project - * - * 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 net.simonvt.menudrawer; - -import android.view.animation.AnimationUtils; -import android.view.animation.Interpolator; - -/** - * This class encapsulates scrolling. The duration of the scroll - * can be passed in the constructor and specifies the maximum time that - * the scrolling animation should take. Past this time, the scrolling is - * automatically moved to its final stage and computeScrollOffset() - * will always return false to indicate that scrolling is over. - */ -public class FloatScroller { - - private float mStart; - private float mFinal; - - private float mCurr; - private long mStartTime; - private int mDuration; - private float mDurationReciprocal; - private float mDeltaX; - private boolean mFinished; - private Interpolator mInterpolator; - - /** - * Create a Scroller with the specified interpolator. If the interpolator is - * null, the default (viscous) interpolator will be used. Specify whether or - * not to support progressive "flywheel" behavior in flinging. - */ - public FloatScroller(Interpolator interpolator) { - mFinished = true; - mInterpolator = interpolator; - } - - /** - * Returns whether the scroller has finished scrolling. - * - * @return True if the scroller has finished scrolling, false otherwise. - */ - public final boolean isFinished() { - return mFinished; - } - - /** - * Force the finished field to a particular value. - * - * @param finished The new finished value. - */ - public final void forceFinished(boolean finished) { - mFinished = finished; - } - - /** - * Returns how long the scroll event will take, in milliseconds. - * - * @return The duration of the scroll in milliseconds. - */ - public final int getDuration() { - return mDuration; - } - - /** - * Returns the current offset in the scroll. - * - * @return The new offset as an absolute distance from the origin. - */ - public final float getCurr() { - return mCurr; - } - - /** - * Returns the start offset in the scroll. - * - * @return The start offset as an absolute distance from the origin. - */ - public final float getStart() { - return mStart; - } - - /** - * Returns where the scroll will end. Valid only for "fling" scrolls. - * - * @return The final offset as an absolute distance from the origin. - */ - public final float getFinal() { - return mFinal; - } - - public boolean computeScrollOffset() { - if (mFinished) { - return false; - } - - int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime); - - if (timePassed < mDuration) { - float x = timePassed * mDurationReciprocal; - x = mInterpolator.getInterpolation(x); - mCurr = mStart + x * mDeltaX; - - } else { - mCurr = mFinal; - mFinished = true; - } - return true; - } - - public void startScroll(float start, float delta, int duration) { - mFinished = false; - mDuration = duration; - mStartTime = AnimationUtils.currentAnimationTimeMillis(); - mStart = start; - mFinal = start + delta; - mDeltaX = delta; - mDurationReciprocal = 1.0f / (float) mDuration; - } - - /** - * Stops the animation. Contrary to {@link #forceFinished(boolean)}, - * aborting the animating cause the scroller to move to the final x and y - * position - * - * @see #forceFinished(boolean) - */ - public void abortAnimation() { - mCurr = mFinal; - mFinished = true; - } - - /** - * Extend the scroll animation. This allows a running animation to scroll - * further and longer, when used with {@link #setFinal(float)}. - * - * @param extend Additional time to scroll in milliseconds. - * @see #setFinal(float) - */ - public void extendDuration(int extend) { - int passed = timePassed(); - mDuration = passed + extend; - mDurationReciprocal = 1.0f / mDuration; - mFinished = false; - } - - /** - * Returns the time elapsed since the beginning of the scrolling. - * - * @return The elapsed time in milliseconds. - */ - public int timePassed() { - return (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime); - } - - public void setFinal(float newVal) { - mFinal = newVal; - mDeltaX = mFinal - mStart; - mFinished = false; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/HorizontalDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/HorizontalDrawer.java deleted file mode 100644 index 6f1c8300..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/HorizontalDrawer.java +++ /dev/null @@ -1,207 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.VelocityTracker; - -public abstract class HorizontalDrawer extends DraggableDrawer { - - private static final String TAG = "HorizontalDrawer"; - - HorizontalDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public HorizontalDrawer(Context context) { - super(context); - } - - public HorizontalDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public HorizontalDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int widthMode = MeasureSpec.getMode(widthMeasureSpec); - final int heightMode = MeasureSpec.getMode(heightMeasureSpec); - - if (widthMode != MeasureSpec.EXACTLY || heightMode != MeasureSpec.EXACTLY) { - throw new IllegalStateException("Must measure with an exact size"); - } - - final int width = MeasureSpec.getSize(widthMeasureSpec); - final int height = MeasureSpec.getSize(heightMeasureSpec); - - if (!mMenuSizeSet) mMenuSize = (int) (width * 0.8f); - if (mOffsetPixels == -1) openMenu(false); - - final int menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, mMenuSize); - final int menuHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height); - mMenuContainer.measure(menuWidthMeasureSpec, menuHeightMeasureSpec); - - final int contentWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width); - final int contentHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height); - mContentContainer.measure(contentWidthMeasureSpec, contentHeightMeasureSpec); - - setMeasuredDimension(width, height); - - updateTouchAreaSize(); - } - - @Override - public boolean onInterceptTouchEvent(MotionEvent ev) { - final int action = ev.getAction() & MotionEvent.ACTION_MASK; - - if (action == MotionEvent.ACTION_DOWN && mMenuVisible && isCloseEnough()) { - setOffsetPixels(0); - stopAnimation(); - endPeek(); - setDrawerState(STATE_CLOSED); - } - - // Always intercept events over the content while menu is visible. - if (mMenuVisible && isContentTouch(ev)) return true; - - if (mTouchMode == TOUCH_MODE_NONE) { - return false; - } - - if (action != MotionEvent.ACTION_DOWN) { - if (mIsDragging) return true; - } - - switch (action) { - case MotionEvent.ACTION_DOWN: { - mLastMotionX = mInitialMotionX = ev.getX(); - mLastMotionY = mInitialMotionY = ev.getY(); - final boolean allowDrag = onDownAllowDrag(ev); - - if (allowDrag) { - setDrawerState(mMenuVisible ? STATE_OPEN : STATE_CLOSED); - stopAnimation(); - endPeek(); - mIsDragging = false; - } - break; - } - - case MotionEvent.ACTION_MOVE: { - final float x = ev.getX(); - final float dx = x - mLastMotionX; - final float xDiff = Math.abs(dx); - final float y = ev.getY(); - final float yDiff = Math.abs(y - mLastMotionY); - - if (xDiff > mTouchSlop && xDiff > yDiff) { - if (mOnInterceptMoveEventListener != null && mTouchMode == TOUCH_MODE_FULLSCREEN - && canChildScrollHorizontally(mContentContainer, false, (int) dx, (int) x, (int) y)) { - endDrag(); // Release the velocity tracker - return false; - } - - final boolean allowDrag = onMoveAllowDrag(ev, dx); - - if (allowDrag) { - setDrawerState(STATE_DRAGGING); - mIsDragging = true; - mLastMotionX = x; - mLastMotionY = y; - } - } - break; - } - - /** - * If you click really fast, an up or cancel event is delivered here. - * Just snap content to whatever is closest. - * */ - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: { - if (Math.abs(mOffsetPixels) > mMenuSize / 2) { - openMenu(); - } else { - closeMenu(); - } - break; - } - } - - if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain(); - mVelocityTracker.addMovement(ev); - - return mIsDragging; - } - - @Override - public boolean onTouchEvent(MotionEvent ev) { - if (!mMenuVisible && !mIsDragging && (mTouchMode == TOUCH_MODE_NONE)) { - return false; - } - final int action = ev.getAction() & MotionEvent.ACTION_MASK; - - if (mVelocityTracker == null) mVelocityTracker = VelocityTracker.obtain(); - mVelocityTracker.addMovement(ev); - - switch (action) { - case MotionEvent.ACTION_DOWN: { - mLastMotionX = mInitialMotionX = ev.getX(); - mLastMotionY = mInitialMotionY = ev.getY(); - final boolean allowDrag = onDownAllowDrag(ev); - - if (allowDrag) { - stopAnimation(); - endPeek(); - startLayerTranslation(); - } - break; - } - - case MotionEvent.ACTION_MOVE: { - if (!mIsDragging) { - final float x = ev.getX(); - final float dx = x - mLastMotionX; - final float xDiff = Math.abs(dx); - final float y = ev.getY(); - final float yDiff = Math.abs(y - mLastMotionY); - - if (xDiff > mTouchSlop && xDiff > yDiff) { - final boolean allowDrag = onMoveAllowDrag(ev, dx); - - if (allowDrag) { - setDrawerState(STATE_DRAGGING); - mIsDragging = true; - mLastMotionX = x - mInitialMotionX > 0 - ? mInitialMotionX + mTouchSlop - : mInitialMotionX - mTouchSlop; - } - } - } - - if (mIsDragging) { - startLayerTranslation(); - - final float x = ev.getX(); - final float dx = x - mLastMotionX; - - mLastMotionX = x; - onMoveEvent(dx); - } - break; - } - - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: { - onUpEvent(ev); - break; - } - } - - return true; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftDrawer.java deleted file mode 100644 index 59a4fc4c..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftDrawer.java +++ /dev/null @@ -1,212 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class LeftDrawer extends HorizontalDrawer { - - private int mIndicatorTop; - - LeftDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public LeftDrawer(Context context) { - super(context); - } - - public LeftDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public LeftDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public void openMenu(boolean animate) { - animateOffsetTo(mMenuSize, 0, animate); - } - - @Override - public void closeMenu(boolean animate) { - animateOffsetTo(0, 0, animate); - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - final int width = r - l; - final int height = b - t; - final int offsetPixels = (int) mOffsetPixels; - - mMenuContainer.layout(0, 0, mMenuSize, height); - offsetMenu(offsetPixels); - - if (USE_TRANSLATIONS) { - mContentContainer.layout(0, 0, width, height); - } else { - mContentContainer.layout(offsetPixels, 0, width + offsetPixels, height); - } - } - - /** - * Offsets the menu relative to its original position based on the position of the content. - * - * @param offsetPixels The number of pixels the content if offset. - */ - private void offsetMenu(int offsetPixels) { - if (mOffsetMenu && mMenuSize != 0) { - final int menuWidth = mMenuSize; - final float openRatio = (menuWidth - (float) offsetPixels) / menuWidth; - - if (USE_TRANSLATIONS) { - if (offsetPixels > 0) { - final int menuLeft = (int) (0.25f * (-openRatio * menuWidth)); - mMenuContainer.setTranslationX(menuLeft); - } else { - mMenuContainer.setTranslationX(-menuWidth); - } - - } else { - final int oldMenuLeft = mMenuContainer.getLeft(); - final int offset = (int) (0.25f * (-openRatio * menuWidth)) - oldMenuLeft; - mMenuContainer.offsetLeftAndRight(offset); - mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE); - } - } - } - - @Override - protected void drawDropShadow(Canvas canvas, int offsetPixels) { - final int height = getHeight(); - - mDropShadowDrawable.setBounds(offsetPixels - mDropShadowSize, 0, offsetPixels, height); - mDropShadowDrawable.draw(canvas); - } - - @Override - protected void drawMenuOverlay(Canvas canvas, int offsetPixels) { - final int height = getHeight(); - final float openRatio = ((float) offsetPixels) / mMenuSize; - - mMenuOverlay.setBounds(0, 0, offsetPixels, height); - mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * (1.f - openRatio))); - mMenuOverlay.draw(canvas); - } - - @Override - protected void drawIndicator(Canvas canvas, int offsetPixels) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final float openRatio = ((float) offsetPixels) / mMenuSize; - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - - final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio)); - final int interpolatedWidth = (int) (mActiveIndicator.getWidth() * interpolatedRatio); - - if (mIndicatorAnimating) { - final int indicatorFinalTop = mActiveRect.top + ((mActiveRect.height() - - mActiveIndicator.getHeight()) / 2); - final int indicatorStartTop = mIndicatorStartPos; - final int diff = indicatorFinalTop - indicatorStartTop; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorTop = indicatorStartTop + startOffset; - } else { - mIndicatorTop = mActiveRect.top + ((mActiveRect.height() - mActiveIndicator.getHeight()) / 2); - } - final int right = offsetPixels; - final int left = right - interpolatedWidth; - - canvas.save(); - canvas.clipRect(left, 0, right, getHeight()); - canvas.drawBitmap(mActiveIndicator, left, mIndicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorTop; - } - - @Override - protected void initPeekScroller() { - final int dx = mMenuSize / 3; - mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION); - } - - @Override - protected void onOffsetPixelsChanged(int offsetPixels) { - if (USE_TRANSLATIONS) { - mContentContainer.setTranslationX(offsetPixels); - offsetMenu(offsetPixels); - invalidate(); - } else { - mContentContainer.offsetLeftAndRight(offsetPixels - mContentContainer.getLeft()); - offsetMenu(offsetPixels); - invalidate(); - } - } - - ////////////////////////////////////////////////////////////////////// - // Touch handling - ////////////////////////////////////////////////////////////////////// - - @Override - protected boolean isContentTouch(MotionEvent ev) { - return ev.getX() > mOffsetPixels; - } - - @Override - protected boolean onDownAllowDrag(MotionEvent ev) { - return (!mMenuVisible && mInitialMotionX <= mTouchSize) - || (mMenuVisible && mInitialMotionX >= mOffsetPixels); - } - - @Override - protected boolean onMoveAllowDrag(MotionEvent ev, float diff) { - return (!mMenuVisible && mInitialMotionX <= mTouchSize && (diff > 0)) - || (mMenuVisible && mInitialMotionX >= mOffsetPixels); - } - - @Override - protected void onMoveEvent(float dx) { - setOffsetPixels(Math.min(Math.max(mOffsetPixels + dx, 0), mMenuSize)); - } - - @Override - protected void onUpEvent(MotionEvent ev) { - final int offsetPixels = (int) mOffsetPixels; - - if (mIsDragging) { - mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity); - final int initialVelocity = (int) mVelocityTracker.getXVelocity(); - mLastMotionX = ev.getX(); - animateOffsetTo(mVelocityTracker.getXVelocity() > 0 ? mMenuSize : 0, initialVelocity, true); - - // Close the menu when content is clicked while the menu is visible. - } else if (mMenuVisible && ev.getX() > offsetPixels) { - closeMenu(); - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftStaticDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftStaticDrawer.java deleted file mode 100644 index 47fa75a3..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/LeftStaticDrawer.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; - -public class LeftStaticDrawer extends StaticDrawer { - - private int mIndicatorTop; - - LeftStaticDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public LeftStaticDrawer(Context context) { - super(context); - } - - public LeftStaticDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public LeftStaticDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - super.initDrawer(context, attrs, defStyle); - mPosition = Position.LEFT; - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void drawIndicator(Canvas canvas) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - - if (mIndicatorAnimating) { - final int indicatorFinalTop = mActiveRect.top + ((mActiveRect.height() - - mActiveIndicator.getHeight()) / 2); - final int indicatorStartTop = mIndicatorStartPos; - final int diff = indicatorFinalTop - indicatorStartTop; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorTop = indicatorStartTop + startOffset; - } else { - mIndicatorTop = mActiveRect.top + ((mActiveRect.height() - mActiveIndicator.getHeight()) / 2); - } - final int right = mMenuSize; - final int left = right - mActiveIndicator.getWidth(); - - canvas.save(); - canvas.clipRect(left, 0, right, getHeight()); - canvas.drawBitmap(mActiveIndicator, left, mIndicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorTop; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/MenuDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/MenuDrawer.java deleted file mode 100644 index 7f998e44..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/MenuDrawer.java +++ /dev/null @@ -1,1151 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.os.Bundle; -import android.os.Parcel; -import android.os.Parcelable; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.view.ViewTreeObserver; -import android.view.animation.Interpolator; - -public abstract class MenuDrawer extends ViewGroup { - - /** - * Callback interface for changing state of the drawer. - */ - public interface OnDrawerStateChangeListener { - - /** - * Called when the drawer state changes. - * - * @param oldState The old drawer state. - * @param newState The new drawer state. - */ - void onDrawerStateChange(int oldState, int newState); - } - - /** - * Callback that is invoked when the drawer is in the process of deciding whether it should intercept the touch - * event. This lets the listener decide if the pointer is on a view that would disallow dragging of the drawer. - * This is only called when the touch mode is {@link #TOUCH_MODE_FULLSCREEN}. - */ - public interface OnInterceptMoveEventListener { - - /** - * Called for each child the pointer i on when the drawer is deciding whether to intercept the touch event. - * - * @param v View to test for draggability - * @param dx Delta drag in pixels - * @param x X coordinate of the active touch point - * @param y Y coordinate of the active touch point - * @return true if view is draggable by delta dx. - */ - boolean isViewDraggable(View v, int dx, int x, int y); - } - - /** - * Tag used when logging. - */ - private static final String TAG = "MenuDrawer"; - - /** - * Indicates whether debug code should be enabled. - */ - private static final boolean DEBUG = false; - - /** - * The time between each frame when animating the drawer. - */ - protected static final int ANIMATION_DELAY = 1000 / 60; - - /** - * The default touch bezel size of the drawer in dp. - */ - private static final int DEFAULT_DRAG_BEZEL_DP = 24; - - /** - * The default drop shadow size in dp. - */ - private static final int DEFAULT_DROP_SHADOW_DP = 6; - - /** - * Drag mode for sliding only the content view. - */ - public static final int MENU_DRAG_CONTENT = 0; - - /** - * Drag mode for sliding the entire window. - */ - public static final int MENU_DRAG_WINDOW = 1; - - /** - * Disallow opening the drawer by dragging the screen. - */ - public static final int TOUCH_MODE_NONE = 0; - - /** - * Allow opening drawer only by dragging on the edge of the screen. - */ - public static final int TOUCH_MODE_BEZEL = 1; - - /** - * Allow opening drawer by dragging anywhere on the screen. - */ - public static final int TOUCH_MODE_FULLSCREEN = 2; - - /** - * Indicates that the drawer is currently closed. - */ - public static final int STATE_CLOSED = 0; - - /** - * Indicates that the drawer is currently closing. - */ - public static final int STATE_CLOSING = 1; - - /** - * Indicates that the drawer is currently being dragged by the user. - */ - public static final int STATE_DRAGGING = 2; - - /** - * Indicates that the drawer is currently opening. - */ - public static final int STATE_OPENING = 4; - - /** - * Indicates that the drawer is currently open. - */ - public static final int STATE_OPEN = 8; - - /** - * Indicates whether to use {@link View#setTranslationX(float)} when positioning views. - */ - static final boolean USE_TRANSLATIONS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1; - - /** - * Time to animate the indicator to the new active view. - */ - static final int INDICATOR_ANIM_DURATION = 800; - - /** - * The maximum animation duration. - */ - private static final int DEFAULT_ANIMATION_DURATION = 600; - - /** - * Interpolator used when animating the drawer open/closed. - */ - protected static final Interpolator SMOOTH_INTERPOLATOR = new SmoothInterpolator(); - - /** - * Drawable used as menu overlay. - */ - protected Drawable mMenuOverlay; - - /** - * Defines whether the drop shadow is enabled. - */ - protected boolean mDropShadowEnabled; - - /** - * Drawable used as content drop shadow onto the menu. - */ - protected Drawable mDropShadowDrawable; - - /** - * The size of the content drop shadow. - */ - protected int mDropShadowSize; - - /** - * Bitmap used to indicate the active view. - */ - protected Bitmap mActiveIndicator; - - /** - * The currently active view. - */ - protected View mActiveView; - - /** - * Position of the active view. This is compared to View#getTag(R.id.mdActiveViewPosition) when drawing the - * indicator. - */ - protected int mActivePosition; - - /** - * Whether the indicator should be animated between positions. - */ - private boolean mAllowIndicatorAnimation; - - /** - * Used when reading the position of the active view. - */ - protected final Rect mActiveRect = new Rect(); - - /** - * Temporary {@link Rect} used for deciding whether the view should be invalidated so the indicator can be redrawn. - */ - private final Rect mTempRect = new Rect(); - - /** - * The custom menu view set by the user. - */ - private View mMenuView; - - /** - * The parent of the menu view. - */ - protected BuildLayerFrameLayout mMenuContainer; - - /** - * The parent of the content view. - */ - protected BuildLayerFrameLayout mContentContainer; - - /** - * The size of the menu (width or height depending on the gravity). - */ - protected int mMenuSize; - - /** - * Indicates whether the menu size has been set explicity either via the theme or by calling - * {@link #setMenuSize(int)}. - */ - protected boolean mMenuSizeSet; - - /** - * Indicates whether the menu is currently visible. - */ - protected boolean mMenuVisible; - - /** - * The drag mode of the drawer. Can be either {@link #MENU_DRAG_CONTENT} or {@link #MENU_DRAG_WINDOW}. - */ - private int mDragMode = MENU_DRAG_CONTENT; - - /** - * The current drawer state. - * - * @see #STATE_CLOSED - * @see #STATE_CLOSING - * @see #STATE_DRAGGING - * @see #STATE_OPENING - * @see #STATE_OPEN - */ - protected int mDrawerState = STATE_CLOSED; - - /** - * The touch bezel size of the drawer in px. - */ - protected int mTouchBezelSize; - - /** - * The touch area size of the drawer in px. - */ - protected int mTouchSize; - - /** - * Listener used to dispatch state change events. - */ - private OnDrawerStateChangeListener mOnDrawerStateChangeListener; - - /** - * Touch mode for the Drawer. - * Possible values are {@link #TOUCH_MODE_NONE}, {@link #TOUCH_MODE_BEZEL} or {@link #TOUCH_MODE_FULLSCREEN} - * Default: {@link #TOUCH_MODE_BEZEL} - */ - protected int mTouchMode = TOUCH_MODE_BEZEL; - - /** - * Indicates whether to use {@link View#LAYER_TYPE_HARDWARE} when animating the drawer. - */ - protected boolean mHardwareLayersEnabled = true; - - /** - * The Activity the drawer is attached to. - */ - private Activity mActivity; - - /** - * Scroller used when animating the indicator to a new position. - */ - private FloatScroller mIndicatorScroller; - - /** - * Runnable used when animating the indicator to a new position. - */ - private Runnable mIndicatorRunnable = new Runnable() { - @Override - public void run() { - animateIndicatorInvalidate(); - } - }; - - /** - * The start position of the indicator when animating it to a new position. - */ - protected int mIndicatorStartPos; - - /** - * [0..1] value indicating the current progress of the animation. - */ - protected float mIndicatorOffset; - - /** - * Whether the indicator is currently animating. - */ - protected boolean mIndicatorAnimating; - - /** - * Bundle used to hold the drawers state. - */ - protected Bundle mState; - - /** - * The maximum duration of open/close animations. - */ - protected int mMaxAnimationDuration = DEFAULT_ANIMATION_DURATION; - - /** - * Callback that lets the listener override intercepting of touch events. - */ - protected OnInterceptMoveEventListener mOnInterceptMoveEventListener; - - /** - * Attaches the MenuDrawer to the Activity. - * - * @param activity The activity that the MenuDrawer will be attached to. - * @return The created MenuDrawer instance. - */ - public static MenuDrawer attach(Activity activity) { - return attach(activity, MENU_DRAG_CONTENT); - } - - /** - * Attaches the MenuDrawer to the Activity. - * - * @param activity The activity the menu drawer will be attached to. - * @param dragMode The drag mode of the drawer. Can be either {@link MenuDrawer#MENU_DRAG_CONTENT} - * or {@link MenuDrawer#MENU_DRAG_WINDOW}. - * @return The created MenuDrawer instance. - */ - public static MenuDrawer attach(Activity activity, int dragMode) { - return attach(activity, dragMode, Position.LEFT); - } - - /** - * Attaches the MenuDrawer to the Activity. - * - * @param activity The activity the menu drawer will be attached to. - * @param position Where to position the menu. - * @return The created MenuDrawer instance. - */ - public static MenuDrawer attach(Activity activity, Position position) { - return attach(activity, MENU_DRAG_CONTENT, position); - } - - /** - * Attaches the MenuDrawer to the Activity. - * - * @param activity The activity the menu drawer will be attached to. - * @param dragMode The drag mode of the drawer. Can be either {@link MenuDrawer#MENU_DRAG_CONTENT} - * or {@link MenuDrawer#MENU_DRAG_WINDOW}. - * @param position Where to position the menu. - * @return The created MenuDrawer instance. - */ - public static MenuDrawer attach(Activity activity, int dragMode, Position position) { - return attach(activity, dragMode, position, false); - } - - /** - * Attaches the MenuDrawer to the Activity. - * - * @param activity The activity the menu drawer will be attached to. - * @param dragMode The drag mode of the drawer. Can be either {@link MenuDrawer#MENU_DRAG_CONTENT} - * or {@link MenuDrawer#MENU_DRAG_WINDOW}. - * @param position Where to position the menu. - * @param attachStatic Whether a static (non-draggable, always visible) drawer should be used. - * @return The created MenuDrawer instance. - */ - public static MenuDrawer attach(Activity activity, int dragMode, Position position, boolean attachStatic) { - MenuDrawer menuDrawer = createMenuDrawer(activity, dragMode, position, attachStatic); - menuDrawer.setId(R.id.md__drawer); - - switch (dragMode) { - case MenuDrawer.MENU_DRAG_CONTENT: - attachToContent(activity, menuDrawer); - break; - - case MenuDrawer.MENU_DRAG_WINDOW: - attachToDecor(activity, menuDrawer); - break; - - default: - throw new RuntimeException("Unknown menu mode: " + dragMode); - } - - return menuDrawer; - } - - /** - * Constructs the appropriate MenuDrawer based on the position. - */ - private static MenuDrawer createMenuDrawer(Activity activity, int dragMode, Position position, - boolean attachStatic) { - if (attachStatic) { - switch (position) { - case LEFT: - return new LeftStaticDrawer(activity, dragMode); - case RIGHT: - return new RightStaticDrawer(activity, dragMode); - case TOP: - return new TopStaticDrawer(activity, dragMode); - case BOTTOM: - return new BottomStaticDrawer(activity, dragMode); - default: - throw new IllegalArgumentException("position must be one of LEFT, TOP, RIGHT or BOTTOM"); - } - } - - switch (position) { - case LEFT: - return new LeftDrawer(activity, dragMode); - case RIGHT: - return new RightDrawer(activity, dragMode); - case TOP: - return new TopDrawer(activity, dragMode); - case BOTTOM: - return new BottomDrawer(activity, dragMode); - default: - throw new IllegalArgumentException("position must be one of LEFT, TOP, RIGHT or BOTTOM"); - } - } - - /** - * Attaches the menu drawer to the content view. - */ - private static void attachToContent(Activity activity, MenuDrawer menuDrawer) { - /** - * Do not call mActivity#setContentView. - * E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to - * MenuDrawer#setContentView, which then again would call Activity#setContentView. - */ - ViewGroup content = (ViewGroup) activity.findViewById(android.R.id.content); - content.removeAllViews(); - content.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - } - - /** - * Attaches the menu drawer to the window. - */ - private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) { - ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); - ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0); - - decorView.removeAllViews(); - decorView.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - - menuDrawer.mContentContainer.addView(decorChild, decorChild.getLayoutParams()); - } - - MenuDrawer(Activity activity, int dragMode) { - this(activity); - - mActivity = activity; - mDragMode = dragMode; - } - - public MenuDrawer(Context context) { - this(context, null); - } - - public MenuDrawer(Context context, AttributeSet attrs) { - this(context, attrs, R.attr.menuDrawerStyle); - } - - public MenuDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - initDrawer(context, attrs, defStyle); - } - - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - setWillNotDraw(false); - setFocusable(false); - - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MenuDrawer, R.attr.menuDrawerStyle, - R.style.Widget_MenuDrawer); - - final Drawable contentBackground = a.getDrawable(R.styleable.MenuDrawer_mdContentBackground); - final Drawable menuBackground = a.getDrawable(R.styleable.MenuDrawer_mdMenuBackground); - - mMenuSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdMenuSize, -1); - mMenuSizeSet = mMenuSize != -1; - - final int indicatorResId = a.getResourceId(R.styleable.MenuDrawer_mdActiveIndicator, 0); - if (indicatorResId != 0) { - mActiveIndicator = BitmapFactory.decodeResource(getResources(), indicatorResId); - } - - mDropShadowEnabled = a.getBoolean(R.styleable.MenuDrawer_mdDropShadowEnabled, true); - - mDropShadowDrawable = a.getDrawable(R.styleable.MenuDrawer_mdDropShadow); - - if (mDropShadowDrawable == null) { - final int dropShadowColor = a.getColor(R.styleable.MenuDrawer_mdDropShadowColor, 0xFF000000); - setDropShadowColor(dropShadowColor); - } - - mDropShadowSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdDropShadowSize, - dpToPx(DEFAULT_DROP_SHADOW_DP)); - - mTouchBezelSize = a.getDimensionPixelSize(R.styleable.MenuDrawer_mdTouchBezelSize, - dpToPx(DEFAULT_DRAG_BEZEL_DP)); - - mAllowIndicatorAnimation = a.getBoolean(R.styleable.MenuDrawer_mdAllowIndicatorAnimation, false); - - mMaxAnimationDuration = a.getInt(R.styleable.MenuDrawer_mdMaxAnimationDuration, DEFAULT_ANIMATION_DURATION); - - a.recycle(); - - mMenuContainer = new BuildLayerFrameLayout(context); - mMenuContainer.setId(R.id.md__menu); - mMenuContainer.setBackgroundDrawable(menuBackground); - super.addView(mMenuContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - - mContentContainer = new NoClickThroughFrameLayout(context); - mContentContainer.setId(R.id.md__content); - mContentContainer.setBackgroundDrawable(contentBackground); - super.addView(mContentContainer, -1, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - - mMenuOverlay = new ColorDrawable(0xFF000000); - - mIndicatorScroller = new FloatScroller(SMOOTH_INTERPOLATOR); - } - - @Override - public void addView(View child, int index, LayoutParams params) { - int childCount = mMenuContainer.getChildCount(); - if (childCount == 0) { - mMenuContainer.addView(child, index, params); - return; - } - - childCount = mContentContainer.getChildCount(); - if (childCount == 0) { - mContentContainer.addView(child, index, params); - return; - } - - throw new IllegalStateException("MenuDrawer can only hold two child views"); - } - - protected int dpToPx(int dp) { - return (int) (getResources().getDisplayMetrics().density * dp + 0.5f); - } - - protected boolean isViewDescendant(View v) { - ViewParent parent = v.getParent(); - while (parent != null) { - if (parent == this) { - return true; - } - - parent = parent.getParent(); - } - - return false; - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - getViewTreeObserver().addOnScrollChangedListener(mScrollListener); - } - - @Override - protected void onDetachedFromWindow() { - getViewTreeObserver().removeOnScrollChangedListener(mScrollListener); - super.onDetachedFromWindow(); - } - - /** - * Toggles the menu open and close with animation. - */ - public void toggleMenu() { - toggleMenu(true); - } - - /** - * Toggles the menu open and close. - * - * @param animate Whether open/close should be animated. - */ - public abstract void toggleMenu(boolean animate); - - /** - * Animates the menu open. - */ - public void openMenu() { - openMenu(true); - } - - /** - * Opens the menu. - * - * @param animate Whether open/close should be animated. - */ - public abstract void openMenu(boolean animate); - - /** - * Animates the menu closed. - */ - public void closeMenu() { - closeMenu(true); - } - - /** - * Closes the menu. - * - * @param animate Whether open/close should be animated. - */ - public abstract void closeMenu(boolean animate); - - /** - * Indicates whether the menu is currently visible. - * - * @return True if the menu is open, false otherwise. - */ - public abstract boolean isMenuVisible(); - - /** - * Set the size of the menu drawer when open. - * - * @param size The size of the menu. - */ - public abstract void setMenuSize(int size); - - /** - * Returns the size of the menu. - * - * @return The size of the menu. - */ - public int getMenuSize() { - return mMenuSize; - } - - /** - * Set the active view. - * If the mdActiveIndicator attribute is set, this View will have the indicator drawn next to it. - * - * @param v The active view. - */ - public void setActiveView(View v) { - setActiveView(v, 0); - } - - /** - * Set the active view. - * If the mdActiveIndicator attribute is set, this View will have the indicator drawn next to it. - * - * @param v The active view. - * @param position Optional position, usually used with ListView. v.setTag(R.id.mdActiveViewPosition, position) - * must be called first. - */ - public void setActiveView(View v, int position) { - final View oldView = mActiveView; - mActiveView = v; - mActivePosition = position; - - if (mAllowIndicatorAnimation && oldView != null) { - startAnimatingIndicator(); - } - - invalidate(); - } - - /** - * Sets whether the indicator should be animated between active views. - * - * @param animate Whether the indicator should be animated between active views. - */ - public void setAllowIndicatorAnimation(boolean animate) { - if (animate != mAllowIndicatorAnimation) { - mAllowIndicatorAnimation = animate; - completeAnimatingIndicator(); - } - } - - /** - * Indicates whether the indicator should be animated between active views. - * - * @return Whether the indicator should be animated between active views. - */ - public boolean getAllowIndicatorAnimation() { - return mAllowIndicatorAnimation; - } - - /** - * Scroll listener that checks whether the active view has moved before the drawer is invalidated. - */ - private ViewTreeObserver.OnScrollChangedListener mScrollListener = new ViewTreeObserver.OnScrollChangedListener() { - @Override - public void onScrollChanged() { - if (mActiveView != null && isViewDescendant(mActiveView)) { - mActiveView.getDrawingRect(mTempRect); - offsetDescendantRectToMyCoords(mActiveView, mTempRect); - if (mTempRect.left != mActiveRect.left || mTempRect.top != mActiveRect.top - || mTempRect.right != mActiveRect.right || mTempRect.bottom != mActiveRect.bottom) { - invalidate(); - } - } - } - }; - - /** - * Starts animating the indicator to a new position. - */ - private void startAnimatingIndicator() { - mIndicatorStartPos = getIndicatorStartPos(); - mIndicatorAnimating = true; - mIndicatorScroller.startScroll(0.0f, 1.0f, INDICATOR_ANIM_DURATION); - - animateIndicatorInvalidate(); - } - - /** - * Returns the start position of the indicator. - * - * @return The start position of the indicator. - */ - protected abstract int getIndicatorStartPos(); - - /** - * Callback when each frame in the indicator animation should be drawn. - */ - private void animateIndicatorInvalidate() { - if (mIndicatorScroller.computeScrollOffset()) { - mIndicatorOffset = mIndicatorScroller.getCurr(); - invalidate(); - - if (!mIndicatorScroller.isFinished()) { - postOnAnimation(mIndicatorRunnable); - return; - } - } - - completeAnimatingIndicator(); - } - - /** - * Called when the indicator animation has completed. - */ - private void completeAnimatingIndicator() { - mIndicatorOffset = 1.0f; - mIndicatorAnimating = false; - invalidate(); - } - - /** - * Enables or disables offsetting the menu when dragging the drawer. - * - * @param offsetMenu True to offset the menu, false otherwise. - */ - public abstract void setOffsetMenuEnabled(boolean offsetMenu); - - /** - * Indicates whether the menu is being offset when dragging the drawer. - * - * @return True if the menu is being offset, false otherwise. - */ - public abstract boolean getOffsetMenuEnabled(); - - public int getDrawerState() { - return mDrawerState; - } - - /** - * Register a callback to be invoked when the drawer state changes. - * - * @param listener The callback that will run. - */ - public void setOnDrawerStateChangeListener(OnDrawerStateChangeListener listener) { - mOnDrawerStateChangeListener = listener; - } - - /** - * Register a callback that will be invoked when the drawer is about to intercept touch events. - * - * @param listener The callback that will be invoked. - */ - public void setOnInterceptMoveEventListener(OnInterceptMoveEventListener listener) { - mOnInterceptMoveEventListener = listener; - } - - /** - * Defines whether the drop shadow is enabled. - * - * @param enabled Whether the drop shadow is enabled. - */ - public void setDropShadowEnabled(boolean enabled) { - mDropShadowEnabled = enabled; - invalidate(); - } - - /** - * Sets the color of the drop shadow. - * - * @param color The color of the drop shadow. - */ - public abstract void setDropShadowColor(int color); - - /** - * Sets the drawable of the drop shadow. - * - * @param drawable The drawable of the drop shadow. - */ - public void setDropShadow(Drawable drawable) { - mDropShadowDrawable = drawable; - invalidate(); - } - - /** - * Sets the drawable of the drop shadow. - * - * @param resId The resource identifier of the the drawable. - */ - public void setDropShadow(int resId) { - setDropShadow(getResources().getDrawable(resId)); - } - - /** - * Returns the drawable of the drop shadow. - */ - public Drawable getDropShadow() { - return mDropShadowDrawable; - } - - /** - * Sets the size of the drop shadow. - * - * @param size The size of the drop shadow in px. - */ - public void setDropShadowSize(int size) { - mDropShadowSize = size; - invalidate(); - } - - /** - * Animates the drawer slightly open until the user opens the drawer. - */ - public abstract void peekDrawer(); - - /** - * Animates the drawer slightly open. If delay is larger than 0, this happens until the user opens the drawer. - * - * @param delay The delay (in milliseconds) between each run of the animation. If 0, this animation is only run - * once. - */ - public abstract void peekDrawer(long delay); - - /** - * Animates the drawer slightly open. If delay is larger than 0, this happens until the user opens the drawer. - * - * @param startDelay The delay (in milliseconds) until the animation is first run. - * @param delay The delay (in milliseconds) between each run of the animation. If 0, this animation is only run - * once. - */ - public abstract void peekDrawer(long startDelay, long delay); - - /** - * Enables or disables the user of {@link View#LAYER_TYPE_HARDWARE} when animations views. - * - * @param enabled Whether hardware layers are enabled. - */ - public abstract void setHardwareLayerEnabled(boolean enabled); - - /** - * Sets the maximum duration of open/close animations. - * @param duration The maximum duration in milliseconds. - */ - public void setMaxAnimationDuration(int duration) { - mMaxAnimationDuration = duration; - } - - /** - * Returns the ViewGroup used as a parent for the menu view. - * - * @return The menu view's parent. - */ - public ViewGroup getMenuContainer() { - return mMenuContainer; - } - - /** - * Returns the ViewGroup used as a parent for the content view. - * - * @return The content view's parent. - */ - public ViewGroup getContentContainer() { - if (mDragMode == MENU_DRAG_CONTENT) { - return mContentContainer; - } else { - return (ViewGroup) findViewById(android.R.id.content); - } - } - - /** - * Set the menu view from a layout resource. - * - * @param layoutResId Resource ID to be inflated. - */ - public void setMenuView(int layoutResId) { - mMenuContainer.removeAllViews(); - mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false); - mMenuContainer.addView(mMenuView); - } - - /** - * Set the menu view to an explicit view. - * - * @param view The menu view. - */ - public void setMenuView(View view) { - setMenuView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - } - - /** - * Set the menu view to an explicit view. - * - * @param view The menu view. - * @param params Layout parameters for the view. - */ - public void setMenuView(View view, LayoutParams params) { - mMenuView = view; - mMenuContainer.removeAllViews(); - mMenuContainer.addView(view, params); - } - - /** - * Returns the menu view. - * - * @return The menu view. - */ - public View getMenuView() { - return mMenuView; - } - - /** - * Set the content from a layout resource. - * - * @param layoutResId Resource ID to be inflated. - */ - public void setContentView(int layoutResId) { - switch (mDragMode) { - case MenuDrawer.MENU_DRAG_CONTENT: - mContentContainer.removeAllViews(); - LayoutInflater.from(getContext()).inflate(layoutResId, mContentContainer, true); - break; - - case MenuDrawer.MENU_DRAG_WINDOW: - mActivity.setContentView(layoutResId); - break; - } - } - - /** - * Set the content to an explicit view. - * - * @param view The desired content to display. - */ - public void setContentView(View view) { - setContentView(view, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - } - - /** - * Set the content to an explicit view. - * - * @param view The desired content to display. - * @param params Layout parameters for the view. - */ - public void setContentView(View view, LayoutParams params) { - switch (mDragMode) { - case MenuDrawer.MENU_DRAG_CONTENT: - mContentContainer.removeAllViews(); - mContentContainer.addView(view, params); - break; - - case MenuDrawer.MENU_DRAG_WINDOW: - mActivity.setContentView(view, params); - break; - } - } - - protected void setDrawerState(int state) { - if (state != mDrawerState) { - final int oldState = mDrawerState; - mDrawerState = state; - if (mOnDrawerStateChangeListener != null) mOnDrawerStateChangeListener.onDrawerStateChange(oldState, state); - if (DEBUG) logDrawerState(state); - } - } - - protected void logDrawerState(int state) { - switch (state) { - case STATE_CLOSED: - Log.d(TAG, "[DrawerState] STATE_CLOSED"); - break; - - case STATE_CLOSING: - Log.d(TAG, "[DrawerState] STATE_CLOSING"); - break; - - case STATE_DRAGGING: - Log.d(TAG, "[DrawerState] STATE_DRAGGING"); - break; - - case STATE_OPENING: - Log.d(TAG, "[DrawerState] STATE_OPENING"); - break; - - case STATE_OPEN: - Log.d(TAG, "[DrawerState] STATE_OPEN"); - break; - - default: - Log.d(TAG, "[DrawerState] Unknown: " + state); - } - } - - /** - * Returns the touch mode. - */ - public abstract int getTouchMode(); - - /** - * Sets the drawer touch mode. Possible values are {@link #TOUCH_MODE_NONE}, {@link #TOUCH_MODE_BEZEL} or - * {@link #TOUCH_MODE_FULLSCREEN}. - * - * @param mode The touch mode. - */ - public abstract void setTouchMode(int mode); - - /** - * Sets the size of the touch bezel. - * - * @param size The touch bezel size in px. - */ - public abstract void setTouchBezelSize(int size); - - /** - * Returns the size of the touch bezel in px. - */ - public abstract int getTouchBezelSize(); - - @Override - public void postOnAnimation(Runnable action) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - super.postOnAnimation(action); - } else { - postDelayed(action, ANIMATION_DELAY); - } - } - - @Override - protected boolean fitSystemWindows(Rect insets) { - if (mDragMode == MENU_DRAG_WINDOW) { - mMenuContainer.setPadding(0, insets.top, 0, 0); - } - return super.fitSystemWindows(insets); - } - - /** - * Saves the state of the drawer. - * - * @return Returns a Parcelable containing the drawer state. - */ - public final Parcelable saveState() { - if (mState == null) mState = new Bundle(); - saveState(mState); - return mState; - } - - void saveState(Bundle state) { - // State saving isn't required for subclasses. - } - - /** - * Restores the state of the drawer. - * - * @param in A parcelable containing the drawer state. - */ - public void restoreState(Parcelable in) { - mState = (Bundle) in; - } - - @Override - protected Parcelable onSaveInstanceState() { - Parcelable superState = super.onSaveInstanceState(); - SavedState state = new SavedState(superState); - - if (mState == null) mState = new Bundle(); - saveState(mState); - - state.mState = mState; - return state; - } - - @Override - protected void onRestoreInstanceState(Parcelable state) { - SavedState savedState = (SavedState) state; - super.onRestoreInstanceState(savedState.getSuperState()); - - restoreState(savedState.mState); - } - - static class SavedState extends BaseSavedState { - - Bundle mState; - - public SavedState(Parcelable superState) { - super(superState); - } - - public SavedState(Parcel in) { - super(in); - mState = in.readBundle(); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeBundle(mState); - } - - @SuppressWarnings("UnusedDeclaration") - public static final Creator CREATOR = new Creator() { - @Override - public SavedState createFromParcel(Parcel in) { - return new SavedState(in); - } - - @Override - public SavedState[] newArray(int size) { - return new SavedState[size]; - } - }; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/NoClickThroughFrameLayout.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/NoClickThroughFrameLayout.java deleted file mode 100644 index 9462282c..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/NoClickThroughFrameLayout.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.simonvt.menudrawer; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.MotionEvent; - -/** - * FrameLayout which doesn't let touch events propagate to views positioned behind it in the view hierarchy. - */ -public class NoClickThroughFrameLayout extends BuildLayerFrameLayout { - - public NoClickThroughFrameLayout(Context context) { - super(context); - } - - public NoClickThroughFrameLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public NoClickThroughFrameLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public boolean onTouchEvent(MotionEvent event) { - return true; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/PeekInterpolator.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/PeekInterpolator.java deleted file mode 100644 index d0c7600f..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/PeekInterpolator.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.simonvt.menudrawer; - -import android.view.animation.Interpolator; - -public class PeekInterpolator implements Interpolator { - - private static final String TAG = "PeekInterpolator"; - - private static final SinusoidalInterpolator SINUSOIDAL_INTERPOLATOR = new SinusoidalInterpolator(); - - @Override - public float getInterpolation(float input) { - float result; - - if (input < 1.f / 3.f) { - result = SINUSOIDAL_INTERPOLATOR.getInterpolation(input * 3); - - } else if (input > 2.f / 3.f) { - final float val = ((input + 1.f / 3.f) - 1.f) * 3.f; - result = 1.f - SINUSOIDAL_INTERPOLATOR.getInterpolation(val); - - } else { - result = 1.f; - } - - return result; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/Position.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/Position.java deleted file mode 100644 index e1a3dd3a..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/Position.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.simonvt.menudrawer; - -/** - * Enums used for positioning the drawer. - */ -public enum Position { - // Positions the drawer to the left of the content. - LEFT, - - // Positions the drawer above the content. - TOP, - - // Positions the drawer to the right of the content. - RIGHT, - - // Positions the drawer below the content. - BOTTOM, -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightDrawer.java deleted file mode 100644 index 5d75904a..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightDrawer.java +++ /dev/null @@ -1,234 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class RightDrawer extends HorizontalDrawer { - - private int mIndicatorTop; - - RightDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public RightDrawer(Context context) { - super(context); - } - - public RightDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public RightDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public void openMenu(boolean animate) { - animateOffsetTo(-mMenuSize, 0, animate); - } - - @Override - public void closeMenu(boolean animate) { - animateOffsetTo(0, 0, animate); - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - final int width = r - l; - final int height = b - t; - final int offsetPixels = (int) mOffsetPixels; - - mMenuContainer.layout(width - mMenuSize, 0, width, height); - offsetMenu(offsetPixels); - - if (USE_TRANSLATIONS) { - mContentContainer.layout(0, 0, width, height); - } else { - mContentContainer.layout(offsetPixels, 0, width + offsetPixels, height); - } - } - - /** - * Offsets the menu relative to its original position based on the position of the content. - * - * @param offsetPixels The number of pixels the content if offset. - */ - private void offsetMenu(int offsetPixels) { - if (mOffsetMenu && mMenuSize != 0) { - final int menuWidth = mMenuSize; - final float openRatio = (menuWidth + (float) offsetPixels) / menuWidth; - - if (USE_TRANSLATIONS) { - if (offsetPixels != 0) { - final int offset = (int) (0.25f * (openRatio * menuWidth)); - mMenuContainer.setTranslationX(offset); - } else { - mMenuContainer.setTranslationX(-menuWidth); - } - - } else { - final int width = getWidth(); - final int oldMenuRight = mMenuContainer.getRight(); - final int newRight = width + (int) (0.25f * (openRatio * menuWidth)); - final int offset = newRight - oldMenuRight; - mMenuContainer.offsetLeftAndRight(offset); - mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE); - } - } - } - - @Override - protected void drawDropShadow(Canvas canvas, int offsetPixels) { - final int height = getHeight(); - final int width = getWidth(); - final int left = width + offsetPixels; - final int right = left + mDropShadowSize; - - mDropShadowDrawable.setBounds(left, 0, right, height); - mDropShadowDrawable.draw(canvas); - } - - @Override - protected void drawMenuOverlay(Canvas canvas, int offsetPixels) { - final int height = getHeight(); - final int width = getWidth(); - final int left = width + offsetPixels; - final int right = width; - final float openRatio = ((float) Math.abs(offsetPixels)) / mMenuSize; - - mMenuOverlay.setBounds(left, 0, right, height); - mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * (1.f - openRatio))); - mMenuOverlay.draw(canvas); - } - - @Override - protected void drawIndicator(Canvas canvas, int offsetPixels) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int width = getWidth(); - final int menuWidth = mMenuSize; - final int indicatorWidth = mActiveIndicator.getWidth(); - - final int contentRight = width + offsetPixels; - final float openRatio = ((float) Math.abs(offsetPixels)) / menuWidth; - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - - final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio)); - final int interpolatedWidth = (int) (indicatorWidth * interpolatedRatio); - - final int indicatorRight = contentRight + interpolatedWidth; - final int indicatorLeft = indicatorRight - indicatorWidth; - - if (mIndicatorAnimating) { - final int indicatorFinalTop = mActiveRect.top + ((mActiveRect.height() - - mActiveIndicator.getHeight()) / 2); - final int indicatorStartTop = mIndicatorStartPos; - final int diff = indicatorFinalTop - indicatorStartTop; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorTop = indicatorStartTop + startOffset; - } else { - mIndicatorTop = mActiveRect.top + ((mActiveRect.height() - mActiveIndicator.getHeight()) / 2); - } - - canvas.save(); - canvas.clipRect(contentRight, 0, indicatorRight, getHeight()); - canvas.drawBitmap(mActiveIndicator, indicatorLeft, mIndicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorTop; - } - - @Override - protected void initPeekScroller() { - final int dx = -mMenuSize / 3; - mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION); - } - - @Override - protected void onOffsetPixelsChanged(int offsetPixels) { - if (USE_TRANSLATIONS) { - mContentContainer.setTranslationX(offsetPixels); - offsetMenu(offsetPixels); - invalidate(); - } else { - mContentContainer.offsetLeftAndRight(offsetPixels - mContentContainer.getLeft()); - offsetMenu(offsetPixels); - invalidate(); - } - } - - ////////////////////////////////////////////////////////////////////// - // Touch handling - ////////////////////////////////////////////////////////////////////// - - @Override - protected boolean isContentTouch(MotionEvent ev) { - return ev.getX() < getWidth() + mOffsetPixels; - } - - @Override - protected boolean onDownAllowDrag(MotionEvent ev) { - final int width = getWidth(); - final int initialMotionX = (int) mInitialMotionX; - - return (!mMenuVisible && initialMotionX >= width - mTouchSize) - || (mMenuVisible && initialMotionX <= width + mOffsetPixels); - } - - @Override - protected boolean onMoveAllowDrag(MotionEvent ev, float diff) { - final int width = getWidth(); - final int initialMotionX = (int) mInitialMotionX; - - return (!mMenuVisible && initialMotionX >= width - mTouchSize && (diff < 0)) - || (mMenuVisible && initialMotionX <= width + mOffsetPixels); - } - - @Override - protected void onMoveEvent(float dx) { - final float newOffset = Math.max(Math.min(mOffsetPixels + dx, 0), -mMenuSize); - setOffsetPixels(newOffset); - } - - @Override - protected void onUpEvent(MotionEvent ev) { - final int offsetPixels = (int) mOffsetPixels; - final int width = getWidth(); - - if (mIsDragging) { - mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity); - final int initialVelocity = (int) mVelocityTracker.getXVelocity(); - mLastMotionX = ev.getX(); - animateOffsetTo(mVelocityTracker.getXVelocity() > 0 ? 0 : -mMenuSize, initialVelocity, true); - - // Close the menu when content is clicked while the menu is visible. - } else if (mMenuVisible && ev.getX() < width + offsetPixels) { - closeMenu(); - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightStaticDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightStaticDrawer.java deleted file mode 100644 index 2027b43a..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/RightStaticDrawer.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; - -public class RightStaticDrawer extends StaticDrawer { - - private int mIndicatorTop; - - RightStaticDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public RightStaticDrawer(Context context) { - super(context); - } - - public RightStaticDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public RightStaticDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - super.initDrawer(context, attrs, defStyle); - mPosition = Position.RIGHT; - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void drawIndicator(Canvas canvas) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int width = getWidth(); - final int menuWidth = mMenuSize; - final int indicatorWidth = mActiveIndicator.getWidth(); - - final int contentRight = width - menuWidth; - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - - final int indicatorRight = contentRight + indicatorWidth; - final int indicatorLeft = contentRight; - - if (mIndicatorAnimating) { - final int indicatorFinalTop = mActiveRect.top + ((mActiveRect.height() - - mActiveIndicator.getHeight()) / 2); - final int indicatorStartTop = mIndicatorStartPos; - final int diff = indicatorFinalTop - indicatorStartTop; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorTop = indicatorStartTop + startOffset; - } else { - mIndicatorTop = mActiveRect.top + ((mActiveRect.height() - mActiveIndicator.getHeight()) / 2); - } - - canvas.save(); - canvas.clipRect(contentRight, 0, indicatorRight, getHeight()); - canvas.drawBitmap(mActiveIndicator, indicatorLeft, mIndicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorTop; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/Scroller.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/Scroller.java deleted file mode 100644 index 58f0fc54..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/Scroller.java +++ /dev/null @@ -1,505 +0,0 @@ -/* - * Copyright (C) 2006 The Android Open Source Project - * - * 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 net.simonvt.menudrawer; - -import android.content.Context; -import android.hardware.SensorManager; -import android.os.Build; -import android.util.FloatMath; -import android.view.ViewConfiguration; -import android.view.animation.AnimationUtils; -import android.view.animation.Interpolator; - - -/** - * This class encapsulates scrolling. The duration of the scroll - * can be passed in the constructor and specifies the maximum time that - * the scrolling animation should take. Past this time, the scrolling is - * automatically moved to its final stage and computeScrollOffset() - * will always return false to indicate that scrolling is over. - */ -public class Scroller { - private int mMode; - - private int mStartX; - private int mStartY; - private int mFinalX; - private int mFinalY; - - private int mMinX; - private int mMaxX; - private int mMinY; - private int mMaxY; - - private int mCurrX; - private int mCurrY; - private long mStartTime; - private int mDuration; - private float mDurationReciprocal; - private float mDeltaX; - private float mDeltaY; - private boolean mFinished; - private Interpolator mInterpolator; - private boolean mFlywheel; - - private float mVelocity; - - private static final int DEFAULT_DURATION = 250; - private static final int SCROLL_MODE = 0; - private static final int FLING_MODE = 1; - - private static final float DECELERATION_RATE = (float) (Math.log(0.75) / Math.log(0.9)); - private static final float ALPHA = 800; // pixels / seconds - private static final float START_TENSION = 0.4f; // Tension at start: (0.4 * total T, 1.0 * Distance) - private static final float END_TENSION = 1.0f - START_TENSION; - private static final int NB_SAMPLES = 100; - private static final float[] SPLINE = new float[NB_SAMPLES + 1]; - - private float mDeceleration; - private final float mPpi; - - static { - float xMin = 0.0f; - for (int i = 0; i <= NB_SAMPLES; i++) { - final float t = (float) i / NB_SAMPLES; - float xMax = 1.0f; - float x, tx, coef; - while (true) { - x = xMin + (xMax - xMin) / 2.0f; - coef = 3.0f * x * (1.0f - x); - tx = coef * ((1.0f - x) * START_TENSION + x * END_TENSION) + x * x * x; - if (Math.abs(tx - t) < 1E-5) break; - if (tx > t) xMax = x; - else xMin = x; - } - final float d = coef + x * x * x; - SPLINE[i] = d; - } - SPLINE[NB_SAMPLES] = 1.0f; - - // This controls the viscous fluid effect (how much of it) - sViscousFluidScale = 8.0f; - // must be set to 1.0 (used in viscousFluid()) - sViscousFluidNormalize = 1.0f; - sViscousFluidNormalize = 1.0f / viscousFluid(1.0f); - } - - private static float sViscousFluidScale; - private static float sViscousFluidNormalize; - - /** - * Create a Scroller with the default duration and interpolator. - */ - public Scroller(Context context) { - this(context, null); - } - - /** - * Create a Scroller with the specified interpolator. If the interpolator is - * null, the default (viscous) interpolator will be used. "Flywheel" behavior will - * be in effect for apps targeting Honeycomb or newer. - */ - public Scroller(Context context, Interpolator interpolator) { - this(context, interpolator, - context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB); - } - - /** - * Create a Scroller with the specified interpolator. If the interpolator is - * null, the default (viscous) interpolator will be used. Specify whether or - * not to support progressive "flywheel" behavior in flinging. - */ - public Scroller(Context context, Interpolator interpolator, boolean flywheel) { - mFinished = true; - mInterpolator = interpolator; - mPpi = context.getResources().getDisplayMetrics().density * 160.0f; - mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); - mFlywheel = flywheel; - } - - /** - * The amount of friction applied to flings. The default value - * is {@link android.view.ViewConfiguration#getScrollFriction}. - * - * @param friction A scalar dimension-less value representing the coefficient of - * friction. - */ - public final void setFriction(float friction) { - mDeceleration = computeDeceleration(friction); - } - - private float computeDeceleration(float friction) { - return SensorManager.GRAVITY_EARTH // g (m/s^2) - * 39.37f // inch/meter - * mPpi // pixels per inch - * friction; - } - - /** - * - * Returns whether the scroller has finished scrolling. - * - * @return True if the scroller has finished scrolling, false otherwise. - */ - public final boolean isFinished() { - return mFinished; - } - - /** - * Force the finished field to a particular value. - * - * @param finished The new finished value. - */ - public final void forceFinished(boolean finished) { - mFinished = finished; - } - - /** - * Returns how long the scroll event will take, in milliseconds. - * - * @return The duration of the scroll in milliseconds. - */ - public final int getDuration() { - return mDuration; - } - - /** - * Returns the current X offset in the scroll. - * - * @return The new X offset as an absolute distance from the origin. - */ - public final int getCurrX() { - return mCurrX; - } - - /** - * Returns the current Y offset in the scroll. - * - * @return The new Y offset as an absolute distance from the origin. - */ - public final int getCurrY() { - return mCurrY; - } - - /** - * Returns the current velocity. - * - * @return The original velocity less the deceleration. Result may be - * negative. - */ - public float getCurrVelocity() { - return mVelocity - mDeceleration * timePassed() / 2000.0f; - } - - /** - * Returns the start X offset in the scroll. - * - * @return The start X offset as an absolute distance from the origin. - */ - public final int getStartX() { - return mStartX; - } - - /** - * Returns the start Y offset in the scroll. - * - * @return The start Y offset as an absolute distance from the origin. - */ - public final int getStartY() { - return mStartY; - } - - /** - * Returns where the scroll will end. Valid only for "fling" scrolls. - * - * @return The final X offset as an absolute distance from the origin. - */ - public final int getFinalX() { - return mFinalX; - } - - /** - * Returns where the scroll will end. Valid only for "fling" scrolls. - * - * @return The final Y offset as an absolute distance from the origin. - */ - public final int getFinalY() { - return mFinalY; - } - - /** - * Call this when you want to know the new location. If it returns true, - * the animation is not yet finished. loc will be altered to provide the - * new location. - */ - public boolean computeScrollOffset() { - if (mFinished) { - return false; - } - - int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime); - - if (timePassed < mDuration) { - switch (mMode) { - case SCROLL_MODE: - float x = timePassed * mDurationReciprocal; - - if (mInterpolator == null) - x = viscousFluid(x); - else - x = mInterpolator.getInterpolation(x); - - mCurrX = mStartX + Math.round(x * mDeltaX); - mCurrY = mStartY + Math.round(x * mDeltaY); - break; - case FLING_MODE: - final float t = (float) timePassed / mDuration; - final int index = (int) (NB_SAMPLES * t); - final float tInf = (float) index / NB_SAMPLES; - final float tSup = (float) (index + 1) / NB_SAMPLES; - final float dInf = SPLINE[index]; - final float dSup = SPLINE[index + 1]; - final float distanceCoef = dInf + (t - tInf) / (tSup - tInf) * (dSup - dInf); - - mCurrX = mStartX + Math.round(distanceCoef * (mFinalX - mStartX)); - // Pin to mMinX <= mCurrX <= mMaxX - mCurrX = Math.min(mCurrX, mMaxX); - mCurrX = Math.max(mCurrX, mMinX); - - mCurrY = mStartY + Math.round(distanceCoef * (mFinalY - mStartY)); - // Pin to mMinY <= mCurrY <= mMaxY - mCurrY = Math.min(mCurrY, mMaxY); - mCurrY = Math.max(mCurrY, mMinY); - - if (mCurrX == mFinalX && mCurrY == mFinalY) { - mFinished = true; - } - - break; - } - } else { - mCurrX = mFinalX; - mCurrY = mFinalY; - mFinished = true; - } - return true; - } - - /** - * Start scrolling by providing a starting point and the distance to travel. - * The scroll will use the default value of 250 milliseconds for the - * duration. - * - * @param startX Starting horizontal scroll offset in pixels. Positive - * numbers will scroll the content to the left. - * @param startY Starting vertical scroll offset in pixels. Positive numbers - * will scroll the content up. - * @param dx Horizontal distance to travel. Positive numbers will scroll the - * content to the left. - * @param dy Vertical distance to travel. Positive numbers will scroll the - * content up. - */ - public void startScroll(int startX, int startY, int dx, int dy) { - startScroll(startX, startY, dx, dy, DEFAULT_DURATION); - } - - /** - * Start scrolling by providing a starting point and the distance to travel. - * - * @param startX Starting horizontal scroll offset in pixels. Positive - * numbers will scroll the content to the left. - * @param startY Starting vertical scroll offset in pixels. Positive numbers - * will scroll the content up. - * @param dx Horizontal distance to travel. Positive numbers will scroll the - * content to the left. - * @param dy Vertical distance to travel. Positive numbers will scroll the - * content up. - * @param duration Duration of the scroll in milliseconds. - */ - public void startScroll(int startX, int startY, int dx, int dy, int duration) { - mMode = SCROLL_MODE; - mFinished = false; - mDuration = duration; - mStartTime = AnimationUtils.currentAnimationTimeMillis(); - mStartX = startX; - mStartY = startY; - mFinalX = startX + dx; - mFinalY = startY + dy; - mDeltaX = dx; - mDeltaY = dy; - mDurationReciprocal = 1.0f / (float) mDuration; - } - - /** - * Start scrolling based on a fling gesture. The distance travelled will - * depend on the initial velocity of the fling. - * - * @param startX Starting point of the scroll (X) - * @param startY Starting point of the scroll (Y) - * @param velocityX Initial velocity of the fling (X) measured in pixels per - * second. - * @param velocityY Initial velocity of the fling (Y) measured in pixels per - * second - * @param minX Minimum X value. The scroller will not scroll past this - * point. - * @param maxX Maximum X value. The scroller will not scroll past this - * point. - * @param minY Minimum Y value. The scroller will not scroll past this - * point. - * @param maxY Maximum Y value. The scroller will not scroll past this - * point. - */ - public void fling(int startX, int startY, int velocityX, int velocityY, - int minX, int maxX, int minY, int maxY) { - // Continue a scroll or fling in progress - if (mFlywheel && !mFinished) { - float oldVel = getCurrVelocity(); - - float dx = (float) (mFinalX - mStartX); - float dy = (float) (mFinalY - mStartY); - float hyp = FloatMath.sqrt(dx * dx + dy * dy); - - float ndx = dx / hyp; - float ndy = dy / hyp; - - float oldVelocityX = ndx * oldVel; - float oldVelocityY = ndy * oldVel; - if (Math.signum(velocityX) == Math.signum(oldVelocityX) - && Math.signum(velocityY) == Math.signum(oldVelocityY)) { - velocityX += oldVelocityX; - velocityY += oldVelocityY; - } - } - - mMode = FLING_MODE; - mFinished = false; - - float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY); - - mVelocity = velocity; - final double l = Math.log(START_TENSION * velocity / ALPHA); - mDuration = (int) (1000.0 * Math.exp(l / (DECELERATION_RATE - 1.0))); - mStartTime = AnimationUtils.currentAnimationTimeMillis(); - mStartX = startX; - mStartY = startY; - - float coeffX = velocity == 0 ? 1.0f : velocityX / velocity; - float coeffY = velocity == 0 ? 1.0f : velocityY / velocity; - - int totalDistance = - (int) (ALPHA * Math.exp(DECELERATION_RATE / (DECELERATION_RATE - 1.0) * l)); - - mMinX = minX; - mMaxX = maxX; - mMinY = minY; - mMaxY = maxY; - - mFinalX = startX + Math.round(totalDistance * coeffX); - // Pin to mMinX <= mFinalX <= mMaxX - mFinalX = Math.min(mFinalX, mMaxX); - mFinalX = Math.max(mFinalX, mMinX); - - mFinalY = startY + Math.round(totalDistance * coeffY); - // Pin to mMinY <= mFinalY <= mMaxY - mFinalY = Math.min(mFinalY, mMaxY); - mFinalY = Math.max(mFinalY, mMinY); - } - - static float viscousFluid(float x) { - x *= sViscousFluidScale; - if (x < 1.0f) { - x -= (1.0f - (float) Math.exp(-x)); - } else { - float start = 0.36787944117f; // 1/e == exp(-1) - x = 1.0f - (float) Math.exp(1.0f - x); - x = start + x * (1.0f - start); - } - x *= sViscousFluidNormalize; - return x; - } - - /** - * Stops the animation. Contrary to {@link #forceFinished(boolean)}, - * aborting the animating cause the scroller to move to the final x and y - * position - * - * @see #forceFinished(boolean) - */ - public void abortAnimation() { - mCurrX = mFinalX; - mCurrY = mFinalY; - mFinished = true; - } - - /** - * Extend the scroll animation. This allows a running animation to scroll - * further and longer, when used with {@link #setFinalX(int)} or {@link #setFinalY(int)}. - * - * @param extend Additional time to scroll in milliseconds. - * @see #setFinalX(int) - * @see #setFinalY(int) - */ - public void extendDuration(int extend) { - int passed = timePassed(); - mDuration = passed + extend; - mDurationReciprocal = 1.0f / mDuration; - mFinished = false; - } - - /** - * Returns the time elapsed since the beginning of the scrolling. - * - * @return The elapsed time in milliseconds. - */ - public int timePassed() { - return (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime); - } - - /** - * Sets the final position (X) for this scroller. - * - * @param newX The new X offset as an absolute distance from the origin. - * @see #extendDuration(int) - * @see #setFinalY(int) - */ - public void setFinalX(int newX) { - mFinalX = newX; - mDeltaX = mFinalX - mStartX; - mFinished = false; - } - - /** - * Sets the final position (Y) for this scroller. - * - * @param newY The new Y offset as an absolute distance from the origin. - * @see #extendDuration(int) - * @see #setFinalX(int) - */ - public void setFinalY(int newY) { - mFinalY = newY; - mDeltaY = mFinalY - mStartY; - mFinished = false; - } - - /** - * @hide - */ - public boolean isScrollingInDirection(float xvel, float yvel) { - return !mFinished && Math.signum(xvel) == Math.signum(mFinalX - mStartX) - && Math.signum(yvel) == Math.signum(mFinalY - mStartY); - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/SinusoidalInterpolator.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/SinusoidalInterpolator.java deleted file mode 100644 index e79051a0..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/SinusoidalInterpolator.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.simonvt.menudrawer; - -import android.view.animation.Interpolator; - -/** - * Interpolator which, when drawn from 0 to 1, looks like half a sine-wave. Used for smoother opening/closing when - * peeking at the drawer. - */ -public class SinusoidalInterpolator implements Interpolator { - - @Override - public float getInterpolation(float input) { - return (float) (0.5f + 0.5f * Math.sin(input * Math.PI - Math.PI / 2.f)); - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/SmoothInterpolator.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/SmoothInterpolator.java deleted file mode 100644 index cfdcb69b..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/SmoothInterpolator.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.simonvt.menudrawer; - -import android.view.animation.Interpolator; - -public class SmoothInterpolator implements Interpolator { - - @Override - public float getInterpolation(float t) { - t -= 1.0f; - return t * t * t * t * t + 1.0f; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/StaticDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/StaticDrawer.java deleted file mode 100644 index 879f2c95..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/StaticDrawer.java +++ /dev/null @@ -1,208 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.util.AttributeSet; - -public abstract class StaticDrawer extends MenuDrawer { - - protected Position mPosition; - - StaticDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public StaticDrawer(Context context) { - super(context); - } - - public StaticDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public StaticDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void dispatchDraw(Canvas canvas) { - super.dispatchDraw(canvas); - if (mDropShadowEnabled) drawDropShadow(canvas); - if (mActiveIndicator != null) drawIndicator(canvas); - } - - private void drawDropShadow(Canvas canvas) { - final int width = getWidth(); - final int height = getHeight(); - final int menuSize = mMenuSize; - final int dropShadowSize = mDropShadowSize; - - switch (mPosition) { - case LEFT: - mDropShadowDrawable.setBounds(menuSize - dropShadowSize, 0, menuSize, height); - break; - - case TOP: - mDropShadowDrawable.setBounds(0, menuSize - dropShadowSize, width, menuSize); - break; - - case RIGHT: - mDropShadowDrawable.setBounds(width - menuSize, 0, width - menuSize + dropShadowSize, height); - break; - - case BOTTOM: - mDropShadowDrawable.setBounds(0, height - menuSize, width, height - menuSize + dropShadowSize); - break; - } - - mDropShadowDrawable.draw(canvas); - } - - protected abstract void drawIndicator(Canvas canvas); - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - final int width = r - l; - final int height = b - t; - - switch (mPosition) { - case LEFT: - mMenuContainer.layout(0, 0, mMenuSize, height); - mContentContainer.layout(mMenuSize, 0, width, height); - break; - - case RIGHT: - mMenuContainer.layout(width - mMenuSize, 0, width, height); - mContentContainer.layout(0, 0, width - mMenuSize, height); - break; - - case TOP: - mMenuContainer.layout(0, 0, width, mMenuSize); - mContentContainer.layout(0, mMenuSize, width, height); - break; - - case BOTTOM: - mMenuContainer.layout(0, height - mMenuSize, width, height); - mContentContainer.layout(0, 0, width, height - mMenuSize); - break; - } - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int widthMode = MeasureSpec.getMode(widthMeasureSpec); - final int heightMode = MeasureSpec.getMode(heightMeasureSpec); - - if (widthMode != MeasureSpec.EXACTLY || heightMode != MeasureSpec.EXACTLY) { - throw new IllegalStateException("Must measure with an exact size"); - } - - final int width = MeasureSpec.getSize(widthMeasureSpec); - final int height = MeasureSpec.getSize(heightMeasureSpec); - - if (!mMenuSizeSet) mMenuSize = (int) (height * 0.25f); - - switch (mPosition) { - case LEFT: - case RIGHT: { - final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); - - final int menuWidth = mMenuSize; - final int menuWidthMeasureSpec = MeasureSpec.makeMeasureSpec(menuWidth, MeasureSpec.EXACTLY); - - final int contentWidth = width - menuWidth; - final int contentWidthMeasureSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY); - - mContentContainer.measure(contentWidthMeasureSpec, childHeightMeasureSpec); - mMenuContainer.measure(menuWidthMeasureSpec, childHeightMeasureSpec); - break; - } - - case TOP: - case BOTTOM: { - final int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY); - - final int menuHeight = mMenuSize; - final int menuHeightMeasureSpec = MeasureSpec.makeMeasureSpec(menuHeight, MeasureSpec.EXACTLY); - - final int contentHeight = height - menuHeight; - final int contentHeightMeasureSpec = MeasureSpec.makeMeasureSpec(contentHeight, MeasureSpec.EXACTLY); - - mContentContainer.measure(childWidthMeasureSpec, contentHeightMeasureSpec); - mMenuContainer.measure(childWidthMeasureSpec, menuHeightMeasureSpec); - break; - } - } - - setMeasuredDimension(width, height); - } - - @Override - public void toggleMenu(boolean animate) { - } - - @Override - public void openMenu(boolean animate) { - } - - @Override - public void closeMenu(boolean animate) { - } - - @Override - public boolean isMenuVisible() { - return true; - } - - @Override - public void setMenuSize(int size) { - mMenuSize = size; - mMenuSizeSet = true; - requestLayout(); - invalidate(); - } - - @Override - public void setOffsetMenuEnabled(boolean offsetMenu) { - } - - @Override - public boolean getOffsetMenuEnabled() { - return false; - } - - @Override - public void peekDrawer() { - } - - @Override - public void peekDrawer(long delay) { - } - - @Override - public void peekDrawer(long startDelay, long delay) { - } - - @Override - public void setHardwareLayerEnabled(boolean enabled) { - } - - @Override - public int getTouchMode() { - return TOUCH_MODE_NONE; - } - - @Override - public void setTouchMode(int mode) { - } - - @Override - public void setTouchBezelSize(int size) { - } - - @Override - public int getTouchBezelSize() { - return 0; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopDrawer.java deleted file mode 100644 index 0af2c6ba..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopDrawer.java +++ /dev/null @@ -1,216 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class TopDrawer extends VerticalDrawer { - - private int mIndicatorLeft; - - TopDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public TopDrawer(Context context) { - super(context); - } - - public TopDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public TopDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - public void openMenu(boolean animate) { - animateOffsetTo(mMenuSize, 0, animate); - } - - @Override - public void closeMenu(boolean animate) { - animateOffsetTo(0, 0, animate); - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, - new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - final int width = r - l; - final int height = b - t; - final int offsetPixels = (int) mOffsetPixels; - - mMenuContainer.layout(0, 0, width, mMenuSize); - offsetMenu(offsetPixels); - - if (USE_TRANSLATIONS) { - mContentContainer.layout(0, 0, width, height); - } else { - mContentContainer.layout(0, offsetPixels, width, height + offsetPixels); - } - } - - /** - * Offsets the menu relative to its original position based on the position of the content. - * - * @param offsetPixels The number of pixels the content if offset. - */ - private void offsetMenu(int offsetPixels) { - if (mOffsetMenu && mMenuSize != 0) { - final int menuSize = mMenuSize; - final float openRatio = (menuSize - (float) offsetPixels) / menuSize; - - if (USE_TRANSLATIONS) { - if (offsetPixels > 0) { - final int offset = (int) (0.25f * (-openRatio * menuSize)); - mMenuContainer.setTranslationY(offset); - } else { - mMenuContainer.setTranslationY(-menuSize); - } - - } else { - final int oldMenuTop = mMenuContainer.getTop(); - final int offset = (int) (0.25f * (-openRatio * menuSize)) - oldMenuTop; - mMenuContainer.offsetTopAndBottom(offset); - mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE); - } - } - } - - @Override - protected void drawDropShadow(Canvas canvas, int offsetPixels) { - final int width = getWidth(); - - mDropShadowDrawable.setBounds(0, offsetPixels - mDropShadowSize, width, offsetPixels); - mDropShadowDrawable.draw(canvas); - } - - @Override - protected void drawMenuOverlay(Canvas canvas, int offsetPixels) { - final int width = getWidth(); - final float openRatio = ((float) offsetPixels) / mMenuSize; - - mMenuOverlay.setBounds(0, 0, width, offsetPixels); - mMenuOverlay.setAlpha((int) (MAX_MENU_OVERLAY_ALPHA * (1.f - openRatio))); - mMenuOverlay.draw(canvas); - } - - @Override - protected void drawIndicator(Canvas canvas, int offsetPixels) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int menuHeight = mMenuSize; - final int indicatorHeight = mActiveIndicator.getHeight(); - - final float openRatio = ((float) offsetPixels) / menuHeight; - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - final int indicatorWidth = mActiveIndicator.getWidth(); - - final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio)); - final int interpolatedHeight = (int) (indicatorHeight * interpolatedRatio); - - final int indicatorTop = offsetPixels - interpolatedHeight; - if (mIndicatorAnimating) { - final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - final int startLeft = mIndicatorStartPos; - final int diff = finalLeft - startLeft; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorLeft = startLeft + startOffset; - } else { - mIndicatorLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - } - - canvas.save(); - canvas.clipRect(mIndicatorLeft, indicatorTop, mIndicatorLeft + indicatorWidth, offsetPixels); - canvas.drawBitmap(mActiveIndicator, mIndicatorLeft, indicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorLeft; - } - - @Override - protected void initPeekScroller() { - final int dx = mMenuSize / 3; - mPeekScroller.startScroll(0, 0, dx, 0, PEEK_DURATION); - } - - @Override - protected void onOffsetPixelsChanged(int offsetPixels) { - if (USE_TRANSLATIONS) { - mContentContainer.setTranslationY(offsetPixels); - offsetMenu(offsetPixels); - invalidate(); - } else { - mContentContainer.offsetTopAndBottom(offsetPixels - mContentContainer.getTop()); - offsetMenu(offsetPixels); - invalidate(); - } - } - - ////////////////////////////////////////////////////////////////////// - // Touch handling - ////////////////////////////////////////////////////////////////////// - - @Override - protected boolean isContentTouch(MotionEvent ev) { - return ev.getY() > mOffsetPixels; - } - - @Override - protected boolean onDownAllowDrag(MotionEvent ev) { - return (!mMenuVisible && mInitialMotionY <= mTouchSize) - || (mMenuVisible && mInitialMotionY >= mOffsetPixels); - } - - @Override - protected boolean onMoveAllowDrag(MotionEvent ev, float diff) { - return (!mMenuVisible && mInitialMotionY <= mTouchSize && (diff > 0)) - || (mMenuVisible && mInitialMotionY >= mOffsetPixels); - } - - @Override - protected void onMoveEvent(float dx) { - setOffsetPixels(Math.min(Math.max(mOffsetPixels + dx, 0), mMenuSize)); - } - - @Override - protected void onUpEvent(MotionEvent ev) { - final int offsetPixels = (int) mOffsetPixels; - - if (mIsDragging) { - mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity); - final int initialVelocity = (int) mVelocityTracker.getXVelocity(); - mLastMotionY = ev.getY(); - animateOffsetTo(mVelocityTracker.getYVelocity() > 0 ? mMenuSize : 0, initialVelocity, - true); - - // Close the menu when content is clicked while the menu is visible. - } else if (mMenuVisible && ev.getY() > offsetPixels) { - closeMenu(); - } - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopStaticDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopStaticDrawer.java deleted file mode 100644 index ac846148..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/TopStaticDrawer.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; - -public class TopStaticDrawer extends StaticDrawer { - - private int mIndicatorLeft; - - TopStaticDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public TopStaticDrawer(Context context) { - super(context); - } - - public TopStaticDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public TopStaticDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void initDrawer(Context context, AttributeSet attrs, int defStyle) { - super.initDrawer(context, attrs, defStyle); - mPosition = Position.TOP; - } - - @Override - public void setDropShadowColor(int color) { - final int endColor = color & 0x00FFFFFF; - mDropShadowDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, new int[] { - color, - endColor, - }); - invalidate(); - } - - @Override - protected void drawIndicator(Canvas canvas) { - if (mActiveView != null && isViewDescendant(mActiveView)) { - Integer position = (Integer) mActiveView.getTag(R.id.mdActiveViewPosition); - final int pos = position == null ? 0 : position; - - if (pos == mActivePosition) { - final int menuHeight = mMenuSize; - final int indicatorHeight = mActiveIndicator.getHeight(); - - mActiveView.getDrawingRect(mActiveRect); - offsetDescendantRectToMyCoords(mActiveView, mActiveRect); - final int indicatorWidth = mActiveIndicator.getWidth(); - - final int indicatorTop = menuHeight - indicatorHeight; - if (mIndicatorAnimating) { - final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - final int startLeft = mIndicatorStartPos; - final int diff = finalLeft - startLeft; - final int startOffset = (int) (diff * mIndicatorOffset); - mIndicatorLeft = startLeft + startOffset; - } else { - mIndicatorLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2); - } - - canvas.save(); - canvas.clipRect(mIndicatorLeft, indicatorTop, mIndicatorLeft + indicatorWidth, menuHeight); - canvas.drawBitmap(mActiveIndicator, mIndicatorLeft, indicatorTop, null); - canvas.restore(); - } - } - } - - @Override - protected int getIndicatorStartPos() { - return mIndicatorLeft; - } -} diff --git a/android-menudrawer-master/library/src/net/simonvt/menudrawer/VerticalDrawer.java b/android-menudrawer-master/library/src/net/simonvt/menudrawer/VerticalDrawer.java deleted file mode 100644 index 415d4989..00000000 --- a/android-menudrawer-master/library/src/net/simonvt/menudrawer/VerticalDrawer.java +++ /dev/null @@ -1,216 +0,0 @@ -package net.simonvt.menudrawer; - -import android.app.Activity; -import android.content.Context; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.VelocityTracker; - -public abstract class VerticalDrawer extends DraggableDrawer { - - VerticalDrawer(Activity activity, int dragMode) { - super(activity, dragMode); - } - - public VerticalDrawer(Context context) { - super(context); - } - - public VerticalDrawer(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public VerticalDrawer(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - final int widthMode = MeasureSpec.getMode(widthMeasureSpec); - final int heightMode = MeasureSpec.getMode(heightMeasureSpec); - - if (widthMode != MeasureSpec.EXACTLY || heightMode != MeasureSpec.EXACTLY) { - throw new IllegalStateException("Must measure with an exact size"); - } - - final int width = MeasureSpec.getSize(widthMeasureSpec); - final int height = MeasureSpec.getSize(heightMeasureSpec); - - if (!mMenuSizeSet) mMenuSize = (int) (height * 0.25f); - if (mOffsetPixels == -1) openMenu(false); - - final int menuWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width); - final int menuHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, mMenuSize); - mMenuContainer.measure(menuWidthMeasureSpec, menuHeightMeasureSpec); - - final int contentWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, width); - final int contentHeightMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, height); - mContentContainer.measure(contentWidthMeasureSpec, contentHeightMeasureSpec); - - setMeasuredDimension(width, height); - - updateTouchAreaSize(); - } - - @Override - public boolean onInterceptTouchEvent(MotionEvent ev) { - final int action = ev.getAction() & MotionEvent.ACTION_MASK; - - if (action == MotionEvent.ACTION_DOWN && mMenuVisible && isCloseEnough()) { - setOffsetPixels(0); - stopAnimation(); - endPeek(); - setDrawerState(STATE_CLOSED); - } - - // Always intercept events over the content while menu is visible. - if (mMenuVisible && isContentTouch(ev)) { - return true; - } - - if (mTouchMode == TOUCH_MODE_NONE) { - return false; - } - - if (action != MotionEvent.ACTION_DOWN) { - if (mIsDragging) { - return true; - } - } - - switch (action) { - case MotionEvent.ACTION_DOWN: { - mLastMotionX = mInitialMotionX = ev.getX(); - mLastMotionY = mInitialMotionY = ev.getY(); - final boolean allowDrag = onDownAllowDrag(ev); - - if (allowDrag) { - setDrawerState(mMenuVisible ? STATE_OPEN : STATE_CLOSED); - stopAnimation(); - endPeek(); - mIsDragging = false; - } - break; - } - - case MotionEvent.ACTION_MOVE: { - final float x = ev.getX(); - final float dx = x - mLastMotionX; - final float xDiff = Math.abs(dx); - final float y = ev.getY(); - final float dy = y - mLastMotionY; - final float yDiff = Math.abs(dy); - - if (yDiff > mTouchSlop && yDiff > xDiff) { - if (mOnInterceptMoveEventListener != null && mTouchMode == TOUCH_MODE_FULLSCREEN - && canChildScrollVertically(mContentContainer, false, (int) dx, (int) x, (int) y)) { - endDrag(); // Release the velocity tracker - return false; - } - - final boolean allowDrag = onMoveAllowDrag(ev, dy); - - if (allowDrag) { - setDrawerState(STATE_DRAGGING); - mIsDragging = true; - mLastMotionX = x; - mLastMotionY = y; - } - } - break; - } - - /** - * If you click really fast, an up or cancel event is delivered here. Just snap content to - * whatever is closest. - */ - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: { - if (Math.abs(mOffsetPixels) > mMenuSize / 2) { - openMenu(); - } else { - closeMenu(); - } - break; - } - } - - if (mVelocityTracker == null) { - mVelocityTracker = VelocityTracker.obtain(); - } - mVelocityTracker.addMovement(ev); - - return mIsDragging; - } - - @Override - public boolean onTouchEvent(MotionEvent ev) { - if (!mMenuVisible && !mIsDragging && (mTouchMode == TOUCH_MODE_NONE)) { - return false; - } - final int action = ev.getAction() & MotionEvent.ACTION_MASK; - - if (mVelocityTracker == null) { - mVelocityTracker = VelocityTracker.obtain(); - } - mVelocityTracker.addMovement(ev); - - switch (action) { - case MotionEvent.ACTION_DOWN: { - mLastMotionX = mInitialMotionX = ev.getX(); - mLastMotionY = mInitialMotionY = ev.getY(); - final boolean allowDrag = onDownAllowDrag(ev); - - if (allowDrag) { - stopAnimation(); - endPeek(); - startLayerTranslation(); - } - break; - } - - case MotionEvent.ACTION_MOVE: { - if (!mIsDragging) { - final float x = ev.getX(); - final float dx = x - mLastMotionX; - final float xDiff = Math.abs(dx); - final float y = ev.getY(); - final float dy = y - mLastMotionY; - final float yDiff = Math.abs(dy); - - if (yDiff > mTouchSlop && yDiff > xDiff) { - final boolean allowDrag = onMoveAllowDrag(ev, dy); - - if (allowDrag) { - setDrawerState(STATE_DRAGGING); - mIsDragging = true; - mLastMotionY = y - mInitialMotionY > 0 - ? mInitialMotionY + mTouchSlop - : mInitialMotionY - mTouchSlop; - } - } - } - - if (mIsDragging) { - startLayerTranslation(); - - final float y = ev.getY(); - final float dy = y - mLastMotionY; - - mLastMotionY = y; - onMoveEvent(dy); - } - break; - } - - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: { - onUpEvent(ev); - break; - } - } - - return true; - } - -} diff --git a/android-menudrawer-master/pom.xml b/android-menudrawer-master/pom.xml deleted file mode 100644 index eda6dd91..00000000 --- a/android-menudrawer-master/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - - org.sonatype.oss - oss-parent - 7 - - - net.simonvt - android-menudrawer-parent - pom - 2.0.3-SNAPSHOT - - Android MenuDrawer (Parent) - A menu drawer implementation which allows dragging of both the content, and the entire window. - https://github.com/SimonVT/android-menudrawer - 2012 - - - library - samples - - - - http://github.com/SimonVT/android-menudrawer/ - scm:git:git://github.com/SimonVT/android-menudrawer.git - scm:git:git@github.com:SimonVT/android-menudrawer.git - HEAD - - - - - Apache License Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - GitHub Issues - https://github.com/SimonVT/android-menudrawer/issues - - - - UTF-8 - UTF-8 - - 1.6 - 4.1.1.4 - 16 - - r7 - - - - - - com.google.android - android - ${android.version} - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - ${java.version} - ${java.version} - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - 3.5.1 - - - ${android.platform} - - - true - - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.4 - - true - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.9.1 - - true - - ../checkstyle.xml - true - - - - verify - - checkstyle - - - - - - - diff --git a/android-menudrawer-master/samples/AndroidManifest.xml b/android-menudrawer-master/samples/AndroidManifest.xml deleted file mode 100644 index 7323fa61..00000000 --- a/android-menudrawer-master/samples/AndroidManifest.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/samples/build.xml b/android-menudrawer-master/samples/build.xml deleted file mode 100644 index 9eb8fb98..00000000 --- a/android-menudrawer-master/samples/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/samples/libs/android-support-v4-r10.jar b/android-menudrawer-master/samples/libs/android-support-v4-r10.jar deleted file mode 100644 index feaf44f8..00000000 Binary files a/android-menudrawer-master/samples/libs/android-support-v4-r10.jar and /dev/null differ diff --git a/android-menudrawer-master/samples/pom.xml b/android-menudrawer-master/samples/pom.xml deleted file mode 100644 index 5baaac76..00000000 --- a/android-menudrawer-master/samples/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - 4.0.0 - - - net.simonvt - android-menudrawer-parent - 2.0.3-SNAPSHOT - ../pom.xml - - - android-menudrawer-sample - Android MenuDrawer Sample - apk - - - - com.google.android - android - provided - - - net.simonvt - android-menudrawer - ${project.version} - apklib - - - com.google.android - support-v4 - ${android-support.version} - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - true - - - - diff --git a/android-menudrawer-master/samples/project.properties b/android-menudrawer-master/samples/project.properties deleted file mode 100644 index 0a62d816..00000000 --- a/android-menudrawer-master/samples/project.properties +++ /dev/null @@ -1,15 +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 - -# Project target. -target=android-16 -android.library.reference.1=../library diff --git a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow.png deleted file mode 100644 index add3b361..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_bottom.png deleted file mode 100644 index 47e9c904..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_right.png deleted file mode 100644 index 4ae9df9b..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_top.png deleted file mode 100644 index ab4ed80e..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi-v14/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_refresh_dark.png b/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_refresh_dark.png deleted file mode 100644 index bb9d855f..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_refresh_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_select_all_dark.png b/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_select_all_dark.png deleted file mode 100644 index c87c3f83..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/ic_action_select_all_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/ic_launcher.png b/android-menudrawer-master/samples/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e5..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png b/android-menudrawer-master/samples/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png deleted file mode 100644 index bb6aef1d..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/md__category_background.9.png b/android-menudrawer-master/samples/res/drawable-hdpi/md__category_background.9.png deleted file mode 100644 index 43a20adc..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/md__category_background.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_focused_holo.9.png b/android-menudrawer-master/samples/res/drawable-hdpi/md__list_focused_holo.9.png deleted file mode 100644 index 55527084..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_focused_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_longpressed_holo.9.png b/android-menudrawer-master/samples/res/drawable-hdpi/md__list_longpressed_holo.9.png deleted file mode 100644 index 4ea7afa0..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_longpressed_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_pressed_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-hdpi/md__list_pressed_holo_dark.9.png deleted file mode 100644 index 5654cd69..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_pressed_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_selector_disabled_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-hdpi/md__list_selector_disabled_holo_dark.9.png deleted file mode 100644 index f6fd30dc..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/md__list_selector_disabled_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow.png deleted file mode 100644 index c28d98f3..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_bottom.png deleted file mode 100644 index 4cbe8cbe..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_right.png deleted file mode 100644 index 2fb6a937..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_top.png deleted file mode 100644 index 41f6c6a8..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-hdpi/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow.png deleted file mode 100644 index 26d77595..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_bottom.png deleted file mode 100644 index af8e7b90..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_right.png deleted file mode 100644 index 21deedfc..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_top.png deleted file mode 100644 index 1f5d61a2..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi-v14/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_refresh_dark.png b/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_refresh_dark.png deleted file mode 100644 index bd611e8e..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_refresh_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_select_all_dark.png b/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_select_all_dark.png deleted file mode 100644 index 252ecbb0..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/ic_action_select_all_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/ic_launcher.png b/android-menudrawer-master/samples/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047df..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png b/android-menudrawer-master/samples/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png deleted file mode 100644 index 01d68169..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/md__category_background.9.png b/android-menudrawer-master/samples/res/drawable-mdpi/md__category_background.9.png deleted file mode 100644 index af0bc168..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/md__category_background.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_focused_holo.9.png b/android-menudrawer-master/samples/res/drawable-mdpi/md__list_focused_holo.9.png deleted file mode 100644 index 00f05d8c..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_focused_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_longpressed_holo.9.png b/android-menudrawer-master/samples/res/drawable-mdpi/md__list_longpressed_holo.9.png deleted file mode 100644 index 3bf8e036..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_longpressed_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_pressed_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-mdpi/md__list_pressed_holo_dark.9.png deleted file mode 100644 index 6e77525d..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_pressed_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_selector_disabled_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-mdpi/md__list_selector_disabled_holo_dark.9.png deleted file mode 100644 index 92da2f0d..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/md__list_selector_disabled_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow.png deleted file mode 100644 index ecacda71..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_bottom.png deleted file mode 100644 index 3dce461a..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_right.png deleted file mode 100644 index 3222d034..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_top.png deleted file mode 100644 index cde43fd2..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-mdpi/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow.png deleted file mode 100644 index 6bdcc62e..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_bottom.png deleted file mode 100644 index aba9001f..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_right.png deleted file mode 100644 index 85591b81..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_top.png deleted file mode 100644 index b81c7474..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi-v14/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_refresh_dark.png b/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_refresh_dark.png deleted file mode 100644 index a7fdc0df..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_refresh_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_select_all_dark.png b/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_select_all_dark.png deleted file mode 100644 index f193a8bb..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_action_select_all_dark.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_launcher.png b/android-menudrawer-master/samples/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d760..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_light.png b/android-menudrawer-master/samples/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_light.png deleted file mode 100644 index 930ca8d9..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_light.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/md__category_background.9.png b/android-menudrawer-master/samples/res/drawable-xhdpi/md__category_background.9.png deleted file mode 100644 index 942d72e6..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/md__category_background.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_focused_holo.9.png b/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_focused_holo.9.png deleted file mode 100644 index b545f8e5..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_focused_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_longpressed_holo.9.png b/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_longpressed_holo.9.png deleted file mode 100644 index eda10e61..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_longpressed_holo.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_pressed_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_pressed_holo_dark.9.png deleted file mode 100644 index e4b33935..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_pressed_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_selector_disabled_holo_dark.9.png b/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_selector_disabled_holo_dark.9.png deleted file mode 100644 index 88726b69..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/md__list_selector_disabled_holo_dark.9.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow.png b/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow.png deleted file mode 100644 index b1599372..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_bottom.png b/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_bottom.png deleted file mode 100644 index 77a088fd..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_bottom.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_right.png b/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_right.png deleted file mode 100644 index 17b5250d..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_right.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_top.png b/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_top.png deleted file mode 100644 index 2c2f7490..00000000 Binary files a/android-menudrawer-master/samples/res/drawable-xhdpi/menu_arrow_top.png and /dev/null differ diff --git a/android-menudrawer-master/samples/res/drawable/md__list_selector_background_transition_holo_dark.xml b/android-menudrawer-master/samples/res/drawable/md__list_selector_background_transition_holo_dark.xml deleted file mode 100644 index 1d43396d..00000000 --- a/android-menudrawer-master/samples/res/drawable/md__list_selector_background_transition_holo_dark.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - diff --git a/android-menudrawer-master/samples/res/drawable/md__list_selector_holo_dark.xml b/android-menudrawer-master/samples/res/drawable/md__list_selector_holo_dark.xml deleted file mode 100644 index bd71aa8b..00000000 --- a/android-menudrawer-master/samples/res/drawable/md__list_selector_holo_dark.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_bottommenu.xml b/android-menudrawer-master/samples/res/layout/activity_bottommenu.xml deleted file mode 100644 index ee576195..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_bottommenu.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_contentsample.xml b/android-menudrawer-master/samples/res/layout/activity_contentsample.xml deleted file mode 100644 index 54140e71..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_contentsample.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_layoutsample.xml b/android-menudrawer-master/samples/res/layout/activity_layoutsample.xml deleted file mode 100644 index 83684116..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_layoutsample.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_rightmenu.xml b/android-menudrawer-master/samples/res/layout/activity_rightmenu.xml deleted file mode 100644 index ad1a6b76..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_rightmenu.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_staticsample.xml b/android-menudrawer-master/samples/res/layout/activity_staticsample.xml deleted file mode 100644 index e6cb5622..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_staticsample.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/activity_topmenu.xml b/android-menudrawer-master/samples/res/layout/activity_topmenu.xml deleted file mode 100644 index d288cfa5..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_topmenu.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/android-menudrawer-master/samples/res/layout/activity_viewpagersample.xml b/android-menudrawer-master/samples/res/layout/activity_viewpagersample.xml deleted file mode 100644 index 6efa747e..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_viewpagersample.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/android-menudrawer-master/samples/res/layout/activity_windowsample.xml b/android-menudrawer-master/samples/res/layout/activity_windowsample.xml deleted file mode 100644 index a23003f2..00000000 --- a/android-menudrawer-master/samples/res/layout/activity_windowsample.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/list_row_sample.xml b/android-menudrawer-master/samples/res/layout/list_row_sample.xml deleted file mode 100644 index edd6d1f6..00000000 --- a/android-menudrawer-master/samples/res/layout/list_row_sample.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/android-menudrawer-master/samples/res/layout/main.xml b/android-menudrawer-master/samples/res/layout/main.xml deleted file mode 100644 index 6dd71bd2..00000000 --- a/android-menudrawer-master/samples/res/layout/main.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - -