├── sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── 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 │ │ ├── drawable-hdpi │ │ │ ├── ic_settings_purple.png │ │ │ ├── ic_settings_grey600_24dp.png │ │ │ ├── ic_settings_white_24dp.png │ │ │ ├── ic_chevron_double_right_pink.png │ │ │ ├── ic_chevron_double_right_purple.png │ │ │ ├── ic_chevron_double_right_white_24dp.png │ │ │ └── ic_chevron_double_right_grey600_24dp.png │ │ ├── drawable-mdpi │ │ │ ├── ic_settings_purple.png │ │ │ ├── ic_settings_grey600_24dp.png │ │ │ ├── ic_settings_white_24dp.png │ │ │ ├── ic_chevron_double_right_pink.png │ │ │ ├── ic_chevron_double_right_purple.png │ │ │ ├── ic_chevron_double_right_white_24dp.png │ │ │ └── ic_chevron_double_right_grey600_24dp.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_settings_purple.png │ │ │ ├── ic_settings_white_24dp.png │ │ │ ├── ic_settings_grey600_24dp.png │ │ │ ├── ic_chevron_double_right_pink.png │ │ │ ├── ic_chevron_double_right_purple.png │ │ │ ├── ic_chevron_double_right_white_24dp.png │ │ │ └── ic_chevron_double_right_grey600_24dp.png │ │ ├── drawable-xxhdpi │ │ │ ├── ic_settings_purple.png │ │ │ ├── ic_settings_white_24dp.png │ │ │ ├── ic_settings_grey600_24dp.png │ │ │ ├── ic_chevron_double_right_pink.png │ │ │ ├── ic_chevron_double_right_purple.png │ │ │ ├── ic_chevron_double_right_white_24dp.png │ │ │ └── ic_chevron_double_right_grey600_24dp.png │ │ ├── drawable-xxxhdpi │ │ │ ├── ic_settings_purple.png │ │ │ ├── ic_settings_white_24dp.png │ │ │ ├── ic_settings_grey600_24dp.png │ │ │ ├── ic_chevron_double_right_pink.png │ │ │ ├── ic_chevron_double_right_purple.png │ │ │ ├── ic_chevron_double_right_grey600_24dp.png │ │ │ └── ic_chevron_double_right_white_24dp.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── color │ │ │ └── slide_button_bg_selector.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── ng │ │ └── max │ │ └── slideview │ │ └── sample │ │ └── MainActivity.java ├── proguard-rules.pro └── build.gradle ├── slideview ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── sv_ic_chevron_double_right.png │ │ │ └── sv_ic_chevron_double_right_white.png │ │ ├── drawable-mdpi │ │ │ ├── sv_ic_chevron_double_right.png │ │ │ └── sv_ic_chevron_double_right_white.png │ │ ├── drawable-xhdpi │ │ │ ├── sv_ic_chevron_double_right.png │ │ │ └── sv_ic_chevron_double_right_white.png │ │ ├── drawable-xxhdpi │ │ │ ├── sv_ic_chevron_double_right.png │ │ │ └── sv_ic_chevron_double_right_white.png │ │ ├── drawable-xxxhdpi │ │ │ ├── sv_ic_chevron_double_right.png │ │ │ └── sv_ic_chevron_double_right_white.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── attrs.xml │ │ ├── drawable │ │ │ ├── sv_view_bg.xml │ │ │ └── sv_thumb.xml │ │ └── layout │ │ │ └── sv_slide_view.xml │ │ └── java │ │ └── ng │ │ └── max │ │ └── slideview │ │ ├── Util.java │ │ ├── Slider.java │ │ └── SlideView.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── art ├── screenshot_1.png └── screenshot_2.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── circle.yml ├── gradle.properties ├── CHANGELOG.md ├── LICENSE.txt ├── gradlew.bat ├── gradlew └── README.md /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /slideview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':slideview' 2 | -------------------------------------------------------------------------------- /art/screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/art/screenshot_1.png -------------------------------------------------------------------------------- /art/screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/art/screenshot_2.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /slideview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_settings_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_settings_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_settings_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_settings_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_settings_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_settings_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_settings_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_settings_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_settings_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_settings_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | .idea 11 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_chevron_double_right_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_chevron_double_right_pink.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_chevron_double_right_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_chevron_double_right_pink.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_pink.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-hdpi/sv_ic_chevron_double_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-hdpi/sv_ic_chevron_double_right.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-mdpi/sv_ic_chevron_double_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-mdpi/sv_ic_chevron_double_right.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_chevron_double_right_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_chevron_double_right_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_chevron_double_right_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_chevron_double_right_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_pink.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_pink.png -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SlideView Sample 3 | Slide to disable 4 | 5 | -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xhdpi/sv_ic_chevron_double_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xhdpi/sv_ic_chevron_double_right.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xxhdpi/sv_ic_chevron_double_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xxhdpi/sv_ic_chevron_double_right.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_chevron_double_right_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_chevron_double_right_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_chevron_double_right_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_chevron_double_right_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_purple.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_purple.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xxxhdpi/sv_ic_chevron_double_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xxxhdpi/sv_ic_chevron_double_right.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-hdpi/ic_chevron_double_right_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-hdpi/ic_chevron_double_right_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-mdpi/ic_chevron_double_right_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-mdpi/ic_chevron_double_right_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_white_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_white_24dp.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-hdpi/sv_ic_chevron_double_right_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-hdpi/sv_ic_chevron_double_right_white.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-mdpi/sv_ic_chevron_double_right_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-mdpi/sv_ic_chevron_double_right_white.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xhdpi/sv_ic_chevron_double_right_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xhdpi/sv_ic_chevron_double_right_white.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xhdpi/ic_chevron_double_right_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxhdpi/ic_chevron_double_right_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_grey600_24dp.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/sample/src/main/res/drawable-xxxhdpi/ic_chevron_double_right_white_24dp.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xxhdpi/sv_ic_chevron_double_right_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xxhdpi/sv_ic_chevron_double_right_white.png -------------------------------------------------------------------------------- /slideview/src/main/res/drawable-xxxhdpi/sv_ic_chevron_double_right_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MAXDeliveryNG/slideview/HEAD/slideview/src/main/res/drawable-xxxhdpi/sv_ic_chevron_double_right_white.png -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 15 22:01:37 WAT 2017 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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /slideview/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #FFFFFF 5 | #FFFFFF 6 | -------------------------------------------------------------------------------- /sample/src/main/res/color/slide_button_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /slideview/src/main/res/drawable/sv_view_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 15 | 16 | 17 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | general: 2 | artifacts: 3 | - /home/ubuntu/your-app-name/app/build/outputs/apk/ 4 | 5 | machine: 6 | java: 7 | version: oraclejdk8 8 | environment: 9 | ANDROID_HOME: /usr/local/android-sdk-linux 10 | 11 | dependencies: 12 | override: 13 | - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-26.0.2,android-26,extra-google-m2repository,extra-android-support 14 | - chmod +x gradlew 15 | - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies 16 | 17 | test: 18 | override: 19 | - (./gradlew assemble): 20 | timeout: 360 21 | -------------------------------------------------------------------------------- /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:\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 | -------------------------------------------------------------------------------- /slideview/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:\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 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /slideview/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /slideview/src/main/res/drawable/sv_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion rootProject.compileSdkVersion 5 | buildToolsVersion rootProject.buildToolsVersion 6 | 7 | defaultConfig { 8 | applicationId "ng.max.slideview.sample" 9 | minSdkVersion rootProject.minSdkVersion 10 | targetSdkVersion rootProject.targetSdkVersion 11 | versionCode rootProject.versionCode 12 | versionName rootProject.versionName 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation "com.android.support:appcompat-v7:$supportLibraryVersion" 25 | implementation project(':slideview') 26 | } 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | Version 1.0.0 *(2017-02-16)* 5 | ---------------------------- 6 | 7 | - Initial release. 8 | 9 | 10 | Version 1.0.1 *(2017-07-02)* 11 | ---------------------------- 12 | 13 | - Add "slideTextSize" attribute for setting SlideView's text size. 14 | - Add a getter for the TextView. This is useful if you want to further customize the text. 15 | 16 | 17 | Version 1.0.2 *(2017-09-19)* 18 | ---------------------------- 19 | 20 | - Fix issue where SlideView's parent view intercepts touch events. 21 | 22 | Version 1.1.0 *(2017-11-24)* 23 | ---------------------------- 24 | 25 | - Add "sv_" prefix to all library attributes to avoid conflicting with attributes in other libraries or attributes defined by users. 26 | - The internal Slider now extends "AppCompatSeekBar" instead of "SeekBar" 27 | - Update internal dependencies. -------------------------------------------------------------------------------- /slideview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group = 'com.github.MAXDeliveryNG' 5 | 6 | android { 7 | compileSdkVersion rootProject.compileSdkVersion 8 | buildToolsVersion rootProject.buildToolsVersion 9 | 10 | defaultConfig { 11 | minSdkVersion rootProject.minSdkVersion 12 | targetSdkVersion rootProject.targetSdkVersion 13 | versionCode rootProject.versionCode 14 | versionName rootProject.versionName 15 | 16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 17 | 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | implementation "com.android.support:appcompat-v7:$supportLibraryVersion" 29 | } 30 | -------------------------------------------------------------------------------- /sample/src/main/java/ng/max/slideview/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package ng.max.slideview.sample; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.os.Vibrator; 6 | import android.support.v7.app.AppCompatActivity; 7 | 8 | import ng.max.slideview.SlideView; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | ((SlideView) findViewById(R.id.slider5)).setOnSlideCompleteListener(new SlideView.OnSlideCompleteListener() { 17 | @Override 18 | public void onSlideComplete(SlideView slideView) { 19 | Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); 20 | vibrator.vibrate(100); 21 | slideView.setEnabled(false); 22 | slideView.setText("Disabled"); 23 | } 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 MAXDeliveryNG 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /slideview/src/main/java/ng/max/slideview/Util.java: -------------------------------------------------------------------------------- 1 | package ng.max.slideview; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.ColorDrawable; 5 | import android.graphics.drawable.Drawable; 6 | import android.graphics.drawable.GradientDrawable; 7 | import android.graphics.drawable.ShapeDrawable; 8 | import android.util.TypedValue; 9 | 10 | /** 11 | * @author Kizito Nwose 12 | */ 13 | 14 | class Util { 15 | 16 | static void setDrawableColor(Drawable drawable, int color) { 17 | drawable.mutate(); 18 | if (drawable instanceof ShapeDrawable) { 19 | ShapeDrawable shapeDrawable = (ShapeDrawable) drawable; 20 | shapeDrawable.getPaint().setColor(color); 21 | } else if (drawable instanceof GradientDrawable) { 22 | GradientDrawable gradientDrawable = (GradientDrawable) drawable; 23 | gradientDrawable.setColor(color); 24 | } else if (drawable instanceof ColorDrawable) { 25 | ColorDrawable colorDrawable = (ColorDrawable) drawable; 26 | colorDrawable.setColor(color); 27 | } 28 | 29 | } 30 | 31 | static void setDrawableStroke(Drawable drawable, int color) { 32 | if (drawable instanceof GradientDrawable) { 33 | GradientDrawable gradientDrawable = (GradientDrawable) drawable; 34 | gradientDrawable.mutate(); 35 | gradientDrawable.setStroke(4, color); 36 | } 37 | } 38 | 39 | static float spToPx(int sp, Context context) { 40 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, 41 | context.getResources().getDisplayMetrics()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /slideview/src/main/res/layout/sv_slide_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 24 | 25 | 40 | -------------------------------------------------------------------------------- /slideview/src/main/java/ng/max/slideview/Slider.java: -------------------------------------------------------------------------------- 1 | package ng.max.slideview; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | import android.os.Build; 6 | import android.support.v7.widget.AppCompatSeekBar; 7 | import android.util.AttributeSet; 8 | import android.view.MotionEvent; 9 | 10 | public class Slider extends AppCompatSeekBar { 11 | 12 | private Drawable thumb; 13 | private SlideView.OnSlideCompleteListener listener; 14 | private SlideView slideView; 15 | 16 | public Slider(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | public void setThumb(Drawable thumb) { 22 | this.thumb = thumb; 23 | super.setThumb(thumb); 24 | } 25 | 26 | @Override 27 | public boolean onTouchEvent(MotionEvent event) { 28 | if (event.getAction() == MotionEvent.ACTION_DOWN) { 29 | if (thumb.getBounds().contains((int) event.getX(), (int) event.getY())) { 30 | // This fixes an issue where the parent view (e.g ScrollView) receives 31 | // touch events along with the SlideView 32 | getParent().requestDisallowInterceptTouchEvent(true); 33 | super.onTouchEvent(event); 34 | } else { 35 | return false; 36 | } 37 | } else if (event.getAction() == MotionEvent.ACTION_UP) { 38 | if (getProgress() > 85) { 39 | if (listener != null) listener.onSlideComplete(slideView); 40 | } 41 | getParent().requestDisallowInterceptTouchEvent(false); 42 | setProgress(0); 43 | } else 44 | super.onTouchEvent(event); 45 | 46 | return true; 47 | } 48 | 49 | void setOnSlideCompleteListenerInternal(SlideView.OnSlideCompleteListener listener, SlideView slideView) { 50 | this.listener = listener; 51 | this.slideView = slideView; 52 | } 53 | 54 | @Override 55 | public Drawable getThumb() { 56 | // getThumb method was added in SDK 16 but our minSDK is 14 57 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 58 | return super.getThumb(); 59 | } else { 60 | return thumb; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /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= 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 | 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 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 25 | 26 | 37 | 38 | 48 | 49 | 62 | 63 | 71 | 72 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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="" 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 | # 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SlideView 2 | 3 | A simple, yet awesome sliding button for Android. 4 | 5 | [![CircleCI](https://circleci.com/gh/MAXDeliveryNG/slideview/tree/master.svg?style=svg)](https://circleci.com/gh/MAXDeliveryNG/slideview/tree/master) 6 | [![JitPack](https://jitpack.io/v/MAXDeliveryNG/slideview.svg)](https://jitpack.io/#MAXDeliveryNG/slideview) 7 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SlideView-9C27B0.svg)](https://android-arsenal.com/details/1/5304) 8 | [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/MAXDeliveryNG/slideview/blob/master/LICENSE.txt) 9 | [![Min SDK](https://img.shields.io/badge/Min%20SDK-14-e91e63.svg)](https://developer.android.com/about/versions/android-4.0.html) 10 | 11 | ## Preview 12 | 13 | SlideView SlideView2 14 | 15 | Get the sample apk [here](https://github.com/MAXDeliveryNG/slideview/releases/download/1.0.0/sample.apk/) 16 | 17 | 18 | ## Setup 19 | 20 | ### Gradle 21 | 22 | Add this to your project level `build.gradle`: 23 | 24 | ```groovy 25 | allprojects { 26 | repositories { 27 | jcenter() 28 | maven { url "https://jitpack.io" } 29 | } 30 | } 31 | ``` 32 | 33 | Add this to your app `build.gradle`: 34 | 35 | ```groovy 36 | dependencies { 37 | implementation 'com.github.MAXDeliveryNG:slideview:1.1.0' 38 | } 39 | ``` 40 | 41 | ## Usage 42 | 43 | The SlideView is very easy to use. Just add it to your layout like any other view. 44 | 45 | > From version 1.1.0, all SlideView's attributes are prefixed "sv_", this 46 | is to avoid conflicting with attributes in other libraries or attributes defined by users. 47 | 48 | ##### Via XML 49 | 50 | Here's a basic implementation. 51 | 52 | ```xml 53 | 62 | ``` 63 | 64 | Here's an example with all the view attributes. 65 | 66 | ```xml 67 | 81 | 82 | ``` 83 | 84 | ### Attributes information 85 | 86 | |Attribute name|Description|Default value| 87 | |:-:|:-:|:-:| 88 | |slideBackgroundColor|The slide background color| `#3F51B5` | 89 | |buttonBackgroundColor|The slide button background color| `#FFFFFF`| 90 | |slideTextColor|The color of the slide label |`#FFFFFF`| 91 | |buttonImage|The drawable on the button | double chevron icon | 92 | |slideText|The slide label| `none` | 93 | |slideTextSize|The label's size| 16sp | 94 | |animateSlideText|If `true`, the label fades out while the slide is in progress| `true` | 95 | |strokeColor|If set, a stroke is drawn around the slide background | `none` | 96 | |reverseSlide|If `true`, the SlideView is reversed | `false` | 97 | |buttonImageDisabled| The drawable to be used as the button image when the SlideView is disabled| the default drawable| 98 | 99 | Note: All color attributes can be replaced with a `ColorStateList` so the SlideView can use the appropriate colors for the enabled and disabled states. See the sample module for examples. 100 | 101 | ### Listening for slide actions on the SlideView 102 | 103 | You can set a listener to be notified when the user slides across the SlideView. An example is shown below. 104 | 105 | ```java 106 | SlideView slideView = (SlideView) findViewById(R.id.slideView); 107 | slideView.setOnSlideCompleteListener(new SlideView.OnSlideCompleteListener() { 108 | @Override 109 | public void onSlideComplete(SlideView slideView) { 110 | // vibrate the device 111 | Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); 112 | vibrator.vibrate(100); 113 | 114 | // go to a new activity 115 | startActivity(new Intent(MainActivity.this, NewActivity.class)); 116 | } 117 | }); 118 | 119 | ``` 120 | 121 | 122 | ### Setting the view attributes via code 123 | 124 | For convenience, many of the SlideView attributes can be set via code. 125 | 126 | ```java 127 | // set the label 128 | setText(CharSequence text); 129 | 130 | // set the text size 131 | setTextSize(int size); 132 | 133 | // set the drawable for the button 134 | setButtonImage(Drawable image); 135 | 136 | // set the label color 137 | setTextColor(@ColorInt int color) ; 138 | 139 | // set the label color with a ColorStateList 140 | setTextColor(ColorStateList colors); 141 | 142 | // set the button drawable for disabled state 143 | setButtonImageDisabled(Drawable image); 144 | 145 | // set the button background color 146 | setButtonBackgroundColor(ColorStateList color); 147 | 148 | // set the slide background color 149 | setSlideBackgroundColor(ColorStateList color); 150 | 151 | ``` 152 | 153 | Note: for the methods that take a `ColorStateList`, you can easily use a single color by converting it to a `ColorStateList` with the method `ColorStateList.valueOf(int color);` 154 | 155 | ## Caveat 156 | The view height is currently fixed so you should use `wrap_content` when defining the view height in your layout. 157 | 158 | ## Author 159 | [Kizito Nwose](https://github.com/kizitonwose) 160 | 161 | 162 | ## Contributing 163 | If you find any bugs, please feel free to fix it and send a pull request or [open an issue.](https://github.com/MAXDeliveryNG/slideview/issues) 164 | 165 | ## License 166 | ``` 167 | Copyright (c) 2017 MAXDeliveryNG 168 | 169 | Permission is hereby granted, free of charge, to any person obtaining a copy 170 | of this software and associated documentation files (the "Software"), to deal 171 | in the Software without restriction, including without limitation the rights 172 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 173 | copies of the Software, and to permit persons to whom the Software is 174 | furnished to do so, subject to the following conditions: 175 | 176 | The above copyright notice and this permission notice shall be included in all 177 | copies or substantial portions of the Software. 178 | 179 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 180 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 181 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 182 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 183 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 184 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 185 | SOFTWARE. 186 | ``` 187 | -------------------------------------------------------------------------------- /slideview/src/main/java/ng/max/slideview/SlideView.java: -------------------------------------------------------------------------------- 1 | package ng.max.slideview; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.content.res.TypedArray; 6 | import android.graphics.drawable.Drawable; 7 | import android.graphics.drawable.LayerDrawable; 8 | import android.os.Build; 9 | import android.support.annotation.ColorInt; 10 | import android.support.annotation.RequiresApi; 11 | import android.support.v4.content.ContextCompat; 12 | import android.util.AttributeSet; 13 | import android.util.TypedValue; 14 | import android.widget.RelativeLayout; 15 | import android.widget.SeekBar; 16 | import android.widget.TextView; 17 | 18 | import static ng.max.slideview.Util.spToPx; 19 | 20 | /** 21 | * @author Kizito Nwose 22 | */ 23 | 24 | public class SlideView extends RelativeLayout implements SeekBar.OnSeekBarChangeListener { 25 | 26 | protected Slider slider; 27 | protected Drawable slideBackground; 28 | protected Drawable buttonBackground; 29 | protected Drawable buttonImage; 30 | protected Drawable buttonImageDisabled; 31 | protected TextView slideTextView; 32 | protected LayerDrawable buttonLayers; 33 | protected ColorStateList slideBackgroundColor; 34 | protected ColorStateList buttonBackgroundColor; 35 | protected boolean animateSlideText; 36 | 37 | public SlideView(Context context) { 38 | super(context); 39 | init(null, 0); 40 | } 41 | 42 | public SlideView(Context context, AttributeSet attrs) { 43 | super(context, attrs); 44 | init(attrs, 0); 45 | } 46 | 47 | public SlideView(Context context, AttributeSet attrs, int defStyleAttr) { 48 | super(context, attrs, defStyleAttr); 49 | init(attrs, defStyleAttr); 50 | } 51 | 52 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 53 | public SlideView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 54 | super(context, attrs, defStyleAttr, defStyleRes); 55 | init(attrs, defStyleAttr); 56 | } 57 | 58 | void init(AttributeSet attrs, int defStyle) { 59 | inflate(getContext(), R.layout.sv_slide_view, this); 60 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 61 | setBackground(ContextCompat.getDrawable(getContext(), R.drawable.sv_view_bg)); 62 | } else { 63 | setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.sv_view_bg)); 64 | } 65 | slideTextView = findViewById(R.id.sv_text); 66 | slider = findViewById(R.id.sv_slider); 67 | slider.setOnSeekBarChangeListener(this); 68 | slideBackground = getBackground(); 69 | buttonLayers = (LayerDrawable) slider.getThumb(); 70 | buttonBackground = buttonLayers.findDrawableByLayerId(R.id.buttonBackground); 71 | 72 | TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SlideView, 73 | defStyle, defStyle); 74 | 75 | int strokeColor; 76 | float slideTextSize = spToPx(16, getContext()); 77 | String slideText; 78 | boolean reverseSlide; 79 | ColorStateList sliderTextColor; 80 | try { 81 | animateSlideText = a.getBoolean(R.styleable.SlideView_sv_animateSlideText, true); 82 | reverseSlide = a.getBoolean(R.styleable.SlideView_sv_reverseSlide, false); 83 | strokeColor = a.getColor(R.styleable.SlideView_sv_strokeColor, ContextCompat. 84 | getColor(getContext(), R.color.sv_stroke_color_default)); 85 | 86 | 87 | slideText = a.getString(R.styleable.SlideView_sv_slideText); 88 | sliderTextColor = a.getColorStateList(R.styleable.SlideView_sv_slideTextColor); 89 | 90 | slideTextSize = a.getDimension(R.styleable.SlideView_sv_slideTextSize, slideTextSize); 91 | slideTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, slideTextSize); 92 | 93 | setText(slideText); 94 | setTextColor(sliderTextColor == null ? slideTextView.getTextColors() : sliderTextColor); 95 | 96 | int buttonImageId = a.getResourceId(R.styleable.SlideView_sv_buttonImage, R.drawable.sv_ic_chevron_double_right); 97 | setButtonImage(ContextCompat.getDrawable(getContext(), buttonImageId)); 98 | setButtonImageDisabled(ContextCompat.getDrawable(getContext(), a.getResourceId 99 | (R.styleable.SlideView_sv_buttonImageDisabled, buttonImageId))); 100 | 101 | setButtonBackgroundColor(a.getColorStateList(R.styleable.SlideView_sv_buttonBackgroundColor)); 102 | setSlideBackgroundColor(a.getColorStateList(R.styleable.SlideView_sv_slideBackgroundColor)); 103 | 104 | if (a.hasValue(R.styleable.SlideView_sv_strokeColor)) { 105 | Util.setDrawableStroke(slideBackground, strokeColor); 106 | } 107 | if (reverseSlide) { 108 | slider.setRotation(180); 109 | LayoutParams params = ((LayoutParams) slideTextView.getLayoutParams()); 110 | params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); 111 | params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); 112 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 113 | params.addRule(RelativeLayout.ALIGN_PARENT_END, 0); 114 | params.addRule(RelativeLayout.ALIGN_PARENT_START); 115 | } 116 | slideTextView.setLayoutParams(params); 117 | } 118 | } finally { 119 | a.recycle(); 120 | } 121 | } 122 | 123 | public void setTextColor(@ColorInt int color) { 124 | slideTextView.setTextColor(color); 125 | } 126 | 127 | public void setTextColor(ColorStateList colors) { 128 | slideTextView.setTextColor(colors); 129 | } 130 | 131 | public void setText(CharSequence text) { 132 | slideTextView.setText(text); 133 | } 134 | 135 | public void setTextSize(int size) { slideTextView.setTextSize(size); } 136 | 137 | public TextView getTextView() { return slideTextView; } 138 | 139 | public void setButtonImage(Drawable image) { 140 | buttonImage = image; 141 | buttonLayers.setDrawableByLayerId(R.id.buttonImage, image); 142 | } 143 | 144 | public void setButtonImageDisabled(Drawable image) { 145 | buttonImageDisabled = image; 146 | } 147 | 148 | 149 | public void setButtonBackgroundColor(ColorStateList color) { 150 | buttonBackgroundColor = color; 151 | Util.setDrawableColor(buttonBackground, color.getDefaultColor()); 152 | } 153 | 154 | 155 | public void setSlideBackgroundColor(ColorStateList color) { 156 | slideBackgroundColor = color; 157 | Util.setDrawableColor(slideBackground, color.getDefaultColor()); 158 | } 159 | 160 | public Slider getSlider() { 161 | return slider; 162 | } 163 | 164 | public void setOnSlideCompleteListener(OnSlideCompleteListener listener) { 165 | slider.setOnSlideCompleteListenerInternal(listener, this); 166 | } 167 | 168 | @Override 169 | public void setEnabled(boolean enabled) { 170 | super.setEnabled(enabled); 171 | for (int i = 0; i < getChildCount(); i++) { 172 | getChildAt(i).setEnabled(enabled); 173 | } 174 | buttonLayers.setDrawableByLayerId(R.id.buttonImage, enabled ? buttonImage : 175 | buttonImageDisabled == null ? buttonImage : buttonImageDisabled); 176 | Util.setDrawableColor(buttonBackground, buttonBackgroundColor.getColorForState( 177 | enabled ? new int[]{android.R.attr.state_enabled} : new int[]{-android.R.attr.state_enabled} 178 | , ContextCompat.getColor(getContext(), R.color.sv_button_color_default))); 179 | Util.setDrawableColor(slideBackground, slideBackgroundColor.getColorForState( 180 | enabled ? new int[]{android.R.attr.state_enabled} : new int[]{-android.R.attr.state_enabled} 181 | , ContextCompat.getColor(getContext(), R.color.sv_button_color_default))); 182 | } 183 | 184 | @Override 185 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 186 | if (animateSlideText) { 187 | slideTextView.setAlpha(1 - (progress / 100f)); 188 | } 189 | } 190 | 191 | @Override 192 | public void onStartTrackingTouch(SeekBar seekBar) { 193 | 194 | } 195 | 196 | @Override 197 | public void onStopTrackingTouch(SeekBar seekBar) { 198 | 199 | } 200 | 201 | public interface OnSlideCompleteListener { 202 | void onSlideComplete(SlideView slideView); 203 | } 204 | } 205 | --------------------------------------------------------------------------------