├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── art
└── small.gif
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── pluscubed
│ │ └── recyclerfastscroll
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── pluscubed
│ │ │ └── recyclerfastscroll
│ │ │ ├── RecyclerFastScroller.java
│ │ │ └── RecyclerFastScrollerUtils.java
│ └── res
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── dimens.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── pluscubed
│ └── recyclerfastscroll
│ └── ExampleUnitTest.java
├── sample
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── pluscubed
│ │ └── recyclerfastscrollsample
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── pluscubed
│ │ │ └── recyclerfastscrollsample
│ │ │ └── ScrollingActivity.java
│ └── res
│ │ ├── drawable
│ │ └── ic_info_black_24dp.xml
│ │ ├── layout
│ │ ├── activity_simple_scrolling.xml
│ │ ├── list_item.xml
│ │ └── list_item_main.xml
│ │ ├── menu
│ │ └── menu_scrolling.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── pluscubed
│ └── recyclerfastscrollsample
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io
2 |
3 | # Generated files
4 | bin/
5 | gen/
6 |
7 | # Gradle files
8 | .gradle/
9 | build/
10 |
11 | # Local configuration file (sdk path, etc)
12 | local.properties
13 |
14 | # Proguard folder generated by Eclipse
15 | proguard/
16 |
17 | # Log Files
18 | *.log
19 |
20 |
21 | ### Intellij ###
22 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
23 |
24 | *.iml
25 |
26 | ## Directory-based project format:
27 | .idea/
28 | # if you remove the above rule, at least ignore the following:
29 |
30 | # User-specific stuff:
31 | # .idea/workspace.xml
32 | # .idea/tasks.xml
33 | # .idea/dictionaries
34 |
35 | # Sensitive or high-churn files:
36 | # .idea/dataSources.ids
37 | # .idea/dataSources.xml
38 | # .idea/sqlDataSources.xml
39 | # .idea/dynamic.xml
40 | # .idea/uiDesigner.xml
41 |
42 | # Gradle:
43 | # .idea/gradle.xml
44 | # .idea/libraries
45 |
46 | # Mongo Explorer plugin:
47 | # .idea/mongoSettings.xml
48 |
49 | ## File-based project format:
50 | *.ipr
51 | *.iws
52 |
53 | ## Plugin-specific files:
54 |
55 | # IntelliJ
56 | out/
57 |
58 | # mpeltonen/sbt-idea plugin
59 | .idea_modules/
60 |
61 | # JIRA plugin
62 | atlassian-ide-plugin.xml
63 |
64 | # Crashlytics plugin (for Android Studio and IntelliJ)
65 | com_crashlytics_export_strings.xml
66 | #crashlytics.properties
67 | crashlytics-build.properties
68 |
69 | # Mobile Tools for Java (J2ME)
70 | .mtj.tmp/
71 |
72 | # Package Files #
73 | *.war
74 | *.ear
75 |
76 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
77 | hs_err_pid*
78 |
79 | # Ignore Gradle GUI config
80 | gradle-app.setting
81 |
82 | *.DS_Store
83 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Recycler Fast Scroll 
2 | =====
3 |
4 | 
5 |
6 | [](https://jitpack.io/#plusCubed/recycler-fast-scroll) [](https://www.apache.org/licenses/LICENSE-2.0.html)
7 |
8 | Widget for `RecyclerView` fast scrolling, like Android's built-in fast scroll option for `ListView`.
9 | Supports any vertically scrolling `LayoutManager`, as well as proper integration for `AppBarLayout`.
10 |
11 | Planned features are listed at the [issues page](https://github.com/plusCubed/recycler-fast-scroll/issues).
12 | You can download the sample APK from the [releases page](https://github.com/plusCubed/recycler-fast-scroll/releases).
13 |
14 | ### Sample
15 | [](https://play.google.com/store/apps/details?id=com.pluscubed.recyclerfastscrollsample)
16 |
17 | ### Dependency
18 |
19 | Add this to your module's `build.gradle` file:
20 |
21 | ```gradle
22 | repositories {
23 | //...
24 | maven { url "https://jitpack.io" }
25 | }
26 |
27 | dependencies {
28 | //...
29 | compile 'com.github.pluscubed:recycler-fast-scroll:{latest-version}@aar'
30 | }
31 | ```
32 |
33 | The library is versioned according to [Semantic Versioning](http://semver.org/).
34 |
35 | ### Basic Usage
36 | 1. Add the widget to your layout file, e.g.:
37 | ```xml
38 |
41 |
42 |
45 |
46 |
50 |
51 |
52 | ```
53 |
54 | 2. Attach the `RecyclerFastScroller` to your `RecyclerView`:
55 | ```java
56 | fastScroller.attachRecyclerView(recyclerView);
57 | ```
58 | If the adapter hasn't been set when you attach the fast scroller, call `attachAdapter()` afterwords.
59 |
60 | See the sample project for demos.
61 |
62 | ### AppBarLayout support
63 | Use `attachAppBarLayout(coordinatorLayout, appBarLayout)`. See the sample project for the demo.
64 |
65 | ### Customization
66 | | Method | Attribute | Description |
67 | | --- | --- | --- |
68 | | `setBarColor(int color)`| `rfs_barColor` | Color of scrollbar. Defaults to `colorControlNormal` attribute. Alpha of ~22% is applied to the drawable to match stock `ListView` fast scroller. |
69 | | `setHandleNormalColor(int color)` | `rfs_handleNormalColor` | Color of handle. Defaults to `colorControlNormal` attribute. |
70 | | `setHandlePressedColor(int color)` | `rfs_handlePressedColor` | Color of pressed handle. Defaults to `colorAccent` attribute. |
71 | | `setTouchTargetWidth(int width)` | `rfs_touchTargetWidth` | Width of the touch target. Defaults to 24dp (while the Android docs recommend at least 48dp, 24dp is more practical considering it will block touch in the right of the `RecyclerView`). |
72 | | `setHideDelay(int milliseconds)` | `rfs_hideDelay` | Hide delay in milliseconds. Defaults to 1500ms. |
73 | | `setHidingEnabled(boolean enabled)` | `rfs_hidingEnabled` | Whether scrollbar is hidden after delay. Defaults to true. |
74 | | `setOnHandleTouchListener(OnTouchListener listener)` | -- | Sets listener for handle touch events. |
75 |
76 | Corresponding getters are also available.
77 |
78 | ####Attribute Usage
79 | ```xml
80 |
83 | ```
84 |
85 |
86 | ### License
87 | ```
88 | Copyright 2016 Daniel Ciao
89 |
90 | Licensed under the Apache License, Version 2.0 (the "License");
91 | you may not use this file except in compliance with the License.
92 | You may obtain a copy of the License at
93 |
94 | http://www.apache.org/licenses/LICENSE-2.0
95 |
96 | Unless required by applicable law or agreed to in writing, software
97 | distributed under the License is distributed on an "AS IS" BASIS,
98 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99 | See the License for the specific language governing permissions and
100 | limitations under the License.
101 | ```
102 |
--------------------------------------------------------------------------------
/art/small.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/art/small.gif
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.4.1'
10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
11 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task updateWrapper(type: Wrapper) {
26 | gradleVersion = '5.4.1'
27 | distributionType = Wrapper.DistributionType.ALL
28 | }
29 |
30 |
31 | task clean(type: Delete) {
32 | delete rootProject.buildDir
33 | }
34 |
35 | apply plugin: 'com.github.ben-manes.versions'
36 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 | android.enableJetifier=true
20 | android.useAndroidX=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS='"-Xmx64m"'
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS="-Xmx64m"
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | group='com.github.pluscubed'
5 |
6 | android {
7 | compileSdkVersion 28
8 |
9 | defaultConfig {
10 | minSdkVersion 14
11 | targetSdkVersion 28
12 | versionCode 5
13 | versionName "0.3.2"
14 | }
15 | }
16 |
17 | dependencies {
18 | compile fileTree(dir: 'libs', include: ['*.jar'])
19 | testCompile 'junit:junit:4.12'
20 | compile 'androidx.appcompat:appcompat:1.0.2'
21 | compile 'androidx.recyclerview:recyclerview:1.0.0'
22 | compile 'com.google.android.material:material:1.0.0'
23 | }
24 |
25 | // build a jar with source files
26 | task sourcesJar(type: Jar) {
27 | from android.sourceSets.main.java.sourceFiles
28 | classifier = 'sources'
29 | }
30 |
31 | task javadoc(type: Javadoc) {
32 | failOnError false
33 | source = android.sourceSets.main.java.sourceFiles
34 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
35 | }
36 |
37 | // build a jar with javadoc
38 | task javadocJar(type: Jar, dependsOn: javadoc) {
39 | classifier = 'javadoc'
40 | from javadoc.getDestinationDir()
41 | }
42 |
43 | artifacts {
44 | archives sourcesJar
45 | archives javadocJar
46 | }
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\DC\Development\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/com/pluscubed/recyclerfastscroll/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscroll;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/library/src/main/java/com/pluscubed/recyclerfastscroll/RecyclerFastScroller.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscroll;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.content.Context;
8 | import android.content.res.TypedArray;
9 | import android.graphics.drawable.ColorDrawable;
10 | import android.graphics.drawable.Drawable;
11 | import android.graphics.drawable.InsetDrawable;
12 | import android.graphics.drawable.StateListDrawable;
13 | import android.util.AttributeSet;
14 | import android.view.MotionEvent;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.FrameLayout;
18 |
19 | import androidx.annotation.ColorInt;
20 | import androidx.annotation.Nullable;
21 | import androidx.core.view.GravityCompat;
22 | import androidx.core.view.ViewCompat;
23 | import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
24 | import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
25 | import androidx.recyclerview.widget.RecyclerView;
26 |
27 | public class RecyclerFastScroller extends FrameLayout {
28 |
29 | private static final int DEFAULT_AUTO_HIDE_DELAY = 1500;
30 |
31 | protected final View mBar;
32 | protected final View mHandle;
33 | final int mHiddenTranslationX;
34 | private final Runnable mHide;
35 | private final int mMinScrollHandleHeight;
36 | protected OnTouchListener mOnTouchListener;
37 |
38 | int mAppBarLayoutOffset;
39 |
40 | RecyclerView mRecyclerView;
41 |
42 | AnimatorSet mAnimator;
43 | boolean mAnimatingIn;
44 |
45 | private int mHideDelay;
46 | private boolean mHidingEnabled;
47 | private int mHandleNormalColor;
48 | private int mHandlePressedColor;
49 | private int mBarColor;
50 | private int mTouchTargetWidth;
51 | private int mBarInset;
52 |
53 | private boolean mHideOverride;
54 | private RecyclerView.Adapter mAdapter;
55 | private RecyclerView.AdapterDataObserver mAdapterObserver = new RecyclerView.AdapterDataObserver() {
56 | @Override
57 | public void onChanged() {
58 | super.onChanged();
59 | requestLayout();
60 | }
61 | };
62 |
63 | public RecyclerFastScroller(Context context) {
64 | this(context, null, 0);
65 | }
66 |
67 | public RecyclerFastScroller(Context context, AttributeSet attrs) {
68 | this(context, attrs, 0);
69 | }
70 |
71 | public RecyclerFastScroller(Context context, AttributeSet attrs, int defStyleAttr) {
72 | this(context, attrs, defStyleAttr, 0);
73 | }
74 |
75 | public RecyclerFastScroller(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
76 | super(context, attrs, defStyleAttr);
77 |
78 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecyclerFastScroller, defStyleAttr, defStyleRes);
79 |
80 | mBarColor = a.getColor(
81 | R.styleable.RecyclerFastScroller_rfs_barColor,
82 | RecyclerFastScrollerUtils.resolveColor(context, R.attr.colorControlNormal));
83 |
84 | mHandleNormalColor = a.getColor(
85 | R.styleable.RecyclerFastScroller_rfs_handleNormalColor,
86 | RecyclerFastScrollerUtils.resolveColor(context, R.attr.colorControlNormal));
87 |
88 | mHandlePressedColor = a.getColor(
89 | R.styleable.RecyclerFastScroller_rfs_handlePressedColor,
90 | RecyclerFastScrollerUtils.resolveColor(context, R.attr.colorAccent));
91 |
92 | mTouchTargetWidth = a.getDimensionPixelSize(
93 | R.styleable.RecyclerFastScroller_rfs_touchTargetWidth,
94 | RecyclerFastScrollerUtils.convertDpToPx(context, 24));
95 |
96 | mHideDelay = a.getInt(R.styleable.RecyclerFastScroller_rfs_hideDelay,
97 | DEFAULT_AUTO_HIDE_DELAY);
98 |
99 | mHidingEnabled = a.getBoolean(R.styleable.RecyclerFastScroller_rfs_hidingEnabled, true);
100 |
101 | a.recycle();
102 |
103 | int fortyEightDp = RecyclerFastScrollerUtils.convertDpToPx(context, 48);
104 | setLayoutParams(new ViewGroup.LayoutParams(fortyEightDp, ViewGroup.LayoutParams.MATCH_PARENT));
105 |
106 | mBar = new View(context);
107 | mHandle = new View(context);
108 | addView(mBar);
109 | addView(mHandle);
110 |
111 | setTouchTargetWidth(mTouchTargetWidth);
112 |
113 | mMinScrollHandleHeight = fortyEightDp;
114 |
115 | int eightDp = RecyclerFastScrollerUtils.convertDpToPx(getContext(), 8);
116 | mHiddenTranslationX = (RecyclerFastScrollerUtils.isRTL(getContext()) ? -1 : 1) * eightDp;
117 | mHide = new Runnable() {
118 | @Override
119 | public void run() {
120 | if (!mHandle.isPressed()) {
121 | if (mAnimator != null && mAnimator.isStarted()) {
122 | mAnimator.cancel();
123 | }
124 | mAnimator = new AnimatorSet();
125 | ObjectAnimator animator2 = ObjectAnimator.ofFloat(RecyclerFastScroller.this, View.TRANSLATION_X,
126 | mHiddenTranslationX);
127 | animator2.setInterpolator(new FastOutLinearInInterpolator());
128 | animator2.setDuration(150);
129 | mHandle.setEnabled(false);
130 | mAnimator.play(animator2);
131 | mAnimator.start();
132 | }
133 | }
134 | };
135 |
136 | mHandle.setOnTouchListener(new OnTouchListener() {
137 | private float mInitialBarHeight;
138 | private float mLastPressedYAdjustedToInitial;
139 | private int mLastAppBarLayoutOffset;
140 |
141 | @Override
142 | public boolean onTouch(View v, MotionEvent event) {
143 | if (mOnTouchListener != null) {
144 | mOnTouchListener.onTouch(v, event);
145 | }
146 | if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
147 | mHandle.setPressed(true);
148 | mRecyclerView.stopScroll();
149 |
150 | int nestedScrollAxis = ViewCompat.SCROLL_AXIS_NONE;
151 | nestedScrollAxis |= ViewCompat.SCROLL_AXIS_VERTICAL;
152 |
153 | mRecyclerView.startNestedScroll(nestedScrollAxis);
154 |
155 | mInitialBarHeight = mBar.getHeight();
156 | mLastPressedYAdjustedToInitial = event.getY() + mHandle.getY() + mBar.getY();
157 | mLastAppBarLayoutOffset = mAppBarLayoutOffset;
158 | } else if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
159 | float newHandlePressedY = event.getY() + mHandle.getY() + mBar.getY();
160 | int barHeight = mBar.getHeight();
161 | float newHandlePressedYAdjustedToInitial =
162 | newHandlePressedY + (mInitialBarHeight - barHeight);
163 |
164 | float deltaPressedYFromLastAdjustedToInitial =
165 | newHandlePressedYAdjustedToInitial - mLastPressedYAdjustedToInitial;
166 |
167 | int dY = (int) ((deltaPressedYFromLastAdjustedToInitial / mInitialBarHeight) *
168 | mRecyclerView.computeVerticalScrollRange());
169 |
170 | updateRvScroll(dY + mLastAppBarLayoutOffset - mAppBarLayoutOffset);
171 |
172 | mLastPressedYAdjustedToInitial = newHandlePressedYAdjustedToInitial;
173 | mLastAppBarLayoutOffset = mAppBarLayoutOffset;
174 | } else if (event.getActionMasked() == MotionEvent.ACTION_UP) {
175 | mLastPressedYAdjustedToInitial = -1;
176 |
177 | mRecyclerView.stopNestedScroll();
178 |
179 | mHandle.setPressed(false);
180 | postAutoHide();
181 | }
182 |
183 | return true;
184 | }
185 | });
186 |
187 | setTranslationX(mHiddenTranslationX);
188 | }
189 |
190 | @ColorInt
191 | public int getHandlePressedColor() {
192 | return mHandlePressedColor;
193 | }
194 |
195 | public void setHandlePressedColor(@ColorInt int colorPressed) {
196 | mHandlePressedColor = colorPressed;
197 | updateHandleColorsAndInset();
198 | }
199 |
200 | @ColorInt
201 | public int getHandleNormalColor() {
202 | return mHandleNormalColor;
203 | }
204 |
205 | public void setHandleNormalColor(@ColorInt int colorNormal) {
206 | mHandleNormalColor = colorNormal;
207 | updateHandleColorsAndInset();
208 | }
209 |
210 | @ColorInt
211 | public int getBarColor() {
212 | return mBarColor;
213 | }
214 |
215 | /**
216 | * @param scrollBarColor Scroll bar color. Alpha will be set to ~22% to match stock scrollbar.
217 | */
218 | public void setBarColor(@ColorInt int scrollBarColor) {
219 | mBarColor = scrollBarColor;
220 | updateBarColorAndInset();
221 | }
222 |
223 | public int getHideDelay() {
224 | return mHideDelay;
225 | }
226 |
227 | /**
228 | * @param hideDelay the delay in millis to hide the scrollbar
229 | */
230 | public void setHideDelay(int hideDelay) {
231 | mHideDelay = hideDelay;
232 | }
233 |
234 | public int getTouchTargetWidth() {
235 | return mTouchTargetWidth;
236 | }
237 |
238 | /**
239 | * @param touchTargetWidth In pixels, less than or equal to 48dp
240 | */
241 | public void setTouchTargetWidth(int touchTargetWidth) {
242 | mTouchTargetWidth = touchTargetWidth;
243 |
244 | int eightDp = RecyclerFastScrollerUtils.convertDpToPx(getContext(), 8);
245 | mBarInset = mTouchTargetWidth - eightDp;
246 |
247 | int fortyEightDp = RecyclerFastScrollerUtils.convertDpToPx(getContext(), 48);
248 | if (mTouchTargetWidth > fortyEightDp) {
249 | throw new RuntimeException("Touch target width cannot be larger than 48dp!");
250 | }
251 |
252 | mBar.setLayoutParams(new LayoutParams(touchTargetWidth, ViewGroup.LayoutParams.MATCH_PARENT, GravityCompat.END));
253 | mHandle.setLayoutParams(new LayoutParams(touchTargetWidth, ViewGroup.LayoutParams.MATCH_PARENT, GravityCompat.END));
254 |
255 | updateHandleColorsAndInset();
256 | updateBarColorAndInset();
257 | }
258 |
259 | public boolean isHidingEnabled() {
260 | return mHidingEnabled;
261 | }
262 |
263 | /**
264 | * @param hidingEnabled whether hiding is enabled
265 | */
266 | public void setHidingEnabled(boolean hidingEnabled) {
267 | mHidingEnabled = hidingEnabled;
268 | if (hidingEnabled) {
269 | postAutoHide();
270 | }
271 | }
272 |
273 | private void updateHandleColorsAndInset() {
274 | StateListDrawable drawable = new StateListDrawable();
275 |
276 | if (!RecyclerFastScrollerUtils.isRTL(getContext())) {
277 | drawable.addState(View.PRESSED_ENABLED_STATE_SET,
278 | new InsetDrawable(new ColorDrawable(mHandlePressedColor), mBarInset, 0, 0, 0));
279 | drawable.addState(View.EMPTY_STATE_SET,
280 | new InsetDrawable(new ColorDrawable(mHandleNormalColor), mBarInset, 0, 0, 0));
281 | } else {
282 | drawable.addState(View.PRESSED_ENABLED_STATE_SET,
283 | new InsetDrawable(new ColorDrawable(mHandlePressedColor), 0, 0, mBarInset, 0));
284 | drawable.addState(View.EMPTY_STATE_SET,
285 | new InsetDrawable(new ColorDrawable(mHandleNormalColor), 0, 0, mBarInset, 0));
286 | }
287 | RecyclerFastScrollerUtils.setViewBackground(mHandle, drawable);
288 | }
289 |
290 | private void updateBarColorAndInset() {
291 | Drawable drawable;
292 |
293 | if (!RecyclerFastScrollerUtils.isRTL(getContext())) {
294 | drawable = new InsetDrawable(new ColorDrawable(mBarColor), mBarInset, 0, 0, 0);
295 | } else {
296 | drawable = new InsetDrawable(new ColorDrawable(mBarColor), 0, 0, mBarInset, 0);
297 | }
298 | drawable.setAlpha(57);
299 | RecyclerFastScrollerUtils.setViewBackground(mBar, drawable);
300 | }
301 |
302 | public void attachRecyclerView(RecyclerView recyclerView) {
303 | mRecyclerView = recyclerView;
304 | mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
305 | @Override
306 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
307 | super.onScrolled(recyclerView, dx, dy);
308 | RecyclerFastScroller.this.show(true);
309 | }
310 | });
311 | if (recyclerView.getAdapter() != null) attachAdapter(recyclerView.getAdapter());
312 | }
313 |
314 | public void attachAdapter(@Nullable RecyclerView.Adapter adapter) {
315 | if (mAdapter == adapter) return;
316 | if (mAdapter != null) {
317 | mAdapter.unregisterAdapterDataObserver(mAdapterObserver);
318 | }
319 | if (adapter != null) {
320 | adapter.registerAdapterDataObserver(mAdapterObserver);
321 | }
322 | mAdapter = adapter;
323 | }
324 |
325 | public void setOnHandleTouchListener(OnTouchListener listener) {
326 | mOnTouchListener = listener;
327 | }
328 |
329 | /**
330 | * Show the fast scroller and hide after delay
331 | *
332 | * @param animate whether to animate showing the scroller
333 | */
334 | public void show(final boolean animate) {
335 | requestLayout();
336 |
337 | post(new Runnable() {
338 | @Override
339 | public void run() {
340 | if (mHideOverride) {
341 | return;
342 | }
343 |
344 | mHandle.setEnabled(true);
345 | if (animate) {
346 | if (!mAnimatingIn && getTranslationX() != 0) {
347 | if (mAnimator != null && mAnimator.isStarted()) {
348 | mAnimator.cancel();
349 | }
350 | mAnimator = new AnimatorSet();
351 | ObjectAnimator animator = ObjectAnimator.ofFloat(RecyclerFastScroller.this, View.TRANSLATION_X, 0);
352 | animator.setInterpolator(new LinearOutSlowInInterpolator());
353 | animator.setDuration(100);
354 | animator.addListener(new AnimatorListenerAdapter() {
355 | @Override
356 | public void onAnimationEnd(Animator animation) {
357 | super.onAnimationEnd(animation);
358 | mAnimatingIn = false;
359 | }
360 | });
361 | mAnimatingIn = true;
362 | mAnimator.play(animator);
363 | mAnimator.start();
364 | }
365 | } else {
366 | setTranslationX(0);
367 | }
368 | postAutoHide();
369 | }
370 | });
371 | }
372 |
373 | void postAutoHide() {
374 | if (mRecyclerView != null && mHidingEnabled) {
375 | mRecyclerView.removeCallbacks(mHide);
376 | mRecyclerView.postDelayed(mHide, mHideDelay);
377 | }
378 | }
379 |
380 | @Override
381 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
382 | super.onLayout(changed, left, top, right, bottom);
383 | if (mRecyclerView == null) return;
384 |
385 | int scrollOffset = mRecyclerView.computeVerticalScrollOffset() + mAppBarLayoutOffset;
386 | int verticalScrollRange = mRecyclerView.computeVerticalScrollRange()
387 | + mRecyclerView.getPaddingBottom();
388 |
389 | int barHeight = mBar.getHeight();
390 | float ratio = (float) scrollOffset / (verticalScrollRange - barHeight);
391 |
392 | int calculatedHandleHeight = (int) ((float) barHeight / verticalScrollRange * barHeight);
393 | if (calculatedHandleHeight < mMinScrollHandleHeight) {
394 | calculatedHandleHeight = mMinScrollHandleHeight;
395 | }
396 |
397 | if (calculatedHandleHeight >= barHeight) {
398 | setTranslationX(mHiddenTranslationX);
399 | mHideOverride = true;
400 | return;
401 | }
402 |
403 | mHideOverride = false;
404 |
405 | float y = ratio * (barHeight - calculatedHandleHeight);
406 |
407 | mHandle.layout(mHandle.getLeft(), (int) y, mHandle.getRight(), (int) y + calculatedHandleHeight);
408 | }
409 |
410 | void updateRvScroll(int dY) {
411 | if (mRecyclerView != null && mHandle != null) {
412 | try {
413 | mRecyclerView.scrollBy(0, dY);
414 | } catch (Throwable t) {
415 | t.printStackTrace();
416 | }
417 | }
418 | }
419 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/pluscubed/recyclerfastscroll/RecyclerFastScrollerUtils.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscroll;
2 |
3 | import android.content.Context;
4 | import android.content.res.Configuration;
5 | import android.content.res.TypedArray;
6 | import android.graphics.drawable.Drawable;
7 | import android.os.Build;
8 | import android.view.View;
9 |
10 | import androidx.annotation.AttrRes;
11 | import androidx.annotation.ColorInt;
12 |
13 | public class RecyclerFastScrollerUtils {
14 | public static void setViewBackground(View view, Drawable background) {
15 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
16 | view.setBackground(background);
17 | } else {
18 | //noinspection deprecation
19 | view.setBackgroundDrawable(background);
20 | }
21 | }
22 |
23 | public static boolean isRTL(Context context) {
24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
25 | Configuration config = context.getResources().getConfiguration();
26 | return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
27 | } else {
28 | return false;
29 | }
30 | }
31 |
32 | @ColorInt
33 | public static int resolveColor(Context context, @AttrRes int color) {
34 | TypedArray a = context.obtainStyledAttributes(new int[]{color});
35 | int resId = a.getColor(0, 0);
36 | a.recycle();
37 | return resId;
38 | }
39 |
40 | public static int convertDpToPx(Context context, float dp) {
41 | return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f);
42 | }
43 | }
--------------------------------------------------------------------------------
/library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/library/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RecyclerFastScroll
3 |
4 |
--------------------------------------------------------------------------------
/library/src/test/java/com/pluscubed/recyclerfastscroll/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscrollsample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | applicationId "com.pluscubed.recyclerfastscrollsample"
8 | minSdkVersion 14
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "0.3.2.0"
12 | }
13 |
14 | if (project.hasProperty("RELEASE_STORE_FILE")) {
15 | signingConfigs {
16 | release {
17 | storeFile file(RELEASE_STORE_FILE)
18 | storePassword RELEASE_STORE_PASSWORD
19 | keyAlias RELEASE_KEY_ALIAS_RECYCLER_FAST_SROLLER
20 | keyPassword RELEASE_KEY_PASSWORD_RECYCLER_FAST_SROLLER
21 | }
22 | }
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | shrinkResources false
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | if (project.hasProperty("RELEASE_STORE_FILE")) {
31 | signingConfig signingConfigs.release
32 | } else {
33 | signingConfig signingConfigs.debug
34 | }
35 | }
36 | }
37 | }
38 |
39 | repositories {
40 | maven { url "https://jitpack.io" }
41 | }
42 |
43 | dependencies {
44 | compile fileTree(include: ['*.jar'], dir: 'libs')
45 | testCompile 'junit:junit:4.12'
46 | compile 'androidx.legacy:legacy-support-v4:1.0.0'
47 | compile 'androidx.appcompat:appcompat:1.0.2'
48 | compile 'com.google.android.material:material:1.0.0'
49 | compile 'com.afollestad.material-dialogs:core:0.8.6.1'
50 | compile 'com.afollestad.material-dialogs:commons:0.8.6.1'
51 | compile project(':library')
52 | //compile 'com.pluscubed:recycler-fast-scroll:0.3.1'
53 | }
54 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\DC\Development\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/com/pluscubed/recyclerfastscrollsample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscrollsample;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/pluscubed/recyclerfastscrollsample/ScrollingActivity.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscrollsample;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.text.Html;
6 | import android.text.InputType;
7 | import android.view.LayoutInflater;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.Button;
13 | import android.widget.Toast;
14 |
15 | import androidx.annotation.NonNull;
16 | import androidx.appcompat.app.AppCompatActivity;
17 | import androidx.appcompat.widget.Toolbar;
18 | import androidx.recyclerview.widget.LinearLayoutManager;
19 | import androidx.recyclerview.widget.RecyclerView;
20 |
21 | import com.afollestad.materialdialogs.DialogAction;
22 | import com.afollestad.materialdialogs.MaterialDialog;
23 | import com.afollestad.materialdialogs.color.ColorChooserDialog;
24 | import com.google.android.material.snackbar.Snackbar;
25 | import com.pluscubed.recyclerfastscroll.BuildConfig;
26 | import com.pluscubed.recyclerfastscroll.RecyclerFastScroller;
27 | import com.pluscubed.recyclerfastscroll.RecyclerFastScrollerUtils;
28 |
29 | public class ScrollingActivity extends AppCompatActivity implements ColorChooserDialog.ColorCallback {
30 |
31 | static final int[] CUSTOMIZATION_NAMES = {
32 | R.string.hiding_enabled,
33 | R.string.handle_normal_color,
34 | R.string.handle_pressed_color,
35 | R.string.scrollbar_color,
36 | R.string.hide_delay,
37 | R.string.touch_target_width
38 | };
39 |
40 | RecyclerFastScroller mRecyclerFastScroller;
41 |
42 | public static int convertPxToDp(Context context, float px) {
43 | return (int) (px / context.getResources().getDisplayMetrics().density + 0.5f);
44 | }
45 |
46 | @Override
47 | protected void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(R.layout.activity_simple_scrolling);
50 | Toolbar toolbar = findViewById(R.id.toolbar);
51 | setSupportActionBar(toolbar);
52 |
53 | RecyclerView view = findViewById(R.id.recyclerview);
54 | view.setAdapter(new ItemAdapter());
55 | view.setLayoutManager(new LinearLayoutManager(this));
56 |
57 | mRecyclerFastScroller = findViewById(R.id.fast_scroller);
58 | mRecyclerFastScroller.attachRecyclerView(view);
59 |
60 | setTitle(R.string.title);
61 | }
62 |
63 | @Override
64 | public boolean onCreateOptionsMenu(Menu menu) {
65 | // Inflate the menu; this adds items to the action bar if it is present.
66 | getMenuInflater().inflate(R.menu.menu_scrolling, menu);
67 | return true;
68 | }
69 |
70 | @Override
71 | public boolean onOptionsItemSelected(MenuItem item) {
72 | if (item.getItemId() == R.id.menu_about) {
73 | showAboutDialog();
74 | return true;
75 | }
76 | return super.onOptionsItemSelected(item);
77 | }
78 |
79 | @Override
80 | public void onColorSelection(@NonNull ColorChooserDialog colorChooserDialog, int color) {
81 | switch (colorChooserDialog.getTitle()) {
82 | case R.string.handle_normal_color:
83 | mRecyclerFastScroller.setHandleNormalColor(color);
84 | break;
85 | case R.string.handle_pressed_color:
86 | mRecyclerFastScroller.setHandlePressedColor(color);
87 | break;
88 | case R.string.scrollbar_color:
89 | mRecyclerFastScroller.setBarColor(color);
90 | break;
91 | }
92 | }
93 |
94 | public void showAboutDialog() {
95 | new MaterialDialog.Builder(this)
96 | .title(getString(R.string.about_dialog_title, BuildConfig.VERSION_NAME))
97 | .positiveText(R.string.dismiss)
98 | .content(Html.fromHtml(getString(R.string.about_body)))
99 | .iconRes(R.mipmap.ic_launcher)
100 | .show();
101 | }
102 |
103 |
104 | void customizeColors(int title) {
105 | int colorChooserDialogTitle = 0;
106 | int preselectColor = 0;
107 | switch (title) {
108 | case R.string.handle_normal_color:
109 | colorChooserDialogTitle = R.string.handle_normal_color;
110 | preselectColor = mRecyclerFastScroller.getHandleNormalColor();
111 | break;
112 | case R.string.handle_pressed_color:
113 | colorChooserDialogTitle = R.string.handle_pressed_color;
114 | preselectColor = mRecyclerFastScroller.getHandlePressedColor();
115 | break;
116 | case R.string.scrollbar_color:
117 | colorChooserDialogTitle = R.string.scrollbar_color;
118 | preselectColor = mRecyclerFastScroller.getBarColor();
119 | break;
120 | }
121 | new ColorChooserDialog.Builder(this, colorChooserDialogTitle)
122 | .accentMode(title == R.string.handle_pressed_color)
123 | .preselect(preselectColor)
124 | .show();
125 | }
126 |
127 | void customizeTouchTargetWidth() {
128 | new MaterialDialog.Builder(this)
129 | .title(R.string.touch_target_width)
130 | .positiveText(android.R.string.ok)
131 | .negativeText(android.R.string.cancel)
132 | .inputType(InputType.TYPE_CLASS_NUMBER)
133 | .input(null, String.valueOf(convertPxToDp(this, mRecyclerFastScroller.getTouchTargetWidth())),
134 | new MaterialDialog.InputCallback() {
135 | @Override
136 | public void onInput(@NonNull MaterialDialog materialDialog, CharSequence charSequence) {
137 | try {
138 | if (Integer.parseInt(charSequence.toString()) <= 48) {
139 | materialDialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
140 | } else {
141 | throw new NumberFormatException();
142 | }
143 | } catch (NumberFormatException e) {
144 | Toast.makeText(ScrollingActivity.this, R.string.touch_target_size_invalid, Toast.LENGTH_SHORT).show();
145 | materialDialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
146 | }
147 | }
148 | })
149 | .alwaysCallInputCallback()
150 | .onPositive(new MaterialDialog.SingleButtonCallback() {
151 | @Override
152 | public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
153 | int input = Integer.parseInt(materialDialog.getInputEditText().getText().toString());
154 | mRecyclerFastScroller.setTouchTargetWidth(
155 | RecyclerFastScrollerUtils.convertDpToPx(ScrollingActivity.this, input));
156 | }
157 | })
158 | .show();
159 | }
160 |
161 | void customizeHideDelay() {
162 | new MaterialDialog.Builder(this)
163 | .title(R.string.hide_delay)
164 | .positiveText(android.R.string.ok)
165 | .negativeText(android.R.string.cancel)
166 | .inputType(InputType.TYPE_CLASS_NUMBER)
167 | .input(null, String.valueOf(mRecyclerFastScroller.getHideDelay()), false,
168 | new MaterialDialog.InputCallback() {
169 | @Override
170 | public void onInput(@NonNull MaterialDialog materialDialog,
171 | CharSequence charSequence) {
172 | try {
173 | if (Integer.parseInt(charSequence.toString()) >= 0) {
174 | materialDialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
175 | } else {
176 | throw new NumberFormatException();
177 | }
178 | } catch (NumberFormatException e) {
179 | Toast.makeText(ScrollingActivity.this, R.string.hide_delay_invalid, Toast.LENGTH_SHORT).show();
180 | materialDialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
181 | }
182 | }
183 | })
184 | .alwaysCallInputCallback()
185 | .onPositive(new MaterialDialog.SingleButtonCallback() {
186 | @Override
187 | public void onClick(@NonNull MaterialDialog materialDialog,
188 | @NonNull DialogAction dialogAction) {
189 | int input = Integer.parseInt(
190 | materialDialog.getInputEditText().getText().toString());
191 | mRecyclerFastScroller.setHideDelay(input);
192 | }
193 | })
194 | .show();
195 | }
196 |
197 | private class ItemAdapter extends RecyclerView.Adapter {
198 |
199 | ItemAdapter() {
200 | }
201 |
202 | @Override
203 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
204 | View view = LayoutInflater.from(ScrollingActivity.this).inflate(R.layout.list_item_main, parent, false);
205 | return new ViewHolder(view);
206 | }
207 |
208 | @Override
209 | public void onBindViewHolder(ViewHolder holder, int position) {
210 | if (CUSTOMIZATION_NAMES.length > position) {
211 | if (position == 0) {
212 | setHidingButtonText(holder.button);
213 | } else {
214 | holder.button.setText(CUSTOMIZATION_NAMES[position]);
215 | }
216 | } else {
217 | holder.button.setText(String.format(getString(R.string.item_number), position + 1));
218 | }
219 | }
220 |
221 | @Override
222 | public int getItemCount() {
223 | return 1000;
224 | }
225 |
226 | void setHidingButtonText(Button button) {
227 | if (mRecyclerFastScroller.isHidingEnabled()) {
228 | button.setText(R.string.hiding_enabled);
229 | } else {
230 | button.setText(R.string.hiding_disabled);
231 | }
232 | }
233 |
234 | class ViewHolder extends RecyclerView.ViewHolder {
235 | Button button;
236 |
237 | public ViewHolder(View itemView) {
238 | super(itemView);
239 |
240 | button = (Button) itemView.findViewById(R.id.list_item_main_button);
241 |
242 | button.setOnClickListener(new View.OnClickListener() {
243 | @Override
244 | public void onClick(View v) {
245 | int position = getAdapterPosition();
246 | if (CUSTOMIZATION_NAMES.length > position) {
247 | switch (position) {
248 | case 0:
249 | final boolean hidingEnabled = !mRecyclerFastScroller.isHidingEnabled();
250 | mRecyclerFastScroller.setHidingEnabled(hidingEnabled);
251 | setHidingButtonText(button);
252 | if (!hidingEnabled) {
253 | mRecyclerFastScroller.show(false);
254 | }
255 | break;
256 | case 1:
257 | case 2:
258 | case 3:
259 | customizeColors(CUSTOMIZATION_NAMES[position]);
260 | break;
261 | case 4:
262 | customizeHideDelay();
263 | break;
264 | case 5:
265 | customizeTouchTargetWidth();
266 | break;
267 | }
268 | } else {
269 | Snackbar.make(v, String.format(getString(R.string.item_pressed_snackbar), button.getText()), Snackbar.LENGTH_SHORT)
270 | .show();
271 | }
272 | }
273 | });
274 | }
275 | }
276 | }
277 | }
278 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_simple_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
20 |
21 |
28 |
29 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/list_item_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/menu_scrolling.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pluscubed/recycler-fast-scroll/3de76812553a77bfd25d3aea0a0af4d96516c3e3/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 180dp
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RFS Sample
3 | RecyclerFastScroll Sample
4 |
5 | AppBarLayout Demo
6 |
7 | Customize Handle Normal Color
8 | Customize Handle Pressed Color
9 | Customize Scrollbar Color
10 | Customize Touch Target Width
11 | Touch target size must be a number less than or equal to 48
12 | Customize Hide Delay
13 | Number must be greater than or equal to 0
14 | Disable Hiding
15 | Enable Hiding
16 | Item #%d
17 | You\'re at %s
18 | About
19 |
20 | RFS Sample v%s
21 | Dismiss
22 |
23 | Recycler Fast Scroll is a widget for RecyclerView fast scrolling, like Android\'s built-in fast scroll option for ListView.
25 |
26 |
27 | Developed by Daniel Ciao
28 |
29 | Website
30 | Twitter
31 | Google+
32 | GitHub
33 | LinkedIn
34 |
35 | GitHub - source, issues, feature requests
36 | ]]>
37 |
38 |
39 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/src/test/java/com/pluscubed/recyclerfastscrollsample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.pluscubed.recyclerfastscrollsample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':sample', ':library'
2 |
--------------------------------------------------------------------------------