├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── github │ │ └── nikartm │ │ └── stripedprocessbutton │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── nikartm │ │ │ └── stripedprocessbutton │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── btn_rounded.xml │ │ ├── ic_launcher_background.xml │ │ └── ripple.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── github │ └── nikartm │ └── stripedprocessbutton │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ └── gradle-wrapper.jar ├── gradlew ├── gradlew.bat ├── screenshots └── sct_ex.gif ├── scripts ├── publish-module.gradle └── publish-root.gradle ├── settings.gradle └── support ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── github │ │ └── nikartm │ │ └── support │ │ ├── AnimatedStripedDrawable.kt │ │ ├── AttributeController.kt │ │ ├── StripedDrawable.kt │ │ ├── StripedProcessButton.kt │ │ ├── Util.kt │ │ └── constant │ │ └── Constants.kt └── res │ └── values │ ├── attr.xml │ └── strings.xml └── test └── java └── com └── github └── nikartm └── support └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /build 6 | /captures 7 | .externalNativeBuild 8 | app.properties 9 | gradle-wrapper.properties 10 | *.log 11 | 12 | # Build application files 13 | *.apk 14 | *.ap_ 15 | *.dex 16 | 17 | # Java class files 18 | *.class 19 | 20 | # Generated files 21 | bin/ 22 | gen/ 23 | 24 | # Windows thumbnail db 25 | Thumbs.db 26 | 27 | # Eclipse project files 28 | .classpath 29 | .project -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Maven Central](https://img.shields.io/maven-central/v/io.github.nikartm/process-button.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.nikartm%22%20AND%20a:%22process-button%22) [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21) [![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-StripedProcessButton-green.svg?style=flat )]( https://android-arsenal.com/details/1/7623 ) 2 | 3 | # StripedProcessButton 4 | Library for creating process loading button with stripes 5 | 6 | ## Download 7 | Add to gradle root: 8 | ``` 9 | allprojects { 10 | repositories { 11 | mavenCentral() 12 | } 13 | } 14 | ``` 15 | 16 | #### After migrating to MavenCentral, use Groove: 17 | ``` 18 | implementation 'io.github.nikartm:process-button:$LAST_VERSION' 19 | ``` 20 | Or Kotlin DSL: 21 | ``` 22 | implementation("io.github.nikartm:process-button:$LAST_VERSION") 23 | ``` 24 | 25 | ## Screenshots 26 | ![screenshots](https://raw.githubusercontent.com/nikartm/StripedProcessButton/master/screenshots/sct_ex.gif) 27 | ## How to use? 28 | Adjust the xml view [More examples.](https://github.com/nikartm/StripedProcessButton/blob/master/app/src/main/res/layout/activity_main.xml): 29 | ``` 30 | 51 | ``` 52 | Adjust programmatically (shortly): 53 | ``` 54 | stripedButton.setCornerRadius(50) 55 | .setStripeAlpha(0.7f) 56 | .setStripeRevert(true) 57 | .setStripeGradient(false) 58 | .setTilt(15) 59 | .start() 60 | ``` 61 | 62 | ## License 63 | Copyright 2022 Ivan Vodyasov 64 | 65 | Licensed under the Apache License, Version 2.0 (the "License"); 66 | you may not use this file except in compliance with the License. 67 | You may obtain a copy of the License at 68 | 69 | http://www.apache.org/licenses/LICENSE-2.0 70 | 71 | Unless required by applicable law or agreed to in writing, software 72 | distributed under the License is distributed on an "AS IS" BASIS, 73 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74 | See the License for the specific language governing permissions and 75 | limitations under the License. -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | defaultConfig { 7 | applicationId "com.github.nikartm.stripedprocessbutton" 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | kotlinOptions { 23 | jvmTarget = rootProject.ext.javaVersion 24 | } 25 | 26 | compileOptions { 27 | targetCompatibility rootProject.ext.javaVersion 28 | sourceCompatibility rootProject.ext.javaVersion 29 | } 30 | 31 | buildFeatures { 32 | viewBinding = true 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation fileTree(dir: 'libs', include: ['*.jar']) 38 | testImplementation 'junit:junit:4.13.2' 39 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 40 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 41 | implementation 'androidx.appcompat:appcompat:1.5.1' 42 | implementation rootProject.ext.dependencies.coreKtx 43 | implementation project(':support') 44 | } 45 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/github/nikartm/stripedprocessbutton/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.github.nikartm.stripedprocessbutton; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.github.nikartm.strippedprogressbutton", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/nikartm/stripedprocessbutton/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.github.nikartm.stripedprocessbutton 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import com.github.nikartm.stripedprocessbutton.databinding.ActivityMainBinding 6 | 7 | class MainActivity : AppCompatActivity() { 8 | 9 | private lateinit var binding: ActivityMainBinding 10 | 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | binding = ActivityMainBinding.inflate(layoutInflater) 14 | setContentView(binding.root) 15 | bindView() 16 | } 17 | 18 | private fun bindView() = with(binding) { 19 | initStartStripedButton() 20 | btnStart.setOnClickListener { 21 | btnStart.start() 22 | btn2.start() 23 | btn3.start() 24 | btn4.start() 25 | } 26 | btnStop.setOnClickListener { 27 | btnStart.stop() 28 | btn2.stop() 29 | btn3.stop() 30 | btn4.stop() 31 | } 32 | } 33 | 34 | private fun initStartStripedButton() = with(binding.btnStart) { 35 | text = "Start process" 36 | setCornerRadius(50f) 37 | setStripeAlpha(0.7f) 38 | setStripeRevert(true) 39 | setStripeGradient(false) 40 | setTilt(15f) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_rounded.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ripple.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 19 | 20 | 35 | 36 |