├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── font │ │ │ │ └── noto_light.otf │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ └── selector_button.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── dhruv │ │ │ └── com │ │ │ └── butim │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── dhruv │ │ │ └── com │ │ │ └── butim │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── dhruv │ │ └── com │ │ └── butim │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── timerbutton ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── attrs.xml │ │ ├── drawable │ │ │ └── selector_button.xml │ │ └── layout │ │ │ └── layout_timer_button.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── dhruv │ │ └── timerbutton │ │ ├── ButtonAnimationListener.java │ │ └── TimerButton.java ├── proguard-rules.pro ├── install.gradle ├── bintray.gradle ├── build.gradle └── maven-push.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .gitignore ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /timerbutton/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':timerbutton' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/font/noto_light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/font/noto_light.otf -------------------------------------------------------------------------------- /timerbutton/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TimerButton 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvtaneja/timer-button/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun May 27 13:57:52 IST 2018 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.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Butim 3 | Send OTP 4 | Resend OTP (%1$d) 5 | Resend OTP 6 | Stop 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #333F51B5 5 | #303F9F 6 | #FF4081 7 | #FFFFFF 8 | 9 | -------------------------------------------------------------------------------- /timerbutton/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /timerbutton/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #333F51B5 5 | #303F9F 6 | #FF4081 7 | #FFFFFF 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /timerbutton/src/main/res/drawable/selector_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/dhruv/com/butim/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package dhruv.com.butim; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /timerbutton/src/main/java/com/dhruv/timerbutton/ButtonAnimationListener.java: -------------------------------------------------------------------------------- 1 | package com.dhruv.timerbutton; 2 | 3 | public interface ButtonAnimationListener { 4 | 5 | /** 6 | * Callback received when button animation ends. Note that 7 | * it is different from {@link #onAnimationReset()} which is 8 | * invoked when the animation is reset to its start state 9 | */ 10 | void onAnimationEnd(); 11 | 12 | /** 13 | * Callback received when button animation is reset. 14 | */ 15 | void onAnimationReset(); 16 | 17 | /** 18 | * Callback received when button animation starts 19 | */ 20 | void onAnimationStart(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /timerbutton/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/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/dhruvtaneja/Library/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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /timerbutton/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/dhruvtaneja/Library/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 | 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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/dhruv/com/butim/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package dhruv.com.butim; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.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 | * Instrumentation 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() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("dhruv.com.butim", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | buildToolsVersion '27.0.3' 6 | defaultConfig { 7 | applicationId "dhruv.com.butim" 8 | minSdkVersion 21 9 | targetSdkVersion 27 10 | versionCode 2 11 | versionName "1.1" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile project(':timerbutton') 25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 26 | exclude group: 'com.android.support', module: 'support-annotations' 27 | }) 28 | compile 'com.android.support:appcompat-v7:27.1.1' 29 | testCompile 'junit:junit:4.12' 30 | } 31 | -------------------------------------------------------------------------------- /timerbutton/install.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | 3 | group = publishedGroupId 4 | version = libraryVersion 5 | 6 | install { 7 | repositories.mavenInstaller { 8 | // This generates POM.xml with proper parameters 9 | pom.project { 10 | packaging 'aar' 11 | groupId publishedGroupId 12 | artifactId artifact 13 | version libraryVersion 14 | 15 | // Add your description here 16 | name libraryName 17 | description libraryDescription 18 | url siteUrl 19 | 20 | // Set your license 21 | licenses { 22 | license { 23 | name licenseName 24 | url licenseUrl 25 | } 26 | } 27 | developers { 28 | developer { 29 | id developerId 30 | name developerName 31 | email developerEmail 32 | } 33 | } 34 | scm { 35 | connection gitUrl 36 | developerConnection gitUrl 37 | url siteUrl 38 | 39 | } 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/dhruv/com/butim/MainActivity.java: -------------------------------------------------------------------------------- 1 | package dhruv.com.butim; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.widget.Button; 7 | 8 | import com.dhruv.timerbutton.TimerButton; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | private static final long MILLIS_IN_FUTURE = 12000L; 13 | 14 | private TimerButton mTimerButton; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | 21 | 22 | Button endAnimButton = findViewById(R.id.end_anim_button); 23 | mTimerButton = findViewById(R.id.timer_button); 24 | // mTimerButton.setBeforeAnimationText(getString(R.string.send_otp)); 25 | // mTimerButton.setDynamicText(R.string.resend_otp_formatted); 26 | // mTimerButton.setOnAnimationCompleteText(getString(R.string.resend_otp)); 27 | // mTimerButton.setButtonBackground(R.drawable.selector_button); 28 | // mTimerButton.setAnimationBackground(R.color.colorPrimaryTrans); 29 | mTimerButton.setDuration(MILLIS_IN_FUTURE); 30 | 31 | endAnimButton.setOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | mTimerButton.reset(); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /timerbutton/bintray.gradle: -------------------------------------------------------------------------------- 1 | version = libraryVersion 2 | 3 | task sourcesJar(type: Jar) { 4 | classifier = 'sources' 5 | from android.sourceSets.main.java.srcDirs 6 | } 7 | 8 | task javadoc(type: Javadoc) { 9 | source = android.sourceSets.main.java.srcDirs 10 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 11 | } 12 | 13 | task javadocJar(type: Jar, dependsOn: javadoc) { 14 | classifier = 'javadoc' 15 | from javadoc.destinationDir 16 | } 17 | 18 | artifacts { 19 | archives javadocJar 20 | archives sourcesJar 21 | } 22 | 23 | Properties properties = new Properties() 24 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 25 | 26 | bintray { 27 | user = properties.getProperty("bintray.user") 28 | key = properties.getProperty("bintray.apikey") 29 | 30 | configurations = ['archives'] 31 | pkg { 32 | repo = bintrayRepo 33 | name = bintrayName 34 | desc = libraryDescription 35 | userOrg = organization // If the repository is hosted by an organization instead of personal account. 36 | websiteUrl = siteUrl 37 | vcsUrl = gitUrl 38 | licenses = allLicenses 39 | publish = true 40 | publicDownloadNumbers = true 41 | version { 42 | name = libraryVersion 43 | desc = libraryDescription 44 | vcsTag = libraryVersion 45 | gpg { 46 | sign = true 47 | passphrase = properties.getProperty("bintray.gpg.password") 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 27 | 28 |