├── .gitignore ├── .travis.yml ├── LICENSE.md ├── README.md ├── build.gradle ├── demo_screenshot.png ├── deploy └── secring.gpg.enc ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── rangeseekbar-sample ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── florescu │ │ └── android │ │ └── rangeseekbar │ │ └── sample │ │ └── DemoActivity.java │ └── res │ ├── drawable │ └── custom_slider_thumb.xml │ ├── layout │ └── main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── rangeseekbar ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── org │ │ │ └── florescu │ │ │ └── android │ │ │ ├── rangeseekbar │ │ │ └── RangeSeekBar.java │ │ │ └── util │ │ │ ├── BitmapUtil.java │ │ │ └── PixelUtil.java │ └── res │ │ ├── drawable-xhdpi │ │ ├── seek_thumb_disabled.png │ │ ├── seek_thumb_normal.png │ │ └── seek_thumb_pressed.png │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── org │ └── florescu │ └── android │ └── rangeseekbar │ └── RangeSeekBarTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio files 30 | .idea 31 | *.iml 32 | 33 | # Mac files 34 | **/.DS_Store 35 | 36 | # Don't commit the pgp certificate 37 | /deploy/secring.gpg 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk7 3 | android: 4 | components: 5 | - platform-tools 6 | - tools 7 | - build-tools-23.0.3 8 | - android-23 9 | 10 | #Additional libs from Android 11 | - extra-google-m2repository 12 | - extra-android-m2repository 13 | 14 | script: 15 | - ./gradlew clean build 16 | before_deploy: 17 | - openssl aes-256-cbc -K $encrypted_ee19969afbf8_key -iv $encrypted_ee19969afbf8_iv 18 | -in deploy/secring.gpg.enc -out deploy/secring.gpg -d 19 | env: 20 | global: 21 | - signing.secretKeyRingFile=deploy/secring.gpg 22 | - secure: kaqqiHrQhVXjFecwDlPA7U2cDQJIR8Pzc8SQFJSd05h5hLXeTJ71bBwFWfpRrxqoHZzxX18nt8WX28gpmGWxOBnSZGkG7b/sIowZzxcEMU6snqcR6wRKb9GMK4gOm84sDQArYfkhZfxECFBshdh7KDzZyowRZ3y2OgmhTXjpF8PcnBg8DUJLoLefTtQFYGHm9s9DRAvoMxP/JdGq4UmhaqelfArIa3cFgXt886Snr/nWIG4gM54jJ73K45aga7d1LWHWxLj3TmFW91Jc8a9bi9RsvqNzfDM912H31CZlF+t6dPVfNQtqN0UAU9VGJwuLXhBncyIIF6s4WZqA/OaL2siOvB0pHiWjNTPaVkXxVo/3Tu2oPv7cBXdyU/ysqf001vLhb+Oe7hVKdi2sUN07dM4fD9QGX23kFDb3x2HxmZ9k7Qknn+hyOF/my+A6BM8o48wPjp7LNxgC1kON1SzVVLdp6U/6GoBfnFWIjaHA7c0pjnjbG1+yCiOl/OgEar5hHgg7WThOPbt82Xpdkhqjw3G75yMixeJ1oX5R5I2P1FFB/KH1h0Bd+4zdnQK73Z+NgSQ+7hNIw/8Nkur2D1f6sQswnUKQad1/erO1aHKNotlPUCWSYIBU/HN2/A0BTy4wLairzz2868knVctXLVXf16G/Gm3WcAZIaIaiEgTL9LQ= 23 | - secure: ejT20N27Nz1VBk5DMhPwm3Hy0yLws1RJOoXRgvIr0OTIJjBvbwnM6Ae+Xz3re+s4oowL8AkfH831/gx0Btq1dJWK31dVC5+lEE0TJ5sA2yxNKyPikUn8KESg+VQpxml1u0g8VGALZuD+z4i3OjllxpwGgWK0hhdkvtEkU+Atej+OcVsBK32fWZiie8bKcYAEmxEAhelD0E4XdMR3LRXdLMPHza/Zw6saPSBFn3+k/5e+QnlgBZmwigdS7hbzl6bBaMmQhN/I4NXSU2VHZuHnVehqDYkhEo2teN0Yv5ME/+Q1580SJ7CQOi8QUEZSuqUjTi81618BlnT5rT2G7zZ61bbRBzssxEK2XUhy0NGr5kMC6muPoVBbmVFUbBsn1qHduEoYsvboiF8pBMqBeQp4IQr6bonJBxKnqhg60VIhoNN8kie7bSX64LfevKAukGGVV/ayp8jOxslTMSl2WSo1RrExU3qxQY3ff3Xn7UEIQg2kHWxvylWEpWbQiq/OrwMNGcjVAEROEFHyUwIjdAl95CRa+dVe87+PjwsUx4zG5iV276cEeh/KpLRhfBrMntM5soCSz7CX5mIPDOhtgTE4XoxQufbdqFF0PEG4HgQSHAlGOwigQrjFyxG4jQXNLXLUx7ndApTeU0oxOt/EbZun/Qj9RpqotArWsUgz99Ti+Xs= 24 | - secure: Qzk/onJZhh1ArvkwXgelWqoZkfbrepv2RnEniJkl6o2VkMaEmBA/v0bESlEhlwzCw4x+CZsniUOTOARLOT9rhyDiVJIj8qVAhicGjP4y4z3rOzFFBRsqp7RMg8C8PeVmtnwJQm+mT6yQVwETJJJV9cT087i8nzI6gQychC2AAou/Pqftqd0t4mraekryCU8Sz9z4wzJVFRaXiMZenTce1wabA644QKMImNMo9m8w+d7xvgXiWeMUmqDW97qBN3YBTBb/IawGfmZHtugQS4A/duql7Ch4hFC6p53VzAHGHICWZDJnBSCZ4m9kNCn1eij4ci/XVOLxAvrxgKgleSs2PZkAjy3XpVthIr4QYHiBgsul4dC9yIeZknpIURbBWZf3IZD5M+aDE5pNKrBS0NTQbPiTpkcSdjG/wrkeBR8thkTVpmuR4YxCQ2tOtvMNeB3PpQtbpi9JChHceGaDv63EKRmC0uvaKcgkU5VBSlJFyCFlM/J4on07E+FaG2JwR2qHTe1rW9DEYJNfYoup40NQTlVnSTBvEDvqWDzUZS6ZWA+zlImqqLPKUWfVnmytGys20wCwPLxbQV/2FJRhwGe31mVcxbmemZOfhzAaqZNf1yOB2EwR2uGIy2Rj9AmzICZnvFZ455r/VKJy1oTspFTaC2NJb9Pbwx1XtrszjFSGR9M= 25 | - secure: UG2/nlfzKTPIt2m9t87CVwkW++WKSloEvysQvSIqGunFQfmUif/8Nr9EFzuZ+AmwRu4sSfSd6UfrFosiA2iWMsdlXIdlek4puIBjfro8NnczjUuvgMxl5CyoFizqD3kDB4QbEvs2ZQmZtsql3AZKAHhFURcmay4skDWZKgwOInbIPQydzAGXlTnJIw7fn8qsP2a+rvOo+FD+bHKXUeUNe/bF2Qi2WI4eStcAKaFbPkl39VUMs6jyIji9v4djfcCtfqZcSlvS5BtzDYQ6D0sMgum1oh8/NgkjU7bg6fj+cvjfK1rS2p/J/qMILFGaPxUfLwH+EEb7Y1IhCRnDUgm6xen7nDXaihiC6JAgALTjTTAMcul2In+UAT1rZdfH2H6bwHuffGe/7rA9XarP2kUn4GEjVHHZkvPyyQxunLZ5uaehXhudOf05FaTsSrWcyDUCG7mv1Vl6EAmwhcQPlpAsTQn2TjeTPeWeMUjx+IsXB+oI2AUavEvWzy666PWA02i+S/dlGo3SpEzJL0qCJgBaS+fik732sHRL65VYMpXNQsdNd6iVQY2qhyRqBwNPK1nYJIJpaiKZJd/ZL6Uy6anvT1MsHil2CuZrJwtu0rU642WeAzsToQVtQNBbfm35MXPwOOpLc4Rdby55UL3QQuVE7GRGrmlBbdqaS0iz2GRHh9c= 26 | - secure: dpmJdS1BL8ggLP/dEthMNW9PRMkZr9lqQisJpyBUzhjGco0gG0/kcXY2QMWM5UFvnLmNvhgLt/+IggsY/B2WJyaYfsHeaNPxKdKY4RLIxHu0SwQIMwyXnlq1NmHHPm4jSswVzBsqtImzDS6tw2z+gLtZ9ddbLOOgukw5ApjGAYLvcJHseLM9eAlS+Idq011M5SDbCPf4hzqS3lcktMDuzn9Oq0iNoVa4pcLRP6+/j0L2F+fPWV+ApGOUuiC++I8rybLEh3jA+oLxrFLLl1YwWJxNtVG84wfWzUR561fJcR4rXmZyfguNtSBvVcSIQYBSvXkYcaIVljIR3t7xtLJRs03oPaLatB/+FOlvW5XHMFwNCK9e7WTw7bRU7fcKT+zYRTuIsngNyY2cFlXuXb4kRiWxwHKdKFV+VPaADpV5B6Z155jIwM+b5gkCYrZuXgOJWMIeTEM8VYPnrSUKRqRECvWvYWdAQlcYHO0CdM4HwTa3BsRzoUImboE0smitNF16aLrwvc6wqUsArK+gPIC1iFGjq/4gP4kD28He0rq8VWRAmmUdRMqQ8JMZzcHtmFn3G8HQ9jYMNORwJurSQxdQ56KERNB2X9uLvJeCL9yumPGKOSnzT1uidA1ILl3ivaCwRL4nDEGXhKdVO5k03hdUNy2uERpIhDX0pGB7mL6397o= 27 | - secure: e47psDP7pGMPx88OaSRbo7xVATUyKdqHHXisJwe6NbmhXhNO8BQMHY//D4cv/McNPGe5yGuijnI8xqR4lpOpotzAVYk6IMPU18ABpp9pUs43b8ejfKczu3C1CUv2Pn4Okk87w6JvRmh8vQ1yBNUCNGvHhJg78WhlN66TyJlyd463J7QASYp7w45SAlZxKyifuE/1mMXU7Lhhs0GY6VPazEWKcUUegocI7YAGY3KvN0OIaqUCr+a4MtEnkXywwWpsYknuFrosalzRfQ2+c2Csz1PoULXPieqWkUfFVsUmNgce1L/X3AgQ5YnKN5SGFnBHJKcM39vQDtSvAm7yJyZNranlb4qA6pt0IeVLXoQpUIM/dbedDOVbBd4+x0rDeKt5x5A7lhHKGn+5F/cXSdNCR/oulfJ46ttD+8fHFoqwlV+xZa83Ee7uRN33n3xqz0ydnOf9njXEXJ5uELgNMrgAifrjBK+1nR0rlYFSn88AVez2Jla1/BWtVAERr5X5v0z+YL9KqoAkoC+mKmSX5GQ7do8KqsOOY4Z6waJTVTfZJU5SNhGSy24jO6+0NPDmMsF+35awCBc09SJ9iMWaGvg7vUm8mp8xAM3DsjKXgDwGfQNDdOHQXqm4o9sFrEoVYTMh2oVThANZFzv/C2av7QbhwQpnFh0EFeES5yzB/6koByI= 28 | - secure: dZ42Hwb+HRwB6fkYL1jauqKUJGqlkwbyzVvvnD0WtVDztCitrLsgZpetdV0L0/RPyr1Id7isa/JyhmATtHMMJx8hVSzvItXR/dfXbCzqGmwrYx+HqQiroAG2cmrv8+8doMHhIBjmAE06vGSy0EgABREAMCsgwbNHU8oTBvcsvVSB2+mFklNiRJGvfrzWlr6IvEIc8kAN+izBZIjhsWCMUFFYzjzcEIJ92fmAr84EBDNavJGhc3O61RYuJwVz4PvLMggxPCA216Uj99rZST3MTDZP+kPksqy5mQmqgo5dRKi+O20JzoxRNZ/68sd4GqKSvDAHStNysA76neZXOu0bVKXpk/xLgeNk0eipzy3KAguh/5PaLqqm4cBC3pbEKy4Z6/xjxrewRd+vRlW4qW+uEkHDIaL1y2q5snIs9NT+mia/48lvnJdXnSyUQ9jH1tNvPm+h2mTJHwrYetqJTBG1k8ZsIpIJk3bv4dw134CEGGt92r52W8iDaxzdLQqy6AWaz0mTl0mUJ73e4IvJj5R/M/OMqbzCCIoIzF/Y6e9pwRoufX0zJGW5kRLTsi8Cz5c0RGrX5YqXYfUrh1rQolVya8jnDlTphOSarKSN4iQISTc9xLUmXb8hoeFbnFSEHo6WXx9uIl1qUqTucJpv+vBU5UCQNutRtKZsu2DC0HhgNmU= 29 | deploy: 30 | provider: script 31 | script: ./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}" -Psigning.keyId="${SIGNING_KEY_ID}" -Psigning.password="${SIGNING_KEY_PASSWORD}" -Pbintray.user="${BINTRAY_USER}" -Pbintray.apikey="${BINTRAY_API_KEY}" -Pbintray.gpg.password="${BINTRAY_GPG_PWD}" -Psigning.secretKeyRingFile=/home/travis/build/anothem/android-range-seek-bar/deploy/secring.gpg 32 | skip_cleanup: true 33 | on: 34 | branch: master 35 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 14 | 15 | "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. 16 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 18 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 20 | 21 | "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. 22 | 23 | "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). 24 | 25 | "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. 26 | 27 | "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." 28 | 29 | "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. 30 | 31 | 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. 32 | 33 | 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. 34 | 35 | 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: 36 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 38 | You must cause any modified files to carry prominent notices stating that You changed the files; and 39 | 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 40 | 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. 41 | 42 | 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. 43 | 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. 44 | 45 | 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. 46 | 47 | 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. 48 | 49 | 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. 50 | 51 | 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. 52 | 53 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | range-seek-bar 2 | ====================== 3 | 4 | # Introduction 5 | 6 | If you are coming from [the original repo](https://github.com/yahoo/android-range-seek-bar), it has a [new home](https://github.com/anothem/android-range-seek-bar) so if you're seeing this, you're probably in the right place. 7 | 8 | This library provides a SeekBar similar to the default Android one, but with two thumb controls allowing a range to be selected. 9 | 10 | ![](demo_screenshot.png) 11 | 12 | # Features and customizations 13 | 14 | Main features: 15 | 16 | * Two thumbs allowing a range to be selected 17 | * Supports integer ranges and floating point ranges 18 | * Text indicating the selected min and max values on the bar 19 | * Smoother drag animation 20 | 21 | Customizations: 22 | 23 | * Ability to initialise from XML, with attributes (only tested for Integer and Double, would not support all the original types that the class supports when initialized programmatically) 24 | * Ability to make the range-seek-bar only use one thumb instead of two, with all other feature remaining; can be set from XML. 25 | This makes it more similar to the default android seekbar, but you still benefit from the other features and very smooth animation. 26 | * Text above thumbs can be disabled and colour can be changed 27 | * Custom icons can be used for the thumbs 28 | 29 | # How to run demo 30 | 31 | Should be able to import, build and run in Android Studio or from the command line with gradle. 32 | The rangeseekbar-sample shows the available features and customizations in code and XML. 33 | 34 | # How to use in your own project 35 | 36 | ## Setup as Gradle dependency 37 | 38 | * Add this in your build.gradle file: 39 | 40 | * For latest release: 41 | 42 | ```groovy 43 | dependencies { 44 | compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0' 45 | } 46 | ``` 47 | 48 | * For the latest work-in-progress snapshot: 49 | 50 | ```groovy 51 | dependencies { 52 | compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.4.0-SNAPSHOT' 53 | } 54 | ``` 55 | 56 | Using the latest work-in-progress snapshot also requires including the snapshot repository as a depencency: 57 | 58 | ```groovy 59 | apply plugin: 'com.android.application' 60 | repositories { 61 | maven { 62 | url "https://oss.sonatype.org/content/repositories/snapshots" 63 | } 64 | } 65 | ``` 66 | 67 | # Credits 68 | 69 | The android-range-seek-bar started as a fork of the following project: https://code.google.com/p/range-seek-bar/ under Apache license. 70 | 71 | # License 72 | 73 | The images are licensed under Creative Commons ( http://creativecommons.org/licenses/by/3.0/ ). The originals are provided in the original project ( https://code.google.com/p/range-seek-bar/ ) and seek_thumb_disabled.png is added by us. 74 | 75 | The source code is licensed under the Apache License. A copy of this can be found at http://www.apache.org/licenses/LICENSE-2.0 and has been included in the repository as well. 76 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | apply plugin: 'com.github.ben-manes.versions' 3 | 4 | buildscript { 5 | repositories { 6 | jcenter() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:2.1.0' 11 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /demo_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/demo_screenshot.png -------------------------------------------------------------------------------- /deploy/secring.gpg.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/deploy/secring.gpg.enc -------------------------------------------------------------------------------- /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 | 20 | VERSION_NAME=0.4.0 21 | VERSION_CODE=004000 22 | GROUP=org.florescu.android.rangeseekbar 23 | 24 | SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots 25 | RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2 26 | 27 | POM_DESCRIPTION=This library provides a SeekBar similar to the default Android one, but with two thumb controls allowing a range to be selected. 28 | POM_URL=https://github.com/anothem/android-range-seek-bar 29 | POM_SCM_URL=https://github.com/anothem/android-range-seek-bar 30 | POM_SCM_CONNECTION=scm:git@github.com:anothem/android-range-seek-bar.git 31 | POM_SCM_DEV_CONNECTION=scm:git@github.com:anothem/android-range-seek-bar.git 32 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 33 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 34 | POM_LICENCE_DIST=repo 35 | POM_DEVELOPER_ID=anothem 36 | POM_DEVELOPER_NAME=Alex Florescu 37 | 38 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 26 16:38:46 BST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /rangeseekbar-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rangeseekbar-sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | repositories { 3 | maven { 4 | url "https://oss.sonatype.org/content/repositories/snapshots" 5 | } 6 | } 7 | 8 | android { 9 | compileSdkVersion 23 10 | buildToolsVersion "23.0.3" 11 | 12 | defaultConfig { 13 | applicationId "org.florescu.android.rangeseekbar.sample" 14 | minSdkVersion 15 15 | targetSdkVersion 23 16 | versionCode 1 17 | versionName "1.0" 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | compile 'com.android.support:appcompat-v7:23.4.0' 30 | compile project(':rangeseekbar') 31 | } 32 | -------------------------------------------------------------------------------- /rangeseekbar-sample/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Android RangeSeekBar Sample 2 | POM_ARTIFACT_ID=rangeseekbar-sample 3 | POM_PACKAGING=aar 4 | 5 | -------------------------------------------------------------------------------- /rangeseekbar-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 /Users/anothem/workspace/android-sdk-mac_x86/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 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/java/org/florescu/android/rangeseekbar/sample/DemoActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Alex Florescu 3 | Copyright 2014 Yahoo Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package org.florescu.android.rangeseekbar.sample; 19 | 20 | import android.app.Activity; 21 | import android.os.Bundle; 22 | import android.widget.FrameLayout; 23 | import android.widget.LinearLayout; 24 | 25 | import org.florescu.android.rangeseekbar.RangeSeekBar; 26 | 27 | public class DemoActivity extends Activity { 28 | 29 | /** 30 | * Called when the activity is first created. 31 | */ 32 | @Override 33 | public void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.main); 36 | 37 | // Setup the new range seek bar 38 | RangeSeekBar rangeSeekBar = new RangeSeekBar<>(this); 39 | // Set the range 40 | rangeSeekBar.setRangeValues(15, 90); 41 | rangeSeekBar.setSelectedMinValue(20); 42 | rangeSeekBar.setSelectedMaxValue(88); 43 | 44 | // Add to layout 45 | FrameLayout layout = (FrameLayout) findViewById(R.id.seekbar_placeholder); 46 | layout.addView(rangeSeekBar); 47 | 48 | // Seek bar for which we will set text color in code 49 | RangeSeekBar rangeSeekBarTextColorWithCode = (RangeSeekBar) findViewById(R.id.rangeSeekBarTextColorWithCode); 50 | rangeSeekBarTextColorWithCode.setTextAboveThumbsColorResource(android.R.color.holo_blue_bright); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/drawable/custom_slider_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | 18 | 23 | 24 | 28 | 29 | 32 | 33 | 37 | 38 | 39 | 44 | 45 | 49 | 50 | 51 | 57 | 58 | 62 | 63 | 64 | 69 | 70 | 74 | 75 | 76 | 82 | 83 | 87 | 88 | 95 | 96 | 100 | 101 | 108 | 109 | 113 | 114 | 115 | 123 | 124 | 130 | 131 | 132 | 138 | 139 | 140 | 146 | 147 | 157 | 158 | 164 | 165 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RangeSeekBar 3 | 4 | -------------------------------------------------------------------------------- /rangeseekbar-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rangeseekbar/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rangeseekbar/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:2.1.0' 8 | } 9 | } 10 | 11 | apply plugin: 'com.android.library' 12 | 13 | android { 14 | compileSdkVersion 23 15 | buildToolsVersion "23.0.3" 16 | 17 | defaultConfig { 18 | minSdkVersion 15 19 | targetSdkVersion 23 20 | versionCode 1 21 | versionName "1.0" 22 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 23 | } 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | android.sourceSets.test.java.srcDirs += "build/generated/source/r/debug" 31 | } 32 | 33 | dependencies { 34 | repositories { 35 | mavenCentral() 36 | } 37 | 38 | compile fileTree(dir: 'libs', include: ['*.jar']) 39 | compile 'com.android.support:appcompat-v7:23.4.0' 40 | compile 'com.android.support:support-annotations:23.4.0' 41 | 42 | // Robolectric 43 | testCompile 'org.robolectric:robolectric:3.1-rc1' 44 | testCompile "org.mockito:mockito-core:2.0.53-beta" 45 | } 46 | 47 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' -------------------------------------------------------------------------------- /rangeseekbar/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Android RangeSeekBar Library 2 | POM_ARTIFACT_ID=rangeseekbar-library 3 | POM_PACKAGING=aar 4 | 5 | -------------------------------------------------------------------------------- /rangeseekbar/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 /Users/anothem/workspace/android-sdk-mac_x86/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 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Alex Florescu 3 | Copyright 2014 Stephan Tittel and Yahoo Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package org.florescu.android.rangeseekbar; 19 | 20 | import android.content.Context; 21 | import android.content.res.TypedArray; 22 | import android.graphics.Bitmap; 23 | import android.graphics.BitmapFactory; 24 | import android.graphics.BlurMaskFilter; 25 | import android.graphics.Canvas; 26 | import android.graphics.Color; 27 | import android.graphics.Matrix; 28 | import android.graphics.Paint; 29 | import android.graphics.Paint.Style; 30 | import android.graphics.Path; 31 | import android.graphics.RectF; 32 | import android.graphics.drawable.Drawable; 33 | import android.os.Bundle; 34 | import android.os.Parcelable; 35 | import android.support.annotation.ColorRes; 36 | import android.support.annotation.NonNull; 37 | import android.util.AttributeSet; 38 | import android.util.TypedValue; 39 | import android.view.MotionEvent; 40 | import android.view.ViewConfiguration; 41 | import android.widget.ImageView; 42 | 43 | import org.florescu.android.util.BitmapUtil; 44 | import org.florescu.android.util.PixelUtil; 45 | 46 | import java.math.BigDecimal; 47 | 48 | /** 49 | * Widget that lets users select a minimum and maximum value on a given numerical range. 50 | * The range value types can be one of Long, Double, Integer, Float, Short, Byte or BigDecimal.
51 | *
52 | * Improved {@link android.view.MotionEvent} handling for smoother use, anti-aliased painting for improved aesthetics. 53 | * 54 | * @param The Number type of the range values. One of Long, Double, Integer, Float, Short, Byte or BigDecimal. 55 | * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de) 56 | * @author Peter Sinnott (psinnott@gmail.com) 57 | * @author Thomas Barrasso (tbarrasso@sevenplusandroid.org) 58 | * @author Alex Florescu (alex@florescu.org) 59 | * @author Michael Keppler (bananeweizen@gmx.de) 60 | */ 61 | public class RangeSeekBar extends ImageView { 62 | /** 63 | * Default color of a {@link RangeSeekBar}, #FF33B5E5. This is also known as "Ice Cream Sandwich" blue. 64 | */ 65 | public static final int ACTIVE_COLOR = Color.argb(0xFF, 0x33, 0xB5, 0xE5); 66 | /** 67 | * An invalid pointer id. 68 | */ 69 | public static final int INVALID_POINTER_ID = 255; 70 | 71 | // Localized constants from MotionEvent for compatibility 72 | // with API < 8 "Froyo". 73 | public static final int ACTION_POINTER_INDEX_MASK = 0x0000ff00, ACTION_POINTER_INDEX_SHIFT = 8; 74 | 75 | public static final Integer DEFAULT_MINIMUM = 0; 76 | public static final Integer DEFAULT_MAXIMUM = 100; 77 | public static final Integer DEFAULT_STEP = 1; 78 | public static final int HEIGHT_IN_DP = 30; 79 | public static final int TEXT_LATERAL_PADDING_IN_DP = 3; 80 | 81 | private static final int INITIAL_PADDING_IN_DP = 8; 82 | private static final int DEFAULT_TEXT_SIZE_IN_DP = 14; 83 | private static final int DEFAULT_TEXT_DISTANCE_TO_BUTTON_IN_DP = 8; 84 | private static final int DEFAULT_TEXT_DISTANCE_TO_TOP_IN_DP = 8; 85 | 86 | private static final int LINE_HEIGHT_IN_DP = 1; 87 | private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); 88 | private final Paint shadowPaint = new Paint(); 89 | 90 | private Bitmap thumbImage; 91 | private Bitmap thumbPressedImage; 92 | private Bitmap thumbDisabledImage; 93 | 94 | private float thumbHalfWidth; 95 | private float thumbHalfHeight; 96 | 97 | private float padding; 98 | protected T absoluteMinValue, absoluteMaxValue, absoluteStepValue; 99 | protected NumberType numberType; 100 | protected double absoluteMinValuePrim, absoluteMaxValuePrim, absoluteStepValuePrim; 101 | protected double normalizedMinValue = 0d; 102 | protected double normalizedMaxValue = 1d; 103 | protected double minDeltaForDefault = 0; 104 | private Thumb pressedThumb = null; 105 | private boolean notifyWhileDragging = false; 106 | private OnRangeSeekBarChangeListener listener; 107 | 108 | private float downMotionX; 109 | 110 | private int activePointerId = INVALID_POINTER_ID; 111 | 112 | private int scaledTouchSlop; 113 | 114 | private boolean isDragging; 115 | 116 | private int textOffset; 117 | private int textSize; 118 | private int distanceToTop; 119 | private RectF rect; 120 | 121 | private boolean singleThumb; 122 | private boolean alwaysActive; 123 | private boolean showLabels; 124 | private boolean showTextAboveThumbs; 125 | private float internalPad; 126 | private int activeColor; 127 | private int defaultColor; 128 | private int textAboveThumbsColor; 129 | 130 | private boolean thumbShadow; 131 | private int thumbShadowXOffset; 132 | private int thumbShadowYOffset; 133 | private int thumbShadowBlur; 134 | private Path thumbShadowPath; 135 | private Path translatedThumbShadowPath = new Path(); 136 | private Matrix thumbShadowMatrix = new Matrix(); 137 | 138 | private boolean activateOnDefaultValues; 139 | 140 | 141 | public RangeSeekBar(Context context) { 142 | super(context); 143 | init(context, null); 144 | } 145 | 146 | public RangeSeekBar(Context context, AttributeSet attrs) { 147 | super(context, attrs); 148 | init(context, attrs); 149 | } 150 | 151 | public RangeSeekBar(Context context, AttributeSet attrs, int defStyle) { 152 | super(context, attrs, defStyle); 153 | init(context, attrs); 154 | } 155 | 156 | @SuppressWarnings("unchecked") 157 | private T extractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue) { 158 | TypedValue tv = a.peekValue(attribute); 159 | if (tv == null) { 160 | return (T) Integer.valueOf(defaultValue); 161 | } 162 | 163 | int type = tv.type; 164 | if (type == TypedValue.TYPE_FLOAT) { 165 | return (T) Float.valueOf(a.getFloat(attribute, defaultValue)); 166 | } else { 167 | return (T) Integer.valueOf(a.getInteger(attribute, defaultValue)); 168 | } 169 | } 170 | 171 | private void init(Context context, AttributeSet attrs) { 172 | float barHeight; 173 | int thumbNormal = R.drawable.seek_thumb_normal; 174 | int thumbPressed = R.drawable.seek_thumb_pressed; 175 | int thumbDisabled = R.drawable.seek_thumb_disabled; 176 | int thumbShadowColor; 177 | int defaultShadowColor = Color.argb(75, 0, 0, 0); 178 | int defaultShadowYOffset = PixelUtil.dpToPx(context, 2); 179 | int defaultShadowXOffset = PixelUtil.dpToPx(context, 0); 180 | int defaultShadowBlur = PixelUtil.dpToPx(context, 2); 181 | 182 | if (attrs == null) { 183 | setRangeToDefaultValues(); 184 | internalPad = PixelUtil.dpToPx(context, INITIAL_PADDING_IN_DP); 185 | barHeight = PixelUtil.dpToPx(context, LINE_HEIGHT_IN_DP); 186 | activeColor = ACTIVE_COLOR; 187 | defaultColor = Color.GRAY; 188 | alwaysActive = false; 189 | showTextAboveThumbs = true; 190 | textAboveThumbsColor = Color.WHITE; 191 | thumbShadowColor = defaultShadowColor; 192 | thumbShadowXOffset = defaultShadowXOffset; 193 | thumbShadowYOffset = defaultShadowYOffset; 194 | thumbShadowBlur = defaultShadowBlur; 195 | activateOnDefaultValues = false; 196 | } else { 197 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.RangeSeekBar, 0, 0); 198 | try { 199 | setRangeValues( 200 | extractNumericValueFromAttributes(a, R.styleable.RangeSeekBar_absoluteMinValue, DEFAULT_MINIMUM), 201 | extractNumericValueFromAttributes(a, R.styleable.RangeSeekBar_absoluteMaxValue, DEFAULT_MAXIMUM), 202 | extractNumericValueFromAttributes(a, R.styleable.RangeSeekBar_step, DEFAULT_STEP) 203 | ); 204 | showTextAboveThumbs = a.getBoolean(R.styleable.RangeSeekBar_valuesAboveThumbs, true); 205 | textAboveThumbsColor = a.getColor(R.styleable.RangeSeekBar_textAboveThumbsColor, Color.WHITE); 206 | singleThumb = a.getBoolean(R.styleable.RangeSeekBar_singleThumb, false); 207 | showLabels = a.getBoolean(R.styleable.RangeSeekBar_showLabels, true); 208 | internalPad = a.getDimensionPixelSize(R.styleable.RangeSeekBar_internalPadding, INITIAL_PADDING_IN_DP); 209 | barHeight = a.getDimensionPixelSize(R.styleable.RangeSeekBar_barHeight, LINE_HEIGHT_IN_DP); 210 | activeColor = a.getColor(R.styleable.RangeSeekBar_activeColor, ACTIVE_COLOR); 211 | defaultColor = a.getColor(R.styleable.RangeSeekBar_defaultColor, Color.GRAY); 212 | alwaysActive = a.getBoolean(R.styleable.RangeSeekBar_alwaysActive, false); 213 | 214 | Drawable normalDrawable = a.getDrawable(R.styleable.RangeSeekBar_thumbNormal); 215 | if (normalDrawable != null) { 216 | thumbImage = BitmapUtil.drawableToBitmap(normalDrawable); 217 | } 218 | Drawable disabledDrawable = a.getDrawable(R.styleable.RangeSeekBar_thumbDisabled); 219 | if (disabledDrawable != null) { 220 | thumbDisabledImage = BitmapUtil.drawableToBitmap(disabledDrawable); 221 | } 222 | Drawable pressedDrawable = a.getDrawable(R.styleable.RangeSeekBar_thumbPressed); 223 | if (pressedDrawable != null) { 224 | thumbPressedImage = BitmapUtil.drawableToBitmap(pressedDrawable); 225 | } 226 | thumbShadow = a.getBoolean(R.styleable.RangeSeekBar_thumbShadow, false); 227 | thumbShadowColor = a.getColor(R.styleable.RangeSeekBar_thumbShadowColor, defaultShadowColor); 228 | thumbShadowXOffset = a.getDimensionPixelSize(R.styleable.RangeSeekBar_thumbShadowXOffset, defaultShadowXOffset); 229 | thumbShadowYOffset = a.getDimensionPixelSize(R.styleable.RangeSeekBar_thumbShadowYOffset, defaultShadowYOffset); 230 | thumbShadowBlur = a.getDimensionPixelSize(R.styleable.RangeSeekBar_thumbShadowBlur, defaultShadowBlur); 231 | 232 | activateOnDefaultValues = a.getBoolean(R.styleable.RangeSeekBar_activateOnDefaultValues, false); 233 | } finally { 234 | a.recycle(); 235 | } 236 | } 237 | 238 | if (thumbImage == null) { 239 | thumbImage = BitmapFactory.decodeResource(getResources(), thumbNormal); 240 | } 241 | if (thumbPressedImage == null) { 242 | thumbPressedImage = BitmapFactory.decodeResource(getResources(), thumbPressed); 243 | } 244 | if (thumbDisabledImage == null) { 245 | thumbDisabledImage = BitmapFactory.decodeResource(getResources(), thumbDisabled); 246 | } 247 | 248 | thumbHalfWidth = 0.5f * thumbImage.getWidth(); 249 | thumbHalfHeight = 0.5f * thumbImage.getHeight(); 250 | 251 | setValuePrimAndNumberType(); 252 | 253 | textSize = PixelUtil.dpToPx(context, DEFAULT_TEXT_SIZE_IN_DP); 254 | distanceToTop = PixelUtil.dpToPx(context, DEFAULT_TEXT_DISTANCE_TO_TOP_IN_DP); 255 | textOffset = !showTextAboveThumbs ? 0 : this.textSize + PixelUtil.dpToPx(context, 256 | DEFAULT_TEXT_DISTANCE_TO_BUTTON_IN_DP) + this.distanceToTop; 257 | 258 | rect = new RectF(padding, 259 | textOffset + thumbHalfHeight - barHeight / 2, 260 | getWidth() - padding, 261 | textOffset + thumbHalfHeight + barHeight / 2); 262 | 263 | // make RangeSeekBar focusable. This solves focus handling issues in case EditText widgets are being used along with the RangeSeekBar within ScrollViews. 264 | setFocusable(true); 265 | setFocusableInTouchMode(true); 266 | scaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); 267 | 268 | if (thumbShadow) { 269 | // We need to remove hardware acceleration in order to blur the shadow 270 | setLayerType(LAYER_TYPE_SOFTWARE, null); 271 | shadowPaint.setColor(thumbShadowColor); 272 | shadowPaint.setMaskFilter(new BlurMaskFilter(thumbShadowBlur, BlurMaskFilter.Blur.NORMAL)); 273 | thumbShadowPath = new Path(); 274 | thumbShadowPath.addCircle(0, 275 | 0, 276 | thumbHalfHeight, 277 | Path.Direction.CW); 278 | } 279 | } 280 | 281 | public void setRangeValues(T minValue, T maxValue) { 282 | this.absoluteMinValue = minValue; 283 | this.absoluteMaxValue = maxValue; 284 | setValuePrimAndNumberType(); 285 | } 286 | 287 | public void setRangeValues(T minValue, T maxValue, T step) { 288 | this.absoluteStepValue = step; 289 | setRangeValues(minValue, maxValue); 290 | } 291 | 292 | public void setTextAboveThumbsColor(int textAboveThumbsColor) { 293 | this.textAboveThumbsColor = textAboveThumbsColor; 294 | invalidate(); 295 | } 296 | 297 | public void setTextAboveThumbsColorResource(@ColorRes int resId) { 298 | setTextAboveThumbsColor(getResources().getColor(resId)); 299 | } 300 | 301 | @SuppressWarnings("unchecked") 302 | // only used to set default values when initialised from XML without any values specified 303 | private void setRangeToDefaultValues() { 304 | this.absoluteMinValue = (T) DEFAULT_MINIMUM; 305 | this.absoluteMaxValue = (T) DEFAULT_MAXIMUM; 306 | this.absoluteStepValue = (T) DEFAULT_STEP; 307 | setValuePrimAndNumberType(); 308 | } 309 | 310 | private void setValuePrimAndNumberType() { 311 | absoluteMinValuePrim = absoluteMinValue.doubleValue(); 312 | absoluteMaxValuePrim = absoluteMaxValue.doubleValue(); 313 | absoluteStepValuePrim = absoluteStepValue.doubleValue(); 314 | numberType = NumberType.fromNumber(absoluteMinValue); 315 | } 316 | 317 | @SuppressWarnings("unused") 318 | public void resetSelectedValues() { 319 | setSelectedMinValue(absoluteMinValue); 320 | setSelectedMaxValue(absoluteMaxValue); 321 | } 322 | 323 | @SuppressWarnings("unused") 324 | public boolean isNotifyWhileDragging() { 325 | return notifyWhileDragging; 326 | } 327 | 328 | /** 329 | * Should the widget notify the listener callback while the user is still dragging a thumb? Default is false. 330 | */ 331 | @SuppressWarnings("unused") 332 | public void setNotifyWhileDragging(boolean flag) { 333 | this.notifyWhileDragging = flag; 334 | } 335 | 336 | /** 337 | * Returns the absolute minimum value of the range that has been set at construction time. 338 | * 339 | * @return The absolute minimum value of the range. 340 | */ 341 | public T getAbsoluteMinValue() { 342 | return absoluteMinValue; 343 | } 344 | 345 | /** 346 | * Returns the absolute maximum value of the range that has been set at construction time. 347 | * 348 | * @return The absolute maximum value of the range. 349 | */ 350 | public T getAbsoluteMaxValue() { 351 | return absoluteMaxValue; 352 | } 353 | 354 | /** 355 | * Round off value using the {@link #absoluteStepValue} 356 | * @param value to be rounded off 357 | * @return rounded off value 358 | */ 359 | @SuppressWarnings("unchecked") 360 | private T roundOffValueToStep(T value) { 361 | double d = Math.round(value.doubleValue() / absoluteStepValuePrim) * absoluteStepValuePrim; 362 | return (T) numberType.toNumber(Math.max(absoluteMinValuePrim, Math.min(absoluteMaxValuePrim, d))); 363 | } 364 | 365 | /** 366 | * Returns the currently selected min value. 367 | * 368 | * @return The currently selected min value. 369 | */ 370 | public T getSelectedMinValue() { 371 | return roundOffValueToStep(normalizedToValue(normalizedMinValue)); 372 | } 373 | 374 | public boolean isDragging() { 375 | return isDragging; 376 | } 377 | 378 | /** 379 | * Sets the currently selected minimum value. The widget will be invalidated and redrawn. 380 | * 381 | * @param value The Number value to set the minimum value to. Will be clamped to given absolute minimum/maximum range. 382 | */ 383 | public void setSelectedMinValue(T value) { 384 | // in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing. 385 | if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) { 386 | setNormalizedMinValue(0d); 387 | } else { 388 | setNormalizedMinValue(valueToNormalized(value)); 389 | } 390 | } 391 | 392 | /** 393 | * Returns the currently selected max value. 394 | * 395 | * @return The currently selected max value. 396 | */ 397 | public T getSelectedMaxValue() { 398 | return roundOffValueToStep(normalizedToValue(normalizedMaxValue)); 399 | } 400 | 401 | /** 402 | * Sets the currently selected maximum value. The widget will be invalidated and redrawn. 403 | * 404 | * @param value The Number value to set the maximum value to. Will be clamped to given absolute minimum/maximum range. 405 | */ 406 | public void setSelectedMaxValue(T value) { 407 | // in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing. 408 | if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) { 409 | setNormalizedMaxValue(1d); 410 | } else { 411 | setNormalizedMaxValue(valueToNormalized(value)); 412 | } 413 | } 414 | 415 | /** 416 | * Registers given listener callback to notify about changed selected values. 417 | * 418 | * @param listener The listener to notify about changed selected values. 419 | */ 420 | @SuppressWarnings("unused") 421 | public void setOnRangeSeekBarChangeListener(OnRangeSeekBarChangeListener listener) { 422 | this.listener = listener; 423 | } 424 | 425 | /** 426 | * Set the path that defines the shadow of the thumb. This path should be defined assuming 427 | * that the center of the shadow is at the top left corner (0,0) of the canvas. The 428 | * {@link #drawThumbShadow(float, Canvas)} method will place the shadow appropriately. 429 | * 430 | * @param thumbShadowPath The path defining the thumb shadow 431 | */ 432 | @SuppressWarnings("unused") 433 | public void setThumbShadowPath(Path thumbShadowPath) { 434 | this.thumbShadowPath = thumbShadowPath; 435 | } 436 | 437 | /** 438 | * Handles thumb selection and movement. Notifies listener callback on certain events. 439 | */ 440 | @Override 441 | public boolean onTouchEvent(@NonNull MotionEvent event) { 442 | 443 | if (!isEnabled()) { 444 | return false; 445 | } 446 | 447 | int pointerIndex; 448 | 449 | final int action = event.getAction(); 450 | switch (action & MotionEvent.ACTION_MASK) { 451 | 452 | case MotionEvent.ACTION_DOWN: 453 | // Remember where the motion event started 454 | activePointerId = event.getPointerId(event.getPointerCount() - 1); 455 | pointerIndex = event.findPointerIndex(activePointerId); 456 | downMotionX = event.getX(pointerIndex); 457 | 458 | pressedThumb = evalPressedThumb(downMotionX); 459 | 460 | // Only handle thumb presses. 461 | if (pressedThumb == null) { 462 | return super.onTouchEvent(event); 463 | } 464 | 465 | setPressed(true); 466 | invalidate(); 467 | onStartTrackingTouch(); 468 | trackTouchEvent(event); 469 | attemptClaimDrag(); 470 | 471 | break; 472 | case MotionEvent.ACTION_MOVE: 473 | if (pressedThumb != null) { 474 | 475 | if (isDragging) { 476 | trackTouchEvent(event); 477 | } else { 478 | // Scroll to follow the motion event 479 | pointerIndex = event.findPointerIndex(activePointerId); 480 | final float x = event.getX(pointerIndex); 481 | 482 | if (Math.abs(x - downMotionX) > scaledTouchSlop) { 483 | setPressed(true); 484 | invalidate(); 485 | onStartTrackingTouch(); 486 | trackTouchEvent(event); 487 | attemptClaimDrag(); 488 | } 489 | } 490 | 491 | if (notifyWhileDragging && listener != null) { 492 | listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue()); 493 | } 494 | } 495 | break; 496 | case MotionEvent.ACTION_UP: 497 | if (isDragging) { 498 | trackTouchEvent(event); 499 | onStopTrackingTouch(); 500 | setPressed(false); 501 | } else { 502 | // Touch up when we never crossed the touch slop threshold 503 | // should be interpreted as a tap-seek to that location. 504 | onStartTrackingTouch(); 505 | trackTouchEvent(event); 506 | onStopTrackingTouch(); 507 | } 508 | 509 | pressedThumb = null; 510 | invalidate(); 511 | if (listener != null) { 512 | listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue()); 513 | } 514 | break; 515 | case MotionEvent.ACTION_POINTER_DOWN: { 516 | final int index = event.getPointerCount() - 1; 517 | // final int index = ev.getActionIndex(); 518 | downMotionX = event.getX(index); 519 | activePointerId = event.getPointerId(index); 520 | invalidate(); 521 | break; 522 | } 523 | case MotionEvent.ACTION_POINTER_UP: 524 | onSecondaryPointerUp(event); 525 | invalidate(); 526 | break; 527 | case MotionEvent.ACTION_CANCEL: 528 | if (isDragging) { 529 | onStopTrackingTouch(); 530 | setPressed(false); 531 | } 532 | invalidate(); // see above explanation 533 | break; 534 | } 535 | return true; 536 | } 537 | 538 | private void onSecondaryPointerUp(MotionEvent ev) { 539 | final int pointerIndex = (ev.getAction() & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT; 540 | 541 | final int pointerId = ev.getPointerId(pointerIndex); 542 | if (pointerId == activePointerId) { 543 | // This was our active pointer going up. Choose 544 | // a new active pointer and adjust accordingly. 545 | // TODO: Make this decision more intelligent. 546 | final int newPointerIndex = pointerIndex == 0 ? 1 : 0; 547 | downMotionX = ev.getX(newPointerIndex); 548 | activePointerId = ev.getPointerId(newPointerIndex); 549 | } 550 | } 551 | 552 | private void trackTouchEvent(MotionEvent event) { 553 | final int pointerIndex = event.findPointerIndex(activePointerId); 554 | final float x = event.getX(pointerIndex); 555 | 556 | if (Thumb.MIN.equals(pressedThumb) && !singleThumb) { 557 | setNormalizedMinValue(screenToNormalized(x)); 558 | } else if (Thumb.MAX.equals(pressedThumb)) { 559 | setNormalizedMaxValue(screenToNormalized(x)); 560 | } 561 | } 562 | 563 | /** 564 | * Tries to claim the user's drag motion, and requests disallowing any ancestors from stealing events in the drag. 565 | */ 566 | private void attemptClaimDrag() { 567 | if (getParent() != null) { 568 | getParent().requestDisallowInterceptTouchEvent(true); 569 | } 570 | } 571 | 572 | /** 573 | * This is called when the user has started touching this widget. 574 | */ 575 | void onStartTrackingTouch() { 576 | isDragging = true; 577 | } 578 | 579 | /** 580 | * This is called when the user either releases his touch or the touch is canceled. 581 | */ 582 | void onStopTrackingTouch() { 583 | isDragging = false; 584 | } 585 | 586 | /** 587 | * Ensures correct size of the widget. 588 | */ 589 | @Override 590 | protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 591 | int width = 200; 592 | if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) { 593 | width = MeasureSpec.getSize(widthMeasureSpec); 594 | } 595 | 596 | int height = thumbImage.getHeight() 597 | + (!showTextAboveThumbs ? 0 : PixelUtil.dpToPx(getContext(), HEIGHT_IN_DP)) 598 | + (thumbShadow ? thumbShadowYOffset + thumbShadowBlur : 0); 599 | if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(heightMeasureSpec)) { 600 | height = Math.min(height, MeasureSpec.getSize(heightMeasureSpec)); 601 | } 602 | setMeasuredDimension(width, height); 603 | } 604 | 605 | /** 606 | * Draws the widget on the given canvas. 607 | */ 608 | @Override 609 | protected synchronized void onDraw(@NonNull Canvas canvas) { 610 | super.onDraw(canvas); 611 | 612 | paint.setTextSize(textSize); 613 | paint.setStyle(Style.FILL); 614 | paint.setColor(defaultColor); 615 | paint.setAntiAlias(true); 616 | float minMaxLabelSize = 0; 617 | 618 | if (showLabels) { 619 | // draw min and max labels 620 | String minLabel = getContext().getString(R.string.demo_min_label); 621 | String maxLabel = getContext().getString(R.string.demo_max_label); 622 | minMaxLabelSize = Math.max(paint.measureText(minLabel), paint.measureText(maxLabel)); 623 | float minMaxHeight = textOffset + thumbHalfHeight + textSize / 3; 624 | canvas.drawText(minLabel, 0, minMaxHeight, paint); 625 | canvas.drawText(maxLabel, getWidth() - minMaxLabelSize, minMaxHeight, paint); 626 | } 627 | padding = internalPad + minMaxLabelSize + thumbHalfWidth; 628 | 629 | // draw seek bar background line 630 | rect.left = padding; 631 | rect.right = getWidth() - padding; 632 | canvas.drawRect(rect, paint); 633 | 634 | boolean selectedValuesAreDefault = (normalizedMinValue <= minDeltaForDefault && normalizedMaxValue >= 1 - minDeltaForDefault); 635 | 636 | int colorToUseForButtonsAndHighlightedLine = !alwaysActive && !activateOnDefaultValues && selectedValuesAreDefault ? 637 | defaultColor : // default values 638 | activeColor; // non default, filter is active 639 | 640 | // draw seek bar active range line 641 | rect.left = normalizedToScreen(normalizedMinValue); 642 | rect.right = normalizedToScreen(normalizedMaxValue); 643 | 644 | paint.setColor(colorToUseForButtonsAndHighlightedLine); 645 | canvas.drawRect(rect, paint); 646 | 647 | // draw minimum thumb (& shadow if requested) if not a single thumb control 648 | if (!singleThumb) { 649 | if (thumbShadow) { 650 | drawThumbShadow(normalizedToScreen(normalizedMinValue), canvas); 651 | } 652 | drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas, 653 | selectedValuesAreDefault); 654 | } 655 | 656 | // draw maximum thumb & shadow (if necessary) 657 | if (thumbShadow) { 658 | drawThumbShadow(normalizedToScreen(normalizedMaxValue), canvas); 659 | } 660 | drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas, 661 | selectedValuesAreDefault); 662 | 663 | // draw the text if sliders have moved from default edges 664 | if (showTextAboveThumbs && (activateOnDefaultValues || !selectedValuesAreDefault)) { 665 | paint.setTextSize(textSize); 666 | paint.setColor(textAboveThumbsColor); 667 | 668 | String minText = valueToString(getSelectedMinValue()); 669 | String maxText = valueToString(getSelectedMaxValue()); 670 | float minTextWidth = paint.measureText(minText); 671 | float maxTextWidth = paint.measureText(maxText); 672 | // keep the position so that the labels don't get cut off 673 | float minPosition = Math.max(0f, normalizedToScreen(normalizedMinValue) - minTextWidth * 0.5f); 674 | float maxPosition = Math.min(getWidth() - maxTextWidth, normalizedToScreen(normalizedMaxValue) - maxTextWidth * 0.5f); 675 | 676 | if (!singleThumb) { 677 | // check if the labels overlap, or are too close to each other 678 | int spacing = PixelUtil.dpToPx(getContext(), TEXT_LATERAL_PADDING_IN_DP); 679 | float overlap = minPosition + minTextWidth - maxPosition + spacing; 680 | if (overlap > 0f) { 681 | // we could move them the same ("overlap * 0.5f") 682 | // but we rather move more the one which is farther from the ends, as it has more space 683 | minPosition -= overlap * normalizedMinValue / (normalizedMinValue + 1-normalizedMaxValue); 684 | maxPosition += overlap * (1-normalizedMaxValue) / (normalizedMinValue + 1-normalizedMaxValue); 685 | } 686 | canvas.drawText(minText, 687 | minPosition, 688 | distanceToTop + textSize, 689 | paint); 690 | 691 | } 692 | 693 | canvas.drawText(maxText, 694 | maxPosition, 695 | distanceToTop + textSize, 696 | paint); 697 | } 698 | 699 | } 700 | 701 | protected String valueToString(T value) { 702 | return String.valueOf(value); 703 | } 704 | 705 | /** 706 | * Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved. 707 | */ 708 | @Override 709 | protected Parcelable onSaveInstanceState() { 710 | final Bundle bundle = new Bundle(); 711 | bundle.putParcelable("SUPER", super.onSaveInstanceState()); 712 | bundle.putDouble("MIN", normalizedMinValue); 713 | bundle.putDouble("MAX", normalizedMaxValue); 714 | return bundle; 715 | } 716 | 717 | /** 718 | * Overridden to restore instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. 719 | */ 720 | @Override 721 | protected void onRestoreInstanceState(Parcelable parcel) { 722 | final Bundle bundle = (Bundle) parcel; 723 | super.onRestoreInstanceState(bundle.getParcelable("SUPER")); 724 | normalizedMinValue = bundle.getDouble("MIN"); 725 | normalizedMaxValue = bundle.getDouble("MAX"); 726 | } 727 | 728 | /** 729 | * Draws the "normal" resp. "pressed" thumb image on specified x-coordinate. 730 | * 731 | * @param screenCoord The x-coordinate in screen space where to draw the image. 732 | * @param pressed Is the thumb currently in "pressed" state? 733 | * @param canvas The canvas to draw upon. 734 | */ 735 | private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) { 736 | Bitmap buttonToDraw; 737 | if (!activateOnDefaultValues && areSelectedValuesDefault) { 738 | buttonToDraw = thumbDisabledImage; 739 | } else { 740 | buttonToDraw = pressed ? thumbPressedImage : thumbImage; 741 | } 742 | 743 | canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth, 744 | textOffset, 745 | paint); 746 | } 747 | 748 | /** 749 | * Draws a drop shadow beneath the slider thumb. 750 | * 751 | * @param screenCoord the x-coordinate of the slider thumb 752 | * @param canvas the canvas on which to draw the shadow 753 | */ 754 | private void drawThumbShadow(float screenCoord, Canvas canvas) { 755 | thumbShadowMatrix.setTranslate(screenCoord + thumbShadowXOffset, textOffset + thumbHalfHeight + thumbShadowYOffset); 756 | translatedThumbShadowPath.set(thumbShadowPath); 757 | translatedThumbShadowPath.transform(thumbShadowMatrix); 758 | canvas.drawPath(translatedThumbShadowPath, shadowPaint); 759 | } 760 | 761 | /** 762 | * Decides which (if any) thumb is touched by the given x-coordinate. 763 | * 764 | * @param touchX The x-coordinate of a touch event in screen space. 765 | * @return The pressed thumb or null if none has been touched. 766 | */ 767 | private Thumb evalPressedThumb(float touchX) { 768 | Thumb result = null; 769 | boolean minThumbPressed = isInThumbRange(touchX, normalizedMinValue); 770 | boolean maxThumbPressed = isInThumbRange(touchX, normalizedMaxValue); 771 | if (minThumbPressed && maxThumbPressed) { 772 | // if both thumbs are pressed (they lie on top of each other), choose the one with more room to drag. this avoids "stalling" the thumbs in a corner, not being able to drag them apart anymore. 773 | result = (touchX / getWidth() > 0.5f) ? Thumb.MIN : Thumb.MAX; 774 | } else if (minThumbPressed) { 775 | result = Thumb.MIN; 776 | } else if (maxThumbPressed) { 777 | result = Thumb.MAX; 778 | } 779 | return result; 780 | } 781 | 782 | /** 783 | * Decides if given x-coordinate in screen space needs to be interpreted as "within" the normalized thumb x-coordinate. 784 | * 785 | * @param touchX The x-coordinate in screen space to check. 786 | * @param normalizedThumbValue The normalized x-coordinate of the thumb to check. 787 | * @return true if x-coordinate is in thumb range, false otherwise. 788 | */ 789 | private boolean isInThumbRange(float touchX, double normalizedThumbValue) { 790 | return Math.abs(touchX - normalizedToScreen(normalizedThumbValue)) <= thumbHalfWidth; 791 | } 792 | 793 | /** 794 | * Sets normalized min value to value so that 0 <= value <= normalized max value <= 1. The View will get invalidated when calling this method. 795 | * 796 | * @param value The new normalized min value to set. 797 | */ 798 | private void setNormalizedMinValue(double value) { 799 | normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue))); 800 | invalidate(); 801 | } 802 | 803 | /** 804 | * Sets normalized max value to value so that 0 <= normalized min value <= value <= 1. The View will get invalidated when calling this method. 805 | * 806 | * @param value The new normalized max value to set. 807 | */ 808 | private void setNormalizedMaxValue(double value) { 809 | normalizedMaxValue = Math.max(0d, Math.min(1d, Math.max(value, normalizedMinValue))); 810 | invalidate(); 811 | } 812 | 813 | /** 814 | * Converts a normalized value to a Number object in the value space between absolute minimum and maximum. 815 | */ 816 | @SuppressWarnings("unchecked") 817 | protected T normalizedToValue(double normalized) { 818 | double v = absoluteMinValuePrim + normalized * (absoluteMaxValuePrim - absoluteMinValuePrim); 819 | // TODO parameterize this rounding to allow variable decimal points 820 | return (T) numberType.toNumber(Math.round(v * 100) / 100d); 821 | } 822 | 823 | /** 824 | * Converts the given Number value to a normalized double. 825 | * 826 | * @param value The Number value to normalize. 827 | * @return The normalized double. 828 | */ 829 | protected double valueToNormalized(T value) { 830 | if (0 == absoluteMaxValuePrim - absoluteMinValuePrim) { 831 | // prevent division by zero, simply return 0. 832 | return 0d; 833 | } 834 | return (value.doubleValue() - absoluteMinValuePrim) / (absoluteMaxValuePrim - absoluteMinValuePrim); 835 | } 836 | 837 | /** 838 | * Converts a normalized value into screen space. 839 | * 840 | * @param normalizedCoord The normalized value to convert. 841 | * @return The converted value in screen space. 842 | */ 843 | private float normalizedToScreen(double normalizedCoord) { 844 | return (float) (padding + normalizedCoord * (getWidth() - 2 * padding)); 845 | } 846 | 847 | /** 848 | * Converts screen space x-coordinates into normalized values. 849 | * 850 | * @param screenCoord The x-coordinate in screen space to convert. 851 | * @return The normalized value. 852 | */ 853 | private double screenToNormalized(float screenCoord) { 854 | int width = getWidth(); 855 | if (width <= 2 * padding) { 856 | // prevent division by zero, simply return 0. 857 | return 0d; 858 | } else { 859 | double result = (screenCoord - padding) / (width - 2 * padding); 860 | return Math.min(1d, Math.max(0d, result)); 861 | } 862 | } 863 | 864 | /** 865 | * Thumb constants (min and max). 866 | */ 867 | private enum Thumb { 868 | MIN, MAX 869 | } 870 | 871 | /** 872 | * Utility enumeration used to convert between Numbers and doubles. 873 | * 874 | * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de) 875 | */ 876 | protected enum NumberType { 877 | LONG, DOUBLE, INTEGER, FLOAT, SHORT, BYTE, BIG_DECIMAL; 878 | 879 | public static NumberType fromNumber(E value) throws IllegalArgumentException { 880 | if (value instanceof Long) { 881 | return LONG; 882 | } 883 | if (value instanceof Double) { 884 | return DOUBLE; 885 | } 886 | if (value instanceof Integer) { 887 | return INTEGER; 888 | } 889 | if (value instanceof Float) { 890 | return FLOAT; 891 | } 892 | if (value instanceof Short) { 893 | return SHORT; 894 | } 895 | if (value instanceof Byte) { 896 | return BYTE; 897 | } 898 | if (value instanceof BigDecimal) { 899 | return BIG_DECIMAL; 900 | } 901 | throw new IllegalArgumentException("Number class '" + value.getClass().getName() + "' is not supported"); 902 | } 903 | 904 | public Number toNumber(double value) { 905 | switch (this) { 906 | case LONG: 907 | return (long) value; 908 | case DOUBLE: 909 | return value; 910 | case INTEGER: 911 | return (int) value; 912 | case FLOAT: 913 | return (float) value; 914 | case SHORT: 915 | return (short) value; 916 | case BYTE: 917 | return (byte) value; 918 | case BIG_DECIMAL: 919 | return BigDecimal.valueOf(value); 920 | } 921 | throw new InstantiationError("can't convert " + this + " to a Number object"); 922 | } 923 | } 924 | 925 | /** 926 | * Callback listener interface to notify about changed range values. 927 | * 928 | * @param The Number type the RangeSeekBar has been declared with. 929 | * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de) 930 | */ 931 | public interface OnRangeSeekBarChangeListener { 932 | 933 | void onRangeSeekBarValuesChanged(RangeSeekBar bar, T minValue, T maxValue); 934 | } 935 | 936 | } 937 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/java/org/florescu/android/util/BitmapUtil.java: -------------------------------------------------------------------------------- 1 | package org.florescu.android.util; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.drawable.BitmapDrawable; 6 | import android.graphics.drawable.Drawable; 7 | 8 | public class BitmapUtil { 9 | public static Bitmap drawableToBitmap(Drawable drawable) { 10 | if (drawable instanceof BitmapDrawable) { 11 | return ((BitmapDrawable) drawable).getBitmap(); 12 | } 13 | 14 | // We ask for the bounds if they have been set as they would be most 15 | // correct, then we check we are > 0 16 | final int width = !drawable.getBounds().isEmpty() ? 17 | drawable.getBounds().width() : drawable.getIntrinsicWidth(); 18 | 19 | final int height = !drawable.getBounds().isEmpty() ? 20 | drawable.getBounds().height() : drawable.getIntrinsicHeight(); 21 | 22 | // Now we check we are > 0 23 | final Bitmap bitmap = Bitmap.createBitmap(width <= 0 ? 1 : width, height <= 0 ? 1 : height, 24 | Bitmap.Config.ARGB_8888); 25 | Canvas canvas = new Canvas(bitmap); 26 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 27 | drawable.draw(canvas); 28 | 29 | return bitmap; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/java/org/florescu/android/util/PixelUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Alex Florescu 3 | Copyright 2014 Yahoo Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package org.florescu.android.util; 19 | 20 | import android.content.Context; 21 | import android.util.DisplayMetrics; 22 | 23 | /** 24 | * Util class for converting between dp, px and other magical pixel units 25 | */ 26 | public class PixelUtil { 27 | 28 | private PixelUtil() { 29 | } 30 | 31 | public static int dpToPx(Context context, int dp) { 32 | int px = Math.round(dp * getPixelScaleFactor(context)); 33 | return px; 34 | } 35 | 36 | public static int pxToDp(Context context, int px) { 37 | int dp = Math.round(px / getPixelScaleFactor(context)); 38 | return dp; 39 | } 40 | 41 | private static float getPixelScaleFactor(Context context) { 42 | DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); 43 | return (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_disabled.png -------------------------------------------------------------------------------- /rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_normal.png -------------------------------------------------------------------------------- /rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anothem/android-range-seek-bar/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/res/drawable-xhdpi/seek_thumb_pressed.png -------------------------------------------------------------------------------- /rangeseekbar/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /rangeseekbar/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | RangeSeekBar Demo 4 | Min 5 | Max 6 | 7 | -------------------------------------------------------------------------------- /rangeseekbar/src/test/java/org/florescu/android/rangeseekbar/RangeSeekBarTest.java: -------------------------------------------------------------------------------- 1 | package org.florescu.android.rangeseekbar; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.robolectric.RobolectricGradleTestRunner; 7 | import org.robolectric.RuntimeEnvironment; 8 | import org.robolectric.annotation.Config; 9 | 10 | @RunWith(RobolectricGradleTestRunner.class) 11 | @Config(constants = BuildConfig.class, sdk = 21) 12 | public class RangeSeekBarTest { 13 | 14 | @Test 15 | public void rsb_should_handle_long_values() { 16 | RangeSeekBar mSeekBar = new RangeSeekBar<>(RuntimeEnvironment.application); 17 | // Set up the seek bar 18 | mSeekBar.setRangeValues(0L, 100L); 19 | long minValue = mSeekBar.getAbsoluteMinValue(); 20 | Assert.assertEquals(0L, minValue); 21 | long maxValue = mSeekBar.getAbsoluteMaxValue(); 22 | Assert.assertEquals(100L, maxValue); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':rangeseekbar-sample', ':rangeseekbar' 2 | --------------------------------------------------------------------------------