├── .github
└── FUNDING.yml
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── SECURITY.md
├── _config.yml
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── asp
│ │ └── fliptimer
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── asp
│ │ │ └── fliptimer
│ │ │ └── MainActivity.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── background_bottom.xml
│ │ ├── background_top.xml
│ │ └── ic_launcher_background.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
│ └── asp
│ └── fliptimer
│ └── ExampleUnitTest.kt
├── build.gradle
├── fliptimerviewlibrary
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── asp
│ │ └── fliptimerviewlibrary
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── asp
│ │ │ └── fliptimerviewlibrary
│ │ │ ├── AlignedTextView.kt
│ │ │ ├── CountdownClock.kt
│ │ │ └── CountdownDigit.kt
│ └── res
│ │ ├── font
│ │ ├── amaticsc_regular.ttf
│ │ └── roboto_bold.ttf
│ │ ├── layout
│ │ ├── view_countdown_clock_digit.xml
│ │ └── view_simple_clock.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── asp
│ └── fliptimerviewlibrary
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── imgs
└── preview.gif
└── settings.gradle
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: anugotta
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: ['https://www.buymeacoffee.com/anugotta']
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Anu S Pillai
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FlipTimerView
2 | [](https://jitpack.io/#anugotta/FlipTimerView)
3 | []()
4 | [](https://android-arsenal.com/api?level=16)
5 | []( https://android-arsenal.com/details/1/7634 )
6 |
7 |
8 | ## Preview
9 |
10 |
11 |
12 | FlipTimerView library for Android
13 |
14 | ## Getting started
15 | Add it in your root build.gradle at the end of repositories:
16 |
17 | allprojects {
18 | repositories {
19 | ...
20 | maven { url 'https://jitpack.io' }
21 | }
22 | }
23 | Step 2. Add the dependency
24 |
25 | dependencies {
26 | implementation 'com.github.anugotta:FlipTimerView:v1.5'
27 | }
28 |
29 |
30 | ## Usage
31 | Add the CountDownClock in your layout
32 |
33 | ```
34 |
55 | ```
56 |
57 | ## API
58 | ```kotlin
59 | timerProgramCountdown.startCountDown(99999999)
60 | timerProgramCountdown.setCountdownListener(object : CountDownClock.CountdownCallBack {
61 | override fun countdownAboutToFinish() {
62 | //TODO Add your code here
63 | }
64 |
65 | override fun countdownFinished() {
66 | Toast.makeText(this@MainActivity, "Finished", Toast.LENGTH_SHORT).show()
67 | timerProgramCountdown.resetCountdownTimer()
68 | }
69 | })
70 | ```
71 |
72 |
73 | ## If this library was helpful ❤️:
74 |
75 |
76 |
77 |
78 |
79 | ## Designed by:
80 | **GadgetCheck:**
81 | https://github.com/GadgetCheck
82 |
83 |
84 |
85 |
86 | ## Contribution
87 |
88 | If you are interested to contribute, feel free to send pull requests (to development branch) or issues.
89 |
90 | **Note:** All your pull requests should be written in kotlin
91 |
92 | ## Questions?
93 | Hit me on twitter [](https://twitter.com/as_pillai)
94 |
95 |
96 | ## License
97 |
98 | MIT License
99 |
100 | Copyright (c) 2019 Anu S Pillai
101 |
102 | Permission is hereby granted, free of charge, to any person obtaining a copy
103 | of this software and associated documentation files (the "Software"), to deal
104 | in the Software without restriction, including without limitation the rights
105 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
106 | copies of the Software, and to permit persons to whom the Software is
107 | furnished to do so, subject to the following conditions:
108 |
109 | The above copyright notice and this permission notice shall be included in all
110 | copies or substantial portions of the Software.
111 |
112 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
113 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
114 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
115 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
116 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
117 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
118 | SOFTWARE.
119 |
120 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Use this section to tell people about which versions of your project are
6 | currently being supported with security updates.
7 |
8 | | Version | Supported |
9 | | ------- | ------------------ |
10 | | 5.1.x | :white_check_mark: |
11 | | 5.0.x | :x: |
12 | | 4.0.x | :white_check_mark: |
13 | | < 4.0 | :x: |
14 |
15 | ## Reporting a Vulnerability
16 |
17 | Use this section to tell people how to report a vulnerability.
18 |
19 | Tell them where to go, how often they can expect to get an update on a
20 | reported vulnerability, what to expect if the vulnerability is accepted or
21 | declined, etc.
22 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 28
9 | defaultConfig {
10 | applicationId "com.asp.fliptimer"
11 | minSdkVersion 16
12 | targetSdkVersion 28
13 | versionCode 5
14 | versionName "1.4"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(include: ['*.jar'], dir: 'libs')
27 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28 | implementation 'com.android.support:appcompat-v7:28.0.0'
29 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | implementation project(':fliptimerviewlibrary')
34 | }
35 |
--------------------------------------------------------------------------------
/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/asp/fliptimer/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimer
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.asp.fliptimer", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/asp/fliptimer/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimer
2 |
3 | import android.app.Activity
4 | import android.os.Bundle
5 | import android.support.v4.content.res.ResourcesCompat
6 | import android.widget.Toast
7 | import com.asp.fliptimerviewlibrary.CountDownClock
8 | import kotlinx.android.synthetic.main.activity_main.*
9 |
10 |
11 | class MainActivity : Activity() {
12 |
13 | private var isRunning: Boolean = true
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_main)
18 |
19 | val typeface = ResourcesCompat.getFont(this, R.font.roboto_bold)
20 | timerProgramCountdown.setCustomTypeface(typeface!!)
21 | timerProgramCountdown.startCountDown(99999999)
22 | timerProgramCountdown.setCountdownListener(object : CountDownClock.CountdownCallBack {
23 | override fun countdownAboutToFinish() {
24 | //TODO Add your code here
25 | }
26 |
27 | override fun countdownFinished() {
28 | Toast.makeText(this@MainActivity, "Finished", Toast.LENGTH_SHORT).show()
29 | timerProgramCountdown.resetCountdownTimer()
30 | isRunning = false
31 | btnPause.isEnabled = false
32 | }
33 | })
34 |
35 |
36 | btnPause.setOnClickListener {
37 |
38 | if(isRunning){
39 | isRunning = false
40 | timerProgramCountdown.pauseCountDownTimer()
41 | btnPause.text = getString(R.string.resume_timer)
42 | }else{
43 | isRunning = true
44 | timerProgramCountdown.resumeCountDownTimer()
45 | btnPause.text = getString(R.string.pause_timer)
46 | }
47 |
48 |
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/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/background_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
37 |
38 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #ffffff
7 | #000000
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FlipTimerView
3 | Pause Timer
4 | Resume Timer
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/asp/fliptimer/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimer
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.30'
5 | ext.kotlin_version = '1.3.21'
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.4.1'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 |
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android-extensions'
3 | apply plugin: 'kotlin-android'
4 |
5 | android {
6 | compileSdkVersion 28
7 |
8 |
9 |
10 | defaultConfig {
11 | minSdkVersion 16
12 | targetSdkVersion 28
13 | versionCode 6
14 | versionName "1.5"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(include: ['*.jar'], dir: 'libs')
29 | implementation 'com.android.support:appcompat-v7:28.0.0'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
34 | }
35 | repositories {
36 | mavenCentral()
37 | }
38 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/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 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/androidTest/java/com/asp/fliptimerviewlibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimerviewlibrary;
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 | * 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.asp.fliptimerviewlibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/java/com/asp/fliptimerviewlibrary/AlignedTextView.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimerviewlibrary
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.graphics.Paint
6 | import android.graphics.Rect
7 | import android.util.AttributeSet
8 | import android.util.Log
9 | import android.widget.TextView
10 |
11 | class AlignedTextView : TextView {
12 | private var alignment = ProperTextAlignment.TOP
13 | private val textRect = Rect()
14 |
15 | constructor(context: Context?) : this(context, null)
16 | constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
17 | constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
18 | attrs?.let {
19 | val typedArray = context?.obtainStyledAttributes(attrs, R.styleable.AlignedTextView, defStyleAttr, 0)
20 |
21 | val alignment = typedArray?.getInt(R.styleable.AlignedTextView_alignment, 0)
22 | if (alignment != null && alignment != 0) {
23 | setAlignment(alignment)
24 | } else {
25 | Log.e("AlignedTextView", "You did not set an alignment for an AlignedTextView. Default is top alignment.")
26 | }
27 |
28 | invalidate()
29 | typedArray?.recycle()
30 | }
31 | }
32 |
33 | override fun onDraw(canvas: Canvas?) {
34 | canvas?.let {
35 | canvas.getClipBounds(textRect)
36 | val cHeight = textRect.height()
37 | paint.getTextBounds(this.text.toString(), 0, this.text.length, textRect)
38 | val bottom = textRect.bottom;
39 | textRect.offset(-textRect.left, -textRect.top)
40 | paint.textAlign = Paint.Align.CENTER
41 | var drawY = 0f
42 | if (alignment == ProperTextAlignment.TOP) {
43 | drawY = (textRect.bottom - bottom).toFloat() - ((textRect.bottom - textRect.top) / 2)
44 | } else if (alignment == ProperTextAlignment.BOTTOM) {
45 | drawY = top + cHeight.toFloat() + ((textRect.bottom - textRect.top) / 2)
46 | }
47 | val drawX = (canvas.width / 2).toFloat()
48 | paint.color = this.currentTextColor
49 | canvas.drawText(this.text.toString(), drawX, drawY, paint)
50 | }
51 | }
52 |
53 | private fun setAlignment(alignment: Int) {
54 | if (alignment == 1) {
55 | this.alignment = ProperTextAlignment.TOP
56 | } else if (alignment == 2) {
57 | this.alignment = ProperTextAlignment.BOTTOM
58 | }
59 | }
60 |
61 | private enum class ProperTextAlignment {
62 | TOP,
63 | BOTTOM
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/java/com/asp/fliptimerviewlibrary/CountdownClock.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimerviewlibrary
2 |
3 | import android.content.Context
4 | import android.graphics.Typeface
5 | import android.graphics.drawable.Drawable
6 | import android.os.CountDownTimer
7 | import android.support.v4.content.ContextCompat
8 | import android.util.AttributeSet
9 | import android.util.TypedValue
10 | import android.view.View
11 | import android.widget.LinearLayout
12 | import kotlinx.android.synthetic.main.view_countdown_clock_digit.view.*
13 | import kotlinx.android.synthetic.main.view_simple_clock.view.*
14 | import java.util.concurrent.TimeUnit
15 |
16 |
17 | class CountDownClock : LinearLayout {
18 | private var countDownTimer: CountDownTimer? = null
19 | private var countdownListener: CountdownCallBack? = null
20 | private var countdownTickInterval = 1000
21 |
22 | private var almostFinishedCallbackTimeInSeconds: Int = 5
23 |
24 | private var resetSymbol: String = "8"
25 |
26 | constructor(context: Context?) : this(context, null)
27 | constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
28 | constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
29 | View.inflate(context, R.layout.view_simple_clock, this)
30 |
31 | attrs?.let {
32 | val typedArray = context?.obtainStyledAttributes(attrs, R.styleable.CountDownClock, defStyleAttr, 0)
33 | val resetSymbol = typedArray?.getString(R.styleable.CountDownClock_resetSymbol)
34 | if (resetSymbol != null) {
35 | setResetSymbol(resetSymbol)
36 | }
37 |
38 | val digitTopDrawable = typedArray?.getDrawable(R.styleable.CountDownClock_digitTopDrawable)
39 | setDigitTopDrawable(digitTopDrawable)
40 | val digitBottomDrawable = typedArray?.getDrawable(R.styleable.CountDownClock_digitBottomDrawable)
41 | setDigitBottomDrawable(digitBottomDrawable)
42 | val digitDividerColor = typedArray?.getColor(R.styleable.CountDownClock_digitDividerColor, 0)
43 | setDigitDividerColor(digitDividerColor ?: 0)
44 | val digitSplitterColor = typedArray?.getColor(R.styleable.CountDownClock_digitSplitterColor, 0)
45 | setDigitSplitterColor(digitSplitterColor ?: 0)
46 |
47 | val digitTextColor = typedArray?.getColor(R.styleable.CountDownClock_digitTextColor, 0)
48 | setDigitTextColor(digitTextColor ?: 0)
49 |
50 | val digitTextSize = typedArray?.getDimension(R.styleable.CountDownClock_digitTextSize, 0f)
51 | setDigitTextSize(digitTextSize ?: 0f)
52 | setSplitterDigitTextSize(digitTextSize ?: 0f)
53 |
54 | val digitPadding = typedArray?.getDimension(R.styleable.CountDownClock_digitPadding, 0f)
55 | setDigitPadding(digitPadding?.toInt() ?: 0)
56 |
57 | val splitterPadding = typedArray?.getDimension(R.styleable.CountDownClock_splitterPadding, 0f)
58 | setSplitterPadding(splitterPadding?.toInt() ?: 0)
59 |
60 | val halfDigitHeight = typedArray?.getDimensionPixelSize(R.styleable.CountDownClock_halfDigitHeight, 0)
61 | val digitWidth = typedArray?.getDimensionPixelSize(R.styleable.CountDownClock_digitWidth, 0)
62 | setHalfDigitHeightAndDigitWidth(halfDigitHeight ?: 0, digitWidth ?: 0)
63 |
64 | val animationDuration = typedArray?.getInt(R.styleable.CountDownClock_animationDuration, 0)
65 | setAnimationDuration(animationDuration ?: 600)
66 |
67 | val almostFinishedCallbackTimeInSeconds = typedArray?.getInt(R.styleable.CountDownClock_almostFinishedCallbackTimeInSeconds, 5)
68 | setAlmostFinishedCallbackTimeInSeconds(almostFinishedCallbackTimeInSeconds ?: 5)
69 |
70 | val countdownTickInterval = typedArray?.getInt(R.styleable.CountDownClock_countdownTickInterval, 1000)
71 | this.countdownTickInterval = countdownTickInterval ?: 1000
72 |
73 | invalidate()
74 | typedArray?.recycle()
75 | }
76 | }
77 |
78 | ////////////////
79 | // Public methods
80 | ////////////////
81 |
82 | private var milliLeft: Long = 0
83 |
84 | fun startCountDown(timeToNextEvent: Long) {
85 | countDownTimer?.cancel()
86 | var hasCalledAlmostFinished = false
87 | countDownTimer = object : CountDownTimer(timeToNextEvent, countdownTickInterval.toLong()) {
88 | override fun onTick(millisUntilFinished: Long) {
89 | milliLeft = millisUntilFinished
90 | if (millisUntilFinished / 1000 <= almostFinishedCallbackTimeInSeconds && !hasCalledAlmostFinished) {
91 | hasCalledAlmostFinished = true
92 | countdownListener?.countdownAboutToFinish()
93 | }
94 | setCountDownTime(millisUntilFinished)
95 | }
96 |
97 | override fun onFinish() {
98 | hasCalledAlmostFinished = false
99 | countdownListener?.countdownFinished()
100 | }
101 | }
102 | countDownTimer?.start()
103 | }
104 |
105 | fun resetCountdownTimer() {
106 | countDownTimer?.cancel()
107 | firstDigitDays.setNewText(resetSymbol)
108 | secondDigitDays.setNewText(resetSymbol)
109 | firstDigitHours.setNewText(resetSymbol)
110 | secondDigitHours.setNewText(resetSymbol)
111 | firstDigitMinute.setNewText(resetSymbol)
112 | secondDigitMinute.setNewText(resetSymbol)
113 | firstDigitSecond.setNewText(resetSymbol)
114 | secondDigitSecond.setNewText(resetSymbol)
115 | }
116 |
117 | ////////////////
118 | // Private methods
119 | ////////////////
120 |
121 | private fun setCountDownTime(timeToStart: Long) {
122 |
123 | val days = TimeUnit.MILLISECONDS.toDays(timeToStart)
124 | val hours = TimeUnit.MILLISECONDS.toHours(timeToStart - TimeUnit.DAYS.toMillis(days))
125 | val minutes = TimeUnit.MILLISECONDS.toMinutes(timeToStart - (TimeUnit.DAYS.toMillis(days) + TimeUnit.HOURS.toMillis(hours)))
126 | val seconds = TimeUnit.MILLISECONDS.toSeconds(timeToStart - (TimeUnit.DAYS.toMillis(days) + TimeUnit.HOURS.toMillis(hours) + TimeUnit.MINUTES.toMillis(minutes)))
127 |
128 | val daysString = days.toString()
129 | val hoursString = hours.toString()
130 | val minutesString = minutes.toString()
131 | val secondsString = seconds.toString()
132 |
133 |
134 | when {
135 | daysString.length == 2 -> {
136 | firstDigitDays.animateTextChange((daysString[0].toString()))
137 | secondDigitDays.animateTextChange((daysString[1].toString()))
138 | }
139 | daysString.length == 1 -> {
140 | firstDigitDays.animateTextChange(("0"))
141 | secondDigitDays.animateTextChange((daysString[0].toString()))
142 | }
143 | else -> {
144 | firstDigitDays.animateTextChange(("3"))
145 | secondDigitDays.animateTextChange(("0"))
146 | }
147 | }
148 |
149 | when {
150 | hoursString.length == 2 -> {
151 | firstDigitHours.animateTextChange((hoursString[0].toString()))
152 | secondDigitHours.animateTextChange((hoursString[1].toString()))
153 | }
154 | hoursString.length == 1 -> {
155 | firstDigitHours.animateTextChange(("0"))
156 | secondDigitHours.animateTextChange((hoursString[0].toString()))
157 | }
158 | else -> {
159 | firstDigitHours.animateTextChange(("1"))
160 | secondDigitHours.animateTextChange(("1"))
161 | }
162 | }
163 |
164 | when {
165 | minutesString.length == 2 -> {
166 | firstDigitMinute.animateTextChange((minutesString[0].toString()))
167 | secondDigitMinute.animateTextChange((minutesString[1].toString()))
168 | }
169 | minutesString.length == 1 -> {
170 | firstDigitMinute.animateTextChange(("0"))
171 | secondDigitMinute.animateTextChange((minutesString[0].toString()))
172 | }
173 | else -> {
174 | firstDigitMinute.animateTextChange(("5"))
175 | secondDigitMinute.animateTextChange(("9"))
176 | }
177 | }
178 | when {
179 | secondsString.length == 2 -> {
180 | firstDigitSecond.animateTextChange((secondsString[0].toString()))
181 | secondDigitSecond.animateTextChange((secondsString[1].toString()))
182 | }
183 | secondsString.length == 1 -> {
184 | firstDigitSecond.animateTextChange(("0"))
185 | secondDigitSecond.animateTextChange((secondsString[0].toString()))
186 | }
187 | else -> {
188 | firstDigitSecond.animateTextChange((secondsString[secondsString.length - 2].toString()))
189 | secondDigitSecond.animateTextChange((secondsString[secondsString.length - 1].toString()))
190 | }
191 | }
192 | }
193 |
194 | private fun setResetSymbol(resetSymbol: String?) {
195 | resetSymbol?.let {
196 | if (it.isNotEmpty()) {
197 | this.resetSymbol = resetSymbol
198 | } else {
199 | this.resetSymbol = ""
200 | }
201 | } ?: kotlin.run {
202 | this.resetSymbol = ""
203 | }
204 | }
205 |
206 | private fun setDigitTopDrawable(digitTopDrawable: Drawable?) {
207 | if (digitTopDrawable != null) {
208 | firstDigitDays.frontUpper.background = digitTopDrawable
209 | firstDigitDays.backUpper.background = digitTopDrawable
210 | secondDigitDays.frontUpper.background = digitTopDrawable
211 | secondDigitDays.backUpper.background = digitTopDrawable
212 | firstDigitHours.frontUpper.background = digitTopDrawable
213 | firstDigitHours.backUpper.background = digitTopDrawable
214 | secondDigitHours.frontUpper.background = digitTopDrawable
215 | secondDigitHours.backUpper.background = digitTopDrawable
216 | firstDigitMinute.frontUpper.background = digitTopDrawable
217 | firstDigitMinute.backUpper.background = digitTopDrawable
218 | secondDigitMinute.frontUpper.background = digitTopDrawable
219 | secondDigitMinute.backUpper.background = digitTopDrawable
220 | firstDigitSecond.frontUpper.background = digitTopDrawable
221 | firstDigitSecond.backUpper.background = digitTopDrawable
222 | secondDigitSecond.frontUpper.background = digitTopDrawable
223 | secondDigitSecond.backUpper.background = digitTopDrawable
224 | } else {
225 | setTransparentBackgroundColor()
226 | }
227 | }
228 |
229 | private fun setDigitBottomDrawable(digitBottomDrawable: Drawable?) {
230 | if (digitBottomDrawable != null) {
231 | firstDigitDays.frontLower.background = digitBottomDrawable
232 | firstDigitDays.backLower.background = digitBottomDrawable
233 | secondDigitDays.frontLower.background = digitBottomDrawable
234 | secondDigitDays.backLower.background = digitBottomDrawable
235 | firstDigitHours.frontLower.background = digitBottomDrawable
236 | firstDigitHours.backLower.background = digitBottomDrawable
237 | secondDigitHours.frontLower.background = digitBottomDrawable
238 | secondDigitHours.backLower.background = digitBottomDrawable
239 | firstDigitMinute.frontLower.background = digitBottomDrawable
240 | firstDigitMinute.backLower.background = digitBottomDrawable
241 | secondDigitMinute.frontLower.background = digitBottomDrawable
242 | secondDigitMinute.backLower.background = digitBottomDrawable
243 | firstDigitSecond.frontLower.background = digitBottomDrawable
244 | firstDigitSecond.backLower.background = digitBottomDrawable
245 | secondDigitSecond.frontLower.background = digitBottomDrawable
246 | secondDigitSecond.backLower.background = digitBottomDrawable
247 | } else {
248 | setTransparentBackgroundColor()
249 | }
250 | }
251 |
252 | private fun setDigitDividerColor(digitDividerColor: Int) {
253 | var dividerColor = digitDividerColor
254 | if (dividerColor == 0) {
255 | dividerColor = ContextCompat.getColor(context, R.color.transparent)
256 | }
257 |
258 | firstDigitDays.digitDivider.setBackgroundColor(dividerColor)
259 | secondDigitDays.digitDivider.setBackgroundColor(dividerColor)
260 | firstDigitHours.digitDivider.setBackgroundColor(dividerColor)
261 | secondDigitHours.digitDivider.setBackgroundColor(dividerColor)
262 | firstDigitMinute.digitDivider.setBackgroundColor(dividerColor)
263 | secondDigitMinute.digitDivider.setBackgroundColor(dividerColor)
264 | firstDigitSecond.digitDivider.setBackgroundColor(dividerColor)
265 | secondDigitSecond.digitDivider.setBackgroundColor(dividerColor)
266 | }
267 |
268 | private fun setDigitSplitterColor(digitsSplitterColor: Int) {
269 | if (digitsSplitterColor != 0) {
270 | // digitsSplitter.setTextColor(digitsSplitterColor)
271 | } else {
272 | // digitsSplitter.setTextColor(ContextCompat.getColor(context, R.color.transparent))
273 | }
274 | }
275 |
276 | private fun setSplitterDigitTextSize(digitsTextSize: Float) {
277 | //digitsSplitter.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
278 | }
279 |
280 | private fun setDigitPadding(digitPadding: Int) {
281 |
282 | firstDigitDays.setPadding(digitPadding, digitPadding, digitPadding, digitPadding)
283 | secondDigitDays.setPadding(digitPadding, digitPadding, digitPadding , digitPadding)
284 | firstDigitHours.setPadding(digitPadding, digitPadding, digitPadding, digitPadding)
285 | secondDigitHours.setPadding(digitPadding, digitPadding, digitPadding , digitPadding)
286 |
287 | firstDigitMinute.setPadding(digitPadding, digitPadding, digitPadding, digitPadding)
288 | secondDigitMinute.setPadding(digitPadding, digitPadding, digitPadding , digitPadding)
289 | firstDigitSecond.setPadding(digitPadding, digitPadding, digitPadding, digitPadding)
290 | secondDigitSecond.setPadding(digitPadding, digitPadding, digitPadding, digitPadding)
291 | }
292 |
293 | private fun setSplitterPadding(splitterPadding: Int) {
294 | //digitsSplitter.setPadding(splitterPadding, 0, splitterPadding, 0)
295 | }
296 |
297 | private fun setDigitTextColor(digitsTextColor: Int) {
298 | var textColor = digitsTextColor
299 | if (textColor == 0) {
300 | textColor = ContextCompat.getColor(context, R.color.transparent)
301 | }
302 |
303 | firstDigitDays.frontUpperText.setTextColor(textColor)
304 | firstDigitDays.backUpperText.setTextColor(textColor)
305 | firstDigitHours.frontUpperText.setTextColor(textColor)
306 | firstDigitHours.backUpperText.setTextColor(textColor)
307 | secondDigitDays.frontUpperText.setTextColor(textColor)
308 | secondDigitDays.backUpperText.setTextColor(textColor)
309 | secondDigitHours.frontUpperText.setTextColor(textColor)
310 | secondDigitHours.backUpperText.setTextColor(textColor)
311 |
312 | firstDigitMinute.frontUpperText.setTextColor(textColor)
313 | firstDigitMinute.backUpperText.setTextColor(textColor)
314 | secondDigitMinute.frontUpperText.setTextColor(textColor)
315 | secondDigitMinute.backUpperText.setTextColor(textColor)
316 | firstDigitSecond.frontUpperText.setTextColor(textColor)
317 | firstDigitSecond.backUpperText.setTextColor(textColor)
318 | secondDigitSecond.frontUpperText.setTextColor(textColor)
319 | secondDigitSecond.backUpperText.setTextColor(textColor)
320 |
321 |
322 | firstDigitDays.frontLowerText.setTextColor(textColor)
323 | firstDigitDays.backLowerText.setTextColor(textColor)
324 |
325 | firstDigitHours.frontLowerText.setTextColor(textColor)
326 | firstDigitHours.backLowerText.setTextColor(textColor)
327 |
328 | secondDigitDays.frontLowerText.setTextColor(textColor)
329 | secondDigitDays.backLowerText.setTextColor(textColor)
330 |
331 | secondDigitHours.frontLowerText.setTextColor(textColor)
332 | secondDigitHours.backLowerText.setTextColor(textColor)
333 |
334 | firstDigitMinute.frontLowerText.setTextColor(textColor)
335 | firstDigitMinute.backLowerText.setTextColor(textColor)
336 | secondDigitMinute.frontLowerText.setTextColor(textColor)
337 | secondDigitMinute.backLowerText.setTextColor(textColor)
338 | firstDigitSecond.frontLowerText.setTextColor(textColor)
339 | firstDigitSecond.backLowerText.setTextColor(textColor)
340 | secondDigitSecond.frontLowerText.setTextColor(textColor)
341 | secondDigitSecond.backLowerText.setTextColor(textColor)
342 | }
343 |
344 | private fun setDigitTextSize(digitsTextSize: Float) {
345 |
346 | firstDigitDays.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
347 | firstDigitDays.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
348 | secondDigitDays.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
349 | secondDigitDays.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
350 | firstDigitHours.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
351 | firstDigitHours.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
352 | secondDigitHours.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
353 | secondDigitHours.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
354 | firstDigitMinute.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
355 | firstDigitMinute.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
356 | secondDigitMinute.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
357 | secondDigitMinute.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
358 | firstDigitSecond.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
359 | firstDigitSecond.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
360 | secondDigitSecond.frontUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
361 | secondDigitSecond.backUpperText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
362 | firstDigitDays.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
363 | firstDigitDays.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
364 | secondDigitDays.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
365 | secondDigitDays.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
366 | firstDigitHours.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
367 | firstDigitHours.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
368 | secondDigitHours.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
369 | secondDigitHours.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
370 | firstDigitMinute.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
371 | firstDigitMinute.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
372 | secondDigitMinute.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
373 | secondDigitMinute.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
374 | firstDigitSecond.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
375 | firstDigitSecond.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
376 | secondDigitSecond.frontLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
377 | secondDigitSecond.backLowerText.setTextSize(TypedValue.COMPLEX_UNIT_PX, digitsTextSize)
378 | }
379 |
380 | private fun setHalfDigitHeightAndDigitWidth(halfDigitHeight: Int, digitWidth: Int) {
381 | setHeightAndWidthToView(firstDigitDays.frontUpper, halfDigitHeight, digitWidth)
382 | setHeightAndWidthToView(firstDigitDays.backUpper, halfDigitHeight, digitWidth)
383 | setHeightAndWidthToView(secondDigitDays.frontUpper, halfDigitHeight, digitWidth)
384 | setHeightAndWidthToView(secondDigitDays.backUpper, halfDigitHeight, digitWidth)
385 | setHeightAndWidthToView(firstDigitHours.frontUpper, halfDigitHeight, digitWidth)
386 | setHeightAndWidthToView(firstDigitHours.backUpper, halfDigitHeight, digitWidth)
387 | setHeightAndWidthToView(secondDigitHours.frontUpper, halfDigitHeight, digitWidth)
388 | setHeightAndWidthToView(secondDigitHours.backUpper, halfDigitHeight, digitWidth)
389 | setHeightAndWidthToView(firstDigitMinute.frontUpper, halfDigitHeight, digitWidth)
390 | setHeightAndWidthToView(firstDigitMinute.backUpper, halfDigitHeight, digitWidth)
391 | setHeightAndWidthToView(secondDigitMinute.frontUpper, halfDigitHeight, digitWidth)
392 | setHeightAndWidthToView(secondDigitMinute.backUpper, halfDigitHeight, digitWidth)
393 | setHeightAndWidthToView(firstDigitSecond.frontUpper, halfDigitHeight, digitWidth)
394 | setHeightAndWidthToView(firstDigitSecond.backUpper, halfDigitHeight, digitWidth)
395 | setHeightAndWidthToView(secondDigitSecond.frontUpper, halfDigitHeight, digitWidth)
396 | setHeightAndWidthToView(secondDigitSecond.backUpper, halfDigitHeight, digitWidth)
397 |
398 | // Lower
399 | setHeightAndWidthToView(firstDigitDays.frontLower, halfDigitHeight, digitWidth)
400 | setHeightAndWidthToView(firstDigitDays.backLower, halfDigitHeight, digitWidth)
401 | setHeightAndWidthToView(secondDigitDays.frontLower, halfDigitHeight, digitWidth)
402 | setHeightAndWidthToView(secondDigitDays.backLower, halfDigitHeight, digitWidth)
403 | setHeightAndWidthToView(firstDigitHours.frontLower, halfDigitHeight, digitWidth)
404 | setHeightAndWidthToView(firstDigitHours.backLower, halfDigitHeight, digitWidth)
405 | setHeightAndWidthToView(secondDigitHours.frontLower, halfDigitHeight, digitWidth)
406 | setHeightAndWidthToView(secondDigitHours.backLower, halfDigitHeight, digitWidth)
407 | setHeightAndWidthToView(firstDigitMinute.frontLower, halfDigitHeight, digitWidth)
408 | setHeightAndWidthToView(firstDigitMinute.backLower, halfDigitHeight, digitWidth)
409 | setHeightAndWidthToView(secondDigitMinute.frontLower, halfDigitHeight, digitWidth)
410 | setHeightAndWidthToView(secondDigitMinute.backLower, halfDigitHeight, digitWidth)
411 | setHeightAndWidthToView(firstDigitSecond.frontLower, halfDigitHeight, digitWidth)
412 | setHeightAndWidthToView(firstDigitSecond.backLower, halfDigitHeight, digitWidth)
413 | setHeightAndWidthToView(secondDigitSecond.frontLower, halfDigitHeight, digitWidth)
414 | setHeightAndWidthToView(secondDigitSecond.backLower, halfDigitHeight, digitWidth)
415 |
416 | // Dividers
417 | firstDigitDays.digitDivider.layoutParams.width = digitWidth
418 | secondDigitDays.digitDivider.layoutParams.width = digitWidth
419 | firstDigitHours.digitDivider.layoutParams.width = digitWidth
420 | secondDigitHours.digitDivider.layoutParams.width = digitWidth
421 | firstDigitMinute.digitDivider.layoutParams.width = digitWidth
422 | secondDigitMinute.digitDivider.layoutParams.width = digitWidth
423 | firstDigitSecond.digitDivider.layoutParams.width = digitWidth
424 | secondDigitSecond.digitDivider.layoutParams.width = digitWidth
425 | }
426 |
427 | private fun setHeightAndWidthToView(view: View, halfDigitHeight: Int, digitWidth: Int) {
428 | val firstDigitMinuteFrontUpperLayoutParams = view.layoutParams
429 | firstDigitMinuteFrontUpperLayoutParams.height = halfDigitHeight
430 | firstDigitMinuteFrontUpperLayoutParams.width = digitWidth
431 | firstDigitDays.frontUpper.layoutParams = firstDigitMinuteFrontUpperLayoutParams
432 | }
433 |
434 | private fun setAnimationDuration(animationDuration: Int) {
435 | firstDigitDays.setAnimationDuration(animationDuration.toLong())
436 | secondDigitDays.setAnimationDuration(animationDuration.toLong())
437 | firstDigitHours.setAnimationDuration(animationDuration.toLong())
438 | secondDigitHours.setAnimationDuration(animationDuration.toLong())
439 | firstDigitMinute.setAnimationDuration(animationDuration.toLong())
440 | secondDigitMinute.setAnimationDuration(animationDuration.toLong())
441 | firstDigitSecond.setAnimationDuration(animationDuration.toLong())
442 | secondDigitSecond.setAnimationDuration(animationDuration.toLong())
443 | }
444 |
445 | private fun setAlmostFinishedCallbackTimeInSeconds(almostFinishedCallbackTimeInSeconds: Int) {
446 | this.almostFinishedCallbackTimeInSeconds = almostFinishedCallbackTimeInSeconds
447 | }
448 |
449 | private fun setTransparentBackgroundColor() {
450 | val transparent = ContextCompat.getColor(context, R.color.transparent)
451 | firstDigitDays.frontLower.setBackgroundColor(transparent)
452 | firstDigitDays.backLower.setBackgroundColor(transparent)
453 | secondDigitDays.frontLower.setBackgroundColor(transparent)
454 | secondDigitDays.backLower.setBackgroundColor(transparent)
455 | firstDigitHours.frontLower.setBackgroundColor(transparent)
456 | firstDigitHours.backLower.setBackgroundColor(transparent)
457 | secondDigitHours.frontLower.setBackgroundColor(transparent)
458 | secondDigitHours.backLower.setBackgroundColor(transparent)
459 | firstDigitMinute.frontLower.setBackgroundColor(transparent)
460 | firstDigitMinute.backLower.setBackgroundColor(transparent)
461 | secondDigitMinute.frontLower.setBackgroundColor(transparent)
462 | secondDigitMinute.backLower.setBackgroundColor(transparent)
463 | firstDigitSecond.frontLower.setBackgroundColor(transparent)
464 | firstDigitSecond.backLower.setBackgroundColor(transparent)
465 | secondDigitSecond.frontLower.setBackgroundColor(transparent)
466 | secondDigitSecond.backLower.setBackgroundColor(transparent)
467 | }
468 |
469 | ////////////////
470 | // Listeners
471 | ////////////////
472 |
473 | fun setCountdownListener(countdownListener: CountdownCallBack) {
474 | this.countdownListener = countdownListener
475 | }
476 |
477 | interface CountdownCallBack {
478 | fun countdownAboutToFinish()
479 | fun countdownFinished()
480 | }
481 |
482 |
483 | fun pauseCountDownTimer() {
484 | countDownTimer?.cancel()
485 | }
486 |
487 | fun resumeCountDownTimer() {
488 | startCountDown(milliLeft)
489 | }
490 |
491 |
492 | fun setCustomTypeface(typeface : Typeface){
493 | firstDigitDays.setTypeFace(typeface)
494 | firstDigitDays.setTypeFace(typeface)
495 | secondDigitDays.setTypeFace(typeface)
496 | secondDigitDays.setTypeFace(typeface)
497 | firstDigitHours.setTypeFace(typeface)
498 | firstDigitHours.setTypeFace(typeface)
499 | secondDigitHours.setTypeFace(typeface)
500 | secondDigitHours.setTypeFace(typeface)
501 | firstDigitMinute.setTypeFace(typeface)
502 | firstDigitMinute.setTypeFace(typeface)
503 | secondDigitMinute.setTypeFace(typeface)
504 | secondDigitMinute.setTypeFace(typeface)
505 | firstDigitSecond.setTypeFace(typeface)
506 | firstDigitSecond.setTypeFace(typeface)
507 | secondDigitSecond.setTypeFace(typeface)
508 | secondDigitSecond.setTypeFace(typeface)
509 |
510 | }
511 |
512 |
513 | }
514 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/java/com/asp/fliptimerviewlibrary/CountdownDigit.kt:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimerviewlibrary
2 |
3 | import android.content.Context
4 | import android.graphics.Typeface
5 | import android.util.AttributeSet
6 | import android.view.animation.AccelerateInterpolator
7 | import android.view.animation.DecelerateInterpolator
8 | import android.widget.FrameLayout
9 | import kotlinx.android.synthetic.main.view_countdown_clock_digit.view.*
10 |
11 | class CountDownDigit : FrameLayout {
12 | private var animationDuration = 600L
13 |
14 | constructor(context: Context?) : super(context)
15 | constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
16 | constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
17 |
18 | init {
19 | inflate(context, R.layout.view_countdown_clock_digit, this)
20 |
21 | frontUpperText.measure(0, 0)
22 | frontLowerText.measure(0, 0)
23 | backUpperText.measure(0, 0)
24 | backLowerText.measure(0, 0)
25 | }
26 |
27 | fun setNewText(newText: String) {
28 | frontUpper.clearAnimation()
29 | frontLower.clearAnimation()
30 |
31 | frontUpperText.text = newText
32 | frontLowerText.text = newText
33 | backUpperText.text = newText
34 | backLowerText.text = newText
35 | }
36 |
37 | fun animateTextChange(newText: String) {
38 | if (backUpperText.text == newText) {
39 | return
40 | }
41 |
42 | frontUpper.clearAnimation()
43 | frontLower.clearAnimation()
44 |
45 | backUpperText.text = newText
46 | frontUpper.pivotY = frontUpper.bottom.toFloat()
47 | frontLower.pivotY = frontUpper.top.toFloat()
48 | frontUpper.pivotX = (frontUpper.right - ((frontUpper.right - frontUpper.left) / 2)).toFloat()
49 | frontLower.pivotX = (frontUpper.right - ((frontUpper.right - frontUpper.left) / 2)).toFloat()
50 |
51 | frontUpper.animate().setDuration(getHalfOfAnimationDuration()).rotationX(-90f).setInterpolator(AccelerateInterpolator())
52 | .withEndAction {
53 | frontUpperText.text = backUpperText.text
54 | frontUpper.rotationX = 0f
55 | frontLower.rotationX = 90f
56 | frontLowerText.text = backUpperText.text
57 | frontLower.animate().setDuration(getHalfOfAnimationDuration()).rotationX(0f).setInterpolator(DecelerateInterpolator())
58 | .withEndAction {
59 | backLowerText.text = frontLowerText.text
60 | }.start()
61 | }.start()
62 | }
63 |
64 | fun setAnimationDuration(duration: Long) {
65 | this.animationDuration = duration
66 | }
67 |
68 | private fun getHalfOfAnimationDuration(): Long {
69 | return animationDuration / 2
70 | }
71 |
72 |
73 | fun setTypeFace(typeFace: Typeface){
74 |
75 | frontUpperText.typeface = typeFace
76 | frontLowerText.typeface = typeFace
77 | backUpperText.typeface = typeFace
78 | backLowerText.typeface = typeFace
79 |
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/font/amaticsc_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/fliptimerviewlibrary/src/main/res/font/amaticsc_regular.ttf
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/font/roboto_bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/fliptimerviewlibrary/src/main/res/font/roboto_bold.ttf
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/layout/view_countdown_clock_digit.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
21 |
22 |
34 |
35 |
36 |
40 |
41 |
53 |
54 |
55 |
56 |
61 |
62 |
66 |
67 |
79 |
80 |
81 |
85 |
86 |
98 |
99 |
100 |
101 |
107 |
108 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/layout/view_simple_clock.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
21 |
22 |
30 |
31 |
32 |
42 |
43 |
44 |
45 |
49 |
50 |
56 |
57 |
64 |
65 |
76 |
77 |
78 |
79 |
83 |
84 |
90 |
91 |
98 |
99 |
110 |
111 |
112 |
113 |
117 |
118 |
124 |
125 |
132 |
133 |
134 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000
4 | #00ffffff
5 |
6 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10sp
4 | 12sp
5 | 14sp
6 | 16sp
7 | 18sp
8 | 20sp
9 | 22sp
10 | 24sp
11 | 48sp
12 |
13 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FlipTimerViewLibrary
3 | Days
4 | Hours
5 | Mins
6 | Secs
7 | 8
8 |
9 |
--------------------------------------------------------------------------------
/fliptimerviewlibrary/src/test/java/com/asp/fliptimerviewlibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.asp.fliptimerviewlibrary;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
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 | # Kotlin code style for this project: "official" or "obsolete":
15 | kotlin.code.style=official
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jun 04 16:38:38 IST 2019
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-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/imgs/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anugotta/FlipTimerView/c08f6441d5c889cfe6eacac21ccaed8fa2352df3/imgs/preview.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':fliptimerviewlibrary'
2 |
--------------------------------------------------------------------------------