├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── libraries
│ └── library_2_4_0.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── Screenshots
├── TimelyTimeView_screenshot.gif
└── TimelyView_Screenshot.gif
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── proguard-project.txt
├── sample
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── mbh
│ │ └── timelyview
│ │ └── sample
│ │ ├── MainActivity.java
│ │ ├── TimelyTimeViewActivity.java
│ │ └── TimelyViewActivity.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── layout
│ ├── activity_main.xml
│ ├── activity_timely_time_view.xml
│ └── activity_timely_view.xml
│ ├── menu
│ └── main.xml
│ ├── values-sw720dp-land
│ └── dimens.xml
│ ├── values-v11
│ └── styles.xml
│ ├── values-v14
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── arrays.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── settings.gradle
└── timelyview
├── .gitignore
├── build.gradle
└── src
└── main
├── AndroidManifest.xml
├── java
└── com
│ └── mbh
│ └── timelyview
│ ├── TimelyShortTimeView.java
│ ├── TimelyTimeCommon.java
│ ├── TimelyTimeUtils.java
│ ├── TimelyTimeView.java
│ ├── TimelyView.java
│ ├── animation
│ └── TimelyEvaluator.java
│ └── model
│ ├── NumberUtils.java
│ ├── core
│ └── Figure.java
│ └── number
│ ├── Eight.java
│ ├── Five.java
│ ├── Four.java
│ ├── Nine.java
│ ├── Null.java
│ ├── One.java
│ ├── Seven.java
│ ├── Six.java
│ ├── Three.java
│ ├── Two.java
│ └── Zero.java
└── res
├── layout
├── timely_shorttimeview_layout.xml
└── timely_timeview_layout.xml
└── values
├── attrs.xml
├── strings.xml
└── styles.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/android,intellij
2 |
3 | ### Android ###
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the ART/Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 | out/
18 |
19 | # Gradle files
20 | .gradle/
21 | build/
22 |
23 | # Local configuration file (sdk path, etc)
24 | local.properties
25 |
26 | # Proguard folder generated by Eclipse
27 | proguard/
28 |
29 | # Log Files
30 | *.log
31 |
32 | # Android Studio Navigation editor temp files
33 | .navigation/
34 |
35 | # Android Studio captures folder
36 | captures/
37 |
38 | # Intellij
39 | *.iml
40 | .idea/workspace.xml
41 | .idea/tasks.xml
42 | .idea/libraries
43 |
44 | # Keystore files
45 | *.jks
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | ### Android Patch ###
51 | gen-external-apklibs
52 |
53 |
54 | ### Intellij ###
55 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
56 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
57 |
58 | # User-specific stuff:
59 |
60 | # Sensitive or high-churn files:
61 | .idea/dataSources/
62 | .idea/dataSources.ids
63 | .idea/dataSources.xml
64 | .idea/dataSources.local.xml
65 | .idea/sqlDataSources.xml
66 | .idea/dynamic.xml
67 | .idea/uiDesigner.xml
68 |
69 | # Gradle:
70 | .idea/gradle.xml
71 |
72 | # Mongo Explorer plugin:
73 | .idea/mongoSettings.xml
74 |
75 | ## File-based project format:
76 | *.iws
77 |
78 | ## Plugin-specific files:
79 |
80 | # IntelliJ
81 | /out/
82 |
83 | # mpeltonen/sbt-idea plugin
84 | .idea_modules/
85 |
86 | # JIRA plugin
87 | atlassian-ide-plugin.xml
88 |
89 | # Crashlytics plugin (for Android Studio and IntelliJ)
90 | com_crashlytics_export_strings.xml
91 | crashlytics.properties
92 | crashlytics-build.properties
93 | fabric.properties
94 |
95 | ### Intellij Patch ###
96 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
97 |
98 | # *.iml
99 | # modules.xml
100 | # .idea/misc.xml
101 | # *.ipr
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/libraries/library_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.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 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.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 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | TimelyView
2 | ==============
3 |
4 | [](https://jitpack.io/#iballan/TimelyView)
5 |
6 | ## Animated Time View like Timely app
7 |
8 | Screenshots:
9 | --------
10 |
11 |  
12 |
13 |
14 |
15 | Usage :
16 |
17 | XML Layout:
18 | ``` xml
19 |
27 |
28 |
29 |
36 | ```
37 |
38 | Java:
39 | ``` java
40 | public class MainActivity extends Activity {
41 | private TimelyTimeView ttv;
42 | TimelyShortTimeView tstv_hours;
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_main);
47 | // TimelyTimeView
48 | ttv = (TimelyTimeView) findViewById(R.id.ttv);
49 | ttv.setTextColor(Color.WHITE);
50 | ttv.setSeperatorsTextSize(50);
51 |
52 | // Then whenever you want to set the time and animate to it
53 | ttv.setTime("00:00:00"); // As formatted String
54 | // OR
55 | ttv.setTime(new int[]{12:12:12});
56 | // OR
57 | ttv.setTime(new Date());
58 |
59 | // ------------------
60 | // TimelyShortTimeView for (hour:min)
61 | tstv_hours = (TimelyShortTimeView) findViewById(R.id.tstv_hours);
62 | tstv_hours.setTextColor(Color.BLACK);
63 | tstv_hours.setTimeFormat(TimelyShortTimeView.FORMAT_HOUR_MIN); // can be set as TimelyShortTimeView.FORMAT_MIN_SEC
64 | tstv_hours.setSeperatorsTextSize(50);
65 |
66 | // Then whenever you want to set the time and animate to it
67 | ttv.setTime("00:00"); // As formatted String
68 | // OR
69 | ttv.setTime(new int[]{20:20});
70 | // OR
71 | ttv.setTime(new Date());
72 | // OR
73 | long timeAsMilliseconds = new Date().getTime();
74 | ttv.setTime(timeAsMilliseconds);
75 | }
76 | }
77 | ```
78 |
79 | Install
80 | --------
81 |
82 | You can install using Gradle:
83 |
84 | ```gradle
85 | repositories {
86 | maven { url "https://jitpack.io" }
87 | }
88 | dependencies {
89 | compile 'com.github.iballan:TimelyView:1.0.2'
90 | }
91 | ```
92 |
93 | Contact me:
94 | --------
95 |
96 | Twitter: [@mbh01t](https://twitter.com/mbh01t)
97 |
98 | Github: [iballan](https://github.com/iballan)
99 |
100 | Website: [www.mbh01.com](http://mbh01.com)
101 |
102 | Credits:
103 | --------
104 |
105 | TimelyTextView : https://github.com/adnan-SM/TimelyTextView
106 |
107 | Sriram Ramani article : http://sriramramani.wordpress.com/2013/10/14/number-tweening/
108 |
109 | License
110 | --------
111 |
112 | Copyright 2014 Mohamad Ballan.
113 |
114 | Licensed under the Apache License, Version 2.0 (the "License");
115 | you may not use this file except in compliance with the License.
116 | You may obtain a copy of the License at
117 |
118 | http://www.apache.org/licenses/LICENSE-2.0
119 |
120 | Unless required by applicable law or agreed to in writing, software
121 | distributed under the License is distributed on an "AS IS" BASIS,
122 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123 | See the License for the specific language governing permissions and
124 | limitations under the License.
--------------------------------------------------------------------------------
/Screenshots/TimelyTimeView_screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/Screenshots/TimelyTimeView_screenshot.gif
--------------------------------------------------------------------------------
/Screenshots/TimelyView_Screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/Screenshots/TimelyView_Screenshot.gif
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | // mavenCentral()
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.2.2'
8 | }
9 | }
10 |
11 | allprojects {
12 | repositories {
13 | // mavenCentral()
14 | jcenter()
15 | }
16 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 20 17:09:14 EEST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 | gradle.properties
18 |
19 | # Eclipse project files
20 | .classpath
21 | .project
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Intellij project files
27 | *.iml
28 | *.ipr
29 | *.iws
30 | .idea/
31 |
32 | # OSX files
33 | .DS_Store
34 | .gradle
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 25
10 | versionCode 2
11 | versionName "1.0.1"
12 | }
13 |
14 | compileOptions {
15 | sourceCompatibility JavaVersion.VERSION_1_7
16 | targetCompatibility JavaVersion.VERSION_1_7
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile project(':timelyview')
28 | compile 'com.android.support:appcompat-v7:25.0.1'
29 | }
30 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mbh/timelyview/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.Menu;
6 | import android.view.View;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 | }
15 |
16 | public void btn_timelyTimeViewClicked(View v){
17 | TimelyTimeViewActivity.start(MainActivity.this);
18 | }
19 | public void btn_timelyViewClicked(View v){
20 | TimelyViewActivity.start(MainActivity.this);
21 | }
22 |
23 | @Override
24 | public boolean onCreateOptionsMenu(Menu menu) {
25 | // Inflate the menu; this adds items to the action bar if it is present.
26 | getMenuInflater().inflate(R.menu.main, menu);
27 | return true;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mbh/timelyview/sample/TimelyTimeViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.sample;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 |
9 | import com.mbh.timelyview.TimelyShortTimeView;
10 | import com.mbh.timelyview.TimelyTimeView;
11 |
12 | import java.util.Date;
13 | import java.util.Timer;
14 | import java.util.TimerTask;
15 |
16 | public class TimelyTimeViewActivity extends AppCompatActivity {
17 |
18 | TimelyTimeView ttv;
19 | TimelyShortTimeView tstv_hours, tstv_mins;
20 | Timer timer;
21 |
22 | public static void start(Context context) {
23 | Intent starter = new Intent(context, TimelyTimeViewActivity.class);
24 | context.startActivity(starter);
25 | }
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_timely_time_view);
31 |
32 | ttv = (TimelyTimeView) findViewById(R.id.ttv);
33 | tstv_hours = (TimelyShortTimeView) findViewById(R.id.tstv_hours);
34 | tstv_mins = (TimelyShortTimeView) findViewById(R.id.tstv_mins);
35 |
36 | // Full time 00:00:00
37 | ttv.setTextColor(Color.WHITE);
38 | ttv.setSeperatorsTextSize(50);
39 | ttv.setTime(new int[]{99, 99, 99});
40 | ttv.setTime(new int[]{0, 0, 0});
41 |
42 | // Short time *HOURS:MINUTES* 00:00
43 | tstv_hours.setTextColor(Color.BLACK);
44 | tstv_hours.setTimeFormat(TimelyShortTimeView.FORMAT_HOUR_MIN);
45 | tstv_hours.setSeperatorsTextSize(50);
46 | tstv_hours.setTime("99:99");
47 | tstv_hours.setTime("00:00");
48 |
49 | // Short time *MINUTES:SECONDS* 00:00
50 | tstv_mins.setTextColor(Color.WHITE);
51 | tstv_mins.setTimeFormat(TimelyShortTimeView.FORMAT_MIN_SEC);
52 | tstv_mins.setSeperatorsTextSize(50);
53 | tstv_mins.setStrokeWidth(20f);
54 | tstv_mins.setTime("99:99");
55 | tstv_mins.setTime("00:00");
56 | }
57 |
58 | @Override
59 | protected void onResume() {
60 | super.onResume();
61 | timer = new Timer();
62 | timer.scheduleAtFixedRate(getTimerTask(), 1500, 1000);
63 | }
64 |
65 | @Override
66 | protected void onPause() {
67 | super.onPause();
68 | timer.cancel();
69 | timer = null;
70 | }
71 |
72 | private TimerTask getTimerTask() {
73 | return new TimerTask() {
74 | @Override
75 | public void run() {
76 | runOnUiThread(new Runnable() {
77 | @Override
78 | public void run() {
79 | Date now = new Date();
80 | ttv.setTime(now);
81 |
82 | tstv_mins.setTime(now.getTime()); // You give as milliseconds
83 | tstv_hours.setTime(now);
84 | }
85 | });
86 | }
87 | };
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/mbh/timelyview/sample/TimelyViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.sample;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.View;
10 | import android.widget.AdapterView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.SeekBar;
13 | import android.widget.Spinner;
14 |
15 | import com.mbh.timelyview.TimelyView;
16 | import com.nineoldandroids.animation.ObjectAnimator;
17 |
18 | import java.util.Random;
19 |
20 | public class TimelyViewActivity extends AppCompatActivity {
21 | public static final int DURATION = 1000;
22 | public static final int NO_VALUE = -1;
23 | private TimelyView timelyView = null;
24 | private SeekBar seekBar = null;
25 | private Spinner fromSpinner = null;
26 | private Spinner toSpinner = null;
27 | private volatile ObjectAnimator objectAnimator = null;
28 |
29 | private volatile int from = NO_VALUE;
30 | private volatile int to = NO_VALUE;
31 | Handler handler;
32 | public int getRandomColor(){
33 | Random rnd = new Random();
34 | return Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
35 | }
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_timely_view);
41 |
42 | timelyView = (TimelyView) findViewById(R.id.textView1);
43 | seekBar = (SeekBar) findViewById(R.id.seekBar);
44 | fromSpinner = (Spinner) findViewById(R.id.fromSpinner);
45 | toSpinner = (Spinner) findViewById(R.id.toSpinner);
46 |
47 | handler = new Handler();
48 |
49 | new Thread(new Runnable() {
50 | @Override
51 | public void run() {
52 | for (int i = 0; i <10; i++) {
53 | final int from = i;
54 | final int to = i==9?0:i+1;
55 | handler.postDelayed(new Runnable() {
56 | @Override
57 | public void run() {
58 | timelyView.setTextColor(getRandomColor());
59 | timelyView.animate(from, to).start();
60 | }
61 | }, 900);
62 | try{Thread.sleep(1000);}catch (Exception e){}
63 | }
64 | }
65 | }).start();
66 |
67 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.from_numbers_array, android.R.layout.simple_spinner_item);
68 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
69 | fromSpinner.setAdapter(adapter);
70 | toSpinner.setAdapter(adapter);
71 | fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
72 | @Override
73 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
74 | from = position - 1;
75 | if(from != NO_VALUE && to != NO_VALUE) {
76 | objectAnimator = timelyView.animate(from, to);
77 | objectAnimator.setDuration(DURATION);
78 | } else {
79 | objectAnimator = null;
80 | }
81 | }
82 |
83 | @Override
84 | public void onNothingSelected(AdapterView> parent) {
85 | }
86 | });
87 | toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
88 | @Override
89 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
90 | to = position - 1;
91 | if(from != NO_VALUE && to != NO_VALUE) {
92 | objectAnimator = timelyView.animate(from, to);
93 | objectAnimator.setDuration(DURATION);
94 | } else {
95 | objectAnimator = null;
96 | }
97 | }
98 |
99 | @Override
100 | public void onNothingSelected(AdapterView> parent) {
101 |
102 | }
103 | });
104 |
105 | seekBar.setMax(DURATION);
106 | seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
107 | @Override
108 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
109 | if(objectAnimator != null) objectAnimator.setCurrentPlayTime(progress);
110 | }
111 | @Override
112 | public void onStartTrackingTouch(SeekBar seekBar) {}
113 | @Override
114 | public void onStopTrackingTouch(SeekBar seekBar) {}
115 | });
116 | }
117 |
118 | public static void start(Context context) {
119 | Intent starter = new Intent(context, TimelyViewActivity.class);
120 | context.startActivity(starter);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/sample/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/sample/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iballan/TimelyView/cc9e6dad2fc1791f9eee1674f8ae86f28d01a385/sample/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_timely_time_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_timely_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
29 |
30 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
56 |
57 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - Pick a number
5 | - 0
6 | - 1
7 | - 2
8 | - 3
9 | - 4
10 | - 5
11 | - 6
12 | - 7
13 | - 8
14 | - 9
15 |
16 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Timely View
5 | Settings
6 |
7 | Timely View
8 | Timely Time View
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':timelyview'
2 | include ':sample'
--------------------------------------------------------------------------------
/timelyview/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 | gradle.properties
18 |
19 | # Eclipse project files
20 | .classpath
21 | .project
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Intellij project files
27 | *.iml
28 | *.ipr
29 | *.iws
30 | .idea/
31 |
32 | # OSX files
33 | .DS_Store
34 | .gradle
--------------------------------------------------------------------------------
/timelyview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | dependencies {
4 | compile 'com.nineoldandroids:library:2.4.0'
5 | }
6 |
7 | android {
8 | compileSdkVersion 25
9 | buildToolsVersion "25.0.1"
10 |
11 | defaultConfig {
12 | minSdkVersion 1
13 | targetSdkVersion 25
14 | versionCode 2
15 | versionName "1.0.1"
16 | }
17 |
18 | compileOptions {
19 | sourceCompatibility JavaVersion.VERSION_1_7
20 | targetCompatibility JavaVersion.VERSION_1_7
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/timelyview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/TimelyShortTimeView.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.os.Build;
6 | import android.util.AttributeSet;
7 | import android.util.SparseArray;
8 | import android.widget.TextView;
9 |
10 | import java.util.Calendar;
11 | import java.util.Date;
12 |
13 | /**
14 | * Created By MBH on 2016-10-05.
15 | */
16 |
17 | public class TimelyShortTimeView extends TimelyTimeCommon {
18 | private int timeFormat = 1; // Default HOUR_MIN;
19 | public static final int FORMAT_HOUR_MIN = 1;
20 | public static final int FORMAT_MIN_SEC = 2;
21 |
22 | private int[] timeIntArr = {0,0};
23 |
24 | public TimelyShortTimeView(Context context) {
25 | super(context);
26 | }
27 |
28 | public TimelyShortTimeView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public TimelyShortTimeView(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | }
35 |
36 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
37 | public TimelyShortTimeView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
38 | super(context, attrs, defStyleAttr, defStyleRes);
39 | }
40 |
41 | @Override
42 | protected void init() {
43 | inflate(getContext(), R.layout.timely_shorttimeview_layout, this);
44 |
45 | h_left = (TimelyView) findViewById(R.id.ttv_hours_left);
46 | h_right = (TimelyView) findViewById(R.id.ttv_hours_right);
47 | min_left = (TimelyView) findViewById(R.id.ttv_minutes_left);
48 | min_right = (TimelyView) findViewById(R.id.ttv_minutes_right);
49 |
50 | seperator1 = (TextView) findViewById(R.id.tv_seperator1);
51 |
52 | array_timelyViews = new SparseArray<>();
53 | array_seperators = new SparseArray<>();
54 |
55 | array_timelyViews.put(0, h_left);
56 | array_timelyViews.put(1, h_right);
57 | array_timelyViews.put(2, min_left);
58 | array_timelyViews.put(3, min_right);
59 |
60 |
61 | array_seperators.put(0, seperator1);
62 |
63 |
64 | for (int i = 0; i < array_timelyViews.size(); i++){
65 | array_timelyViews.valueAt(i).setTextColorAndCorner(textColor, isRoundedCorner);
66 | }
67 |
68 | for (int i = 0; i < array_seperators.size(); i++){
69 | TextView tv = array_seperators.valueAt(i);
70 | tv.setTextColor(textColor);
71 | tv.setTextSize(seperatorsTextSize);
72 | }
73 | }
74 |
75 | @Override
76 | boolean isShortTime() {
77 | return true;
78 | }
79 |
80 | @Override
81 | protected void setTimeToTimelyViews(int[] timeArray) {
82 | animateCarefully(h_left, animationType==ANIMATION_ZOOM?-1:(timeIntArr[0] % 100) / 10,
83 | (timeArray[0] % 100) / 10);
84 | animateCarefully(h_right, animationType==ANIMATION_ZOOM?-1:timeIntArr[0]% 10,
85 | timeArray[0]% 10);
86 |
87 | animateCarefully(min_left, animationType==ANIMATION_ZOOM?-1:(timeIntArr[1] % 100) / 10,
88 | (timeArray[1] % 100) / 10);
89 | animateCarefully(min_right, animationType==ANIMATION_ZOOM?-1:timeIntArr[1]% 10,
90 | timeArray[1]% 10);
91 |
92 | timeIntArr = timeArray;
93 | }
94 |
95 | @Override
96 | public void setTime(Date date) {
97 | TimelyTimeUtils.checkNull(date);
98 | Calendar cal = Calendar.getInstance();
99 | cal.setTime(date);
100 | int[] tempArray = new int[2];
101 | if(timeFormat == FORMAT_HOUR_MIN){
102 | tempArray[0] = cal.get(Calendar.HOUR_OF_DAY);
103 | tempArray[1] = cal.get(Calendar.MINUTE);
104 | }else {
105 | tempArray[0] = cal.get(Calendar.MINUTE);
106 | tempArray[1] = cal.get(Calendar.SECOND);
107 | }
108 |
109 | setTimeIfNotEqual(tempArray, timeIntArr);
110 | }
111 |
112 | @Override
113 | public void setTime(int[] timeIntArray) {
114 | setTimeChecked(timeIntArray, timeIntArr);
115 | }
116 |
117 | /**
118 | * Set time formatted from string
119 | * @param formattedTime: time should be formatted as 00:00
120 | */
121 | @Override
122 | public void setTime(String formattedTime){
123 | TimelyTimeUtils.checkNull(formattedTime);
124 | if(formattedTime.length() != 5) // 5 = 00:00 as string length
125 | throw new IllegalArgumentException("Time format should be 00:00, not "+formattedTime);
126 | String[] splitted = formattedTime.split(":");
127 | if(splitted.length != 2) // 2 = 00 00 as splitted string
128 | throw new IllegalArgumentException("Time format should be 00:00, not "+formattedTime);
129 | int field1 = TimelyTimeUtils.tryParseInt(splitted[0], -1);
130 | int field2 = TimelyTimeUtils.tryParseInt(splitted[1], -1);
131 |
132 | setTime(new int[]{field1, field2});
133 | }
134 |
135 | @Override
136 | public void setTime(long milliseconds) {
137 | TimelyTimeUtils.checkValidPositiveLong(milliseconds);
138 | int field1, field2;
139 | if(timeFormat == FORMAT_HOUR_MIN){
140 | field1 = (int)((milliseconds / (1000*60*60)) % 24);// Hours
141 | field2 = (int) ((milliseconds / (1000*60)) % 60);// minutes
142 | }else {
143 | field1 = (int) ((milliseconds / (1000*60)) % 60); // minutes
144 | field2 = (int) (milliseconds / 1000) % 60 ; // seconds
145 | }
146 | TimelyTimeUtils.checkValidPositiveInt(field1);
147 | TimelyTimeUtils.checkValidPositiveInt(field2);
148 | setTime(new int[]{field1, field2});
149 | }
150 |
151 | public int getTimeFormat() {
152 | return timeFormat;
153 | }
154 |
155 | public void setTimeFormat(int timeFormat) {
156 | this.timeFormat = timeFormat;
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/TimelyTimeCommon.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Color;
7 | import android.os.Build;
8 | import android.util.AttributeSet;
9 | import android.util.SparseArray;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 |
13 | import com.nineoldandroids.animation.ObjectAnimator;
14 |
15 | import java.util.Date;
16 |
17 | /**
18 | * Created By MBH on 2016-10-05.
19 | */
20 |
21 | abstract class TimelyTimeCommon extends LinearLayout{
22 | public final static int ANIMATION_ZOOM = 1;
23 | public final static int ANIMATION_MATERIAL = 2;
24 |
25 | protected SparseArray array_timelyViews;
26 | protected SparseArray array_seperators;
27 | protected TimelyView h_left, h_right;
28 | protected TimelyView min_left, min_right;
29 |
30 | protected TextView seperator1;
31 |
32 | protected int textColor = Color.BLACK;
33 | protected boolean isRoundedCorner = true;
34 | protected int seperatorsTextSize = 16;
35 | protected float strokeWidth = 5.0f;
36 | protected int animationType = ANIMATION_MATERIAL;
37 |
38 | public TimelyTimeCommon(Context context) {
39 | super(context);
40 | init();
41 | }
42 |
43 | public TimelyTimeCommon(Context context, AttributeSet attrs) {
44 | super(context, attrs);
45 | init();
46 | }
47 |
48 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
49 | public TimelyTimeCommon(Context context, AttributeSet attrs, int defStyleAttr) {
50 | super(context, attrs, defStyleAttr);
51 | init();
52 | handleAttributes(context, attrs);
53 | }
54 |
55 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
56 | public TimelyTimeCommon(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
57 | super(context, attrs, defStyleAttr, defStyleRes);
58 | init();
59 | handleAttributes(context, attrs);
60 | }
61 |
62 | protected void animateCarefully(TimelyView timelyView, int start, int end){
63 | ObjectAnimator oa;
64 | if(start == -1) {
65 | oa = timelyView.animateCarefully(end);
66 | }else {
67 | oa = timelyView.animateCarefully(start, end);
68 | }
69 | if (oa != null) oa.start();
70 | }
71 |
72 | abstract void init();
73 |
74 |
75 | protected void handleAttributes(Context context, AttributeSet attrs) {
76 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TimelyView);
77 | textColor = typedArray.getColor(R.styleable.TimelyTimeView_text_color, Color.BLACK);
78 | isRoundedCorner = typedArray.getBoolean(R.styleable.TimelyTimeView_rounded_corner, true);
79 | seperatorsTextSize = typedArray.getInt(R.styleable.TimelyTimeView_seperatorsTextSize, 20);
80 | animationType = typedArray.getInt(R.styleable.TimelyTimeView_animation_type, ANIMATION_MATERIAL);
81 | strokeWidth = typedArray.getFloat(R.styleable.TimelyTimeView_stroke_width, 5.0f);
82 | typedArray.recycle();
83 | }
84 |
85 | abstract boolean isShortTime();
86 |
87 | abstract void setTimeToTimelyViews(int[] timeArray);
88 |
89 | abstract public void setTime(Date date);
90 |
91 | abstract public void setTime(int[] timeIntArray);
92 |
93 | abstract public void setTime(long milliseconds);
94 |
95 | abstract public void setTime(String formattedTime);
96 |
97 | public void setTextColor(int textColor){
98 | this.textColor = textColor;
99 | setTextColor(array_timelyViews, array_seperators, textColor);
100 | }
101 |
102 | public void setStrokeWidth(float strokeWidth){
103 | if(strokeWidth<=0f) throw new IllegalArgumentException("Stroke width must be more than 0");
104 | this.strokeWidth = strokeWidth;
105 | for (int i = 0; i < array_timelyViews.size(); i++){
106 | array_timelyViews.valueAt(i).setStrokeWidth(strokeWidth);
107 | }
108 | }
109 |
110 | /**
111 | * Set text color to all timelyviews and textviews(seperators)
112 | * @param _timelyViews: Array of timely views
113 | * @param _seperators: array of seperators
114 | * @param textColor: new text color to be set
115 | */
116 | protected void setTextColor(SparseArray _timelyViews , SparseArray _seperators, int textColor){
117 |
118 | for (int i = 0; i < _timelyViews.size(); i++){
119 | _timelyViews.valueAt(i).setTextColor(textColor);
120 | }
121 |
122 | for (int i = 0; i < _seperators.size(); i++){
123 | _seperators.valueAt(i).setTextColor(textColor);
124 | }
125 | }
126 |
127 | /**
128 | * This will check the arrays before applying it to the TimelyViews, cuz the array will be provided by user
129 | * @param newArray: New array provided by user
130 | * @param olderArray: Array that present the previous time
131 | */
132 | protected void setTimeChecked(int[] newArray, int[] olderArray){
133 | TimelyTimeUtils.checkTimelyTimeArray(newArray, isShortTime());
134 | setTimeIfNotEqual(newArray, olderArray);
135 | }
136 |
137 | /**
138 | * Start animation if new time different from the older one, otherwise do nothing
139 | * @param arrayToShow: Array needs to be shown
140 | * @param prevArray: Array that present the previous time
141 | */
142 | protected void setTimeIfNotEqual(int[] arrayToShow, int[] prevArray){
143 | if(TimelyTimeUtils.compareArrays(arrayToShow, prevArray)){
144 | return;
145 | }
146 | setTimeToTimelyViews(arrayToShow);
147 | }
148 |
149 | /**
150 | * Will change the (":") seperators text size which is not included in the timely views
151 | * @param _seperators: seperators textviews
152 | * @param seperatorsTextSize: text size to be set
153 | */
154 | private void setSeperatorsTextSize(SparseArray _seperators,int seperatorsTextSize){
155 | for (int i = 0; i < _seperators.size(); i++){
156 | _seperators.valueAt(i).setTextSize(seperatorsTextSize);
157 | }
158 | }
159 |
160 | private void setRoundedCorner(SparseArray _timelyViews,boolean isRoundedCorner){
161 | for (int i = 0; i < _timelyViews.size(); i++){
162 | _timelyViews.valueAt(i).setRoundedCorner(isRoundedCorner);
163 | }
164 | }
165 |
166 | public void setSeperatorsTextSize(int seperatorsTextSize){
167 | if(seperatorsTextSize <= 0) throw new IllegalArgumentException("Textsize cannot be less than or equals to 0");
168 | this.seperatorsTextSize = seperatorsTextSize;
169 | setSeperatorsTextSize(array_seperators, seperatorsTextSize);
170 | }
171 |
172 | private void setRoundedCorner(boolean isRoundedCorner){
173 | this.isRoundedCorner = isRoundedCorner;
174 | setRoundedCorner(array_timelyViews, isRoundedCorner);
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/TimelyTimeUtils.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview;
2 |
3 | /**
4 | * Created By MBH on 2016-10-03.
5 | */
6 |
7 | class TimelyTimeUtils {
8 | static boolean compareArrays(int[] array1, int[] array2) {
9 | if (array1 != null && array2 != null){
10 | if (array1.length != array2.length)
11 | return false;
12 | else
13 | for (int i = 0; i < array2.length; i++) {
14 | if (array2[i] != array1[i]) {
15 | return false;
16 | }
17 | }
18 | }else{
19 | return false;
20 | }
21 | return true;
22 | }
23 |
24 | static void checkNull(Object object){
25 | if(object == null) throw new IllegalArgumentException("Argument cannot be null");
26 | }
27 |
28 | static void checkValidPositiveInt(int num){
29 | if(num < 0) throw new IllegalArgumentException("Number cannot be less than zero 0");
30 | }
31 |
32 | static void checkValidPositiveLong(long num){
33 | if(num < 0) throw new IllegalArgumentException("Number cannot be less than zero 0");
34 | }
35 |
36 | static void checkTimelyTimeArray(int [] timelyArray, boolean isShort){
37 | checkNull(timelyArray);
38 | int length = isShort?2:3;
39 | if(timelyArray.length != length) throw new IllegalArgumentException("Array should have 3 elements for Hour, Min, Sec");
40 | for (int timelyInt :
41 | timelyArray) {
42 | if(timelyInt<0) throw new IllegalArgumentException("Time cannot be less than Zero");
43 | }
44 | }
45 |
46 | static int tryParseInt (String str, int def){
47 | try {
48 | return Integer.parseInt(str);
49 | } catch (NumberFormatException e) {
50 | return def;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/TimelyTimeView.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.os.Build;
6 | import android.util.AttributeSet;
7 | import android.util.SparseArray;
8 | import android.widget.TextView;
9 |
10 | import java.util.Calendar;
11 | import java.util.Date;
12 |
13 | import static com.mbh.timelyview.TimelyTimeUtils.checkNull;
14 | import static com.mbh.timelyview.TimelyTimeUtils.checkValidPositiveInt;
15 | import static com.mbh.timelyview.TimelyTimeUtils.checkValidPositiveLong;
16 | import static com.mbh.timelyview.TimelyTimeUtils.tryParseInt;
17 |
18 | /**
19 | * Created By MBH on 2016-10-03.
20 | */
21 |
22 | public class TimelyTimeView extends TimelyTimeCommon {
23 | protected TimelyView sec_left, sec_right;
24 | protected TextView seperator2;
25 |
26 | private int[] timeIntArr = {0,0,0};
27 |
28 | public TimelyTimeView(Context context) {
29 | super(context);
30 | }
31 |
32 | public TimelyTimeView(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | }
35 |
36 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
37 | public TimelyTimeView(Context context, AttributeSet attrs, int defStyle) {
38 | super(context, attrs, defStyle);
39 | }
40 |
41 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
42 | public TimelyTimeView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
43 | super(context, attrs, defStyleAttr, defStyleRes);
44 | }
45 |
46 | @Override
47 | boolean isShortTime() {
48 | return false;
49 | }
50 |
51 | /**
52 | * Set time formatted from string
53 | * @param formattedTime: time should be formatted as 00:00:00
54 | */
55 | @Override
56 | public void setTime(String formattedTime){
57 | checkNull(formattedTime);
58 | if(formattedTime.length() != 8) // 8 = 00:00:00 as string length
59 | throw new IllegalArgumentException("Time format should be 00:00:00, not "+formattedTime);
60 | String[] splitted = formattedTime.split(":");
61 | if(splitted.length != 3) // 3 = 00 00 00 as splitted string
62 | throw new IllegalArgumentException("Time format should be 00:00:00, not "+formattedTime);
63 | int hour = tryParseInt(splitted[0], -1);
64 | int min = tryParseInt(splitted[1], -1);
65 | int sec = tryParseInt(splitted[2], -1);
66 |
67 | setTime(new int[]{hour, min, sec});
68 | }
69 |
70 | @Override
71 | public void setTime(int[] timeIntArray){
72 | setTimeChecked(timeIntArray, timeIntArr);
73 | }
74 |
75 | @Override
76 | public void setTime(long milliseconds) {
77 | checkValidPositiveLong(milliseconds);
78 | final int hour = (int)((milliseconds / (1000*60*60)) % 24);
79 | checkValidPositiveInt(hour);
80 | final int min = (int) ((milliseconds / (1000*60)) % 60);
81 | checkValidPositiveInt(min);
82 | final int sec = (int) (milliseconds / 1000) % 60;
83 | checkValidPositiveInt(sec);
84 | setTime(new int[]{hour, min, sec});
85 | }
86 |
87 | @Override
88 | public void setTime(Date date){
89 | checkNull(date);
90 | Calendar cal = Calendar.getInstance();
91 | cal.setTime(date);
92 | int[] tempArray = new int[3];
93 | tempArray[0] = cal.get(Calendar.HOUR_OF_DAY);
94 | tempArray[1] = cal.get(Calendar.MINUTE);
95 | tempArray[2] = cal.get(Calendar.SECOND);
96 |
97 | setTimeIfNotEqual(tempArray, timeIntArr);
98 | }
99 |
100 | @Override
101 | protected void setTimeToTimelyViews(int[] timeArray){
102 |
103 | animateCarefully(h_left, animationType==ANIMATION_ZOOM?-1:(timeIntArr[0] % 100) / 10,
104 | (timeArray[0] % 100) / 10);
105 | animateCarefully(h_right, animationType==ANIMATION_ZOOM?-1:timeIntArr[0]% 10,
106 | timeArray[0]% 10);
107 |
108 | animateCarefully(min_left, animationType==ANIMATION_ZOOM?-1:(timeIntArr[1] % 100) / 10,
109 | (timeArray[1] % 100) / 10);
110 | animateCarefully(min_right, animationType==ANIMATION_ZOOM?-1:timeIntArr[1]% 10,
111 | timeArray[1]% 10);
112 |
113 | animateCarefully(sec_left, animationType==ANIMATION_ZOOM?-1:(timeIntArr[2] % 100) / 10,
114 | (timeArray[2] % 100) / 10);
115 | animateCarefully(sec_right, animationType==ANIMATION_ZOOM?-1:timeIntArr[2]% 10,
116 | timeArray[2]% 10);
117 |
118 | timeIntArr = timeArray;
119 | }
120 |
121 | @Override
122 | protected void init() {
123 | inflate(getContext(), R.layout.timely_timeview_layout, this);
124 |
125 | h_left = (TimelyView) findViewById(R.id.ttv_hours_left);
126 | h_right = (TimelyView) findViewById(R.id.ttv_hours_right);
127 | min_left = (TimelyView) findViewById(R.id.ttv_minutes_left);
128 | min_right = (TimelyView) findViewById(R.id.ttv_minutes_right);
129 | sec_left = (TimelyView) findViewById(R.id.ttv_seconds_left);
130 | sec_right = (TimelyView) findViewById(R.id.ttv_seconds_right);
131 |
132 | seperator1 = (TextView) findViewById(R.id.tv_seperator1);
133 | seperator2 = (TextView) findViewById(R.id.tv_seperator2);
134 |
135 | array_timelyViews = new SparseArray<>();
136 | array_seperators = new SparseArray<>();
137 |
138 | array_timelyViews.put(0, h_left);
139 | array_timelyViews.put(1, h_right);
140 | array_timelyViews.put(2, min_left);
141 | array_timelyViews.put(3, min_right);
142 | array_timelyViews.put(4, sec_left);
143 | array_timelyViews.put(5, sec_right);
144 |
145 |
146 | array_seperators.put(0, seperator1);
147 | array_seperators.put(1, seperator2);
148 |
149 |
150 | for (int i = 0; i < array_timelyViews.size(); i++){
151 | array_timelyViews.valueAt(i).setTextColorAndCorner(textColor, isRoundedCorner);
152 | }
153 |
154 | for (int i = 0; i < array_seperators.size(); i++){
155 | TextView tv = array_seperators.valueAt(i);
156 | tv.setTextColor(textColor);
157 | tv.setTextSize(seperatorsTextSize);
158 | }
159 |
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/TimelyView.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.util.AttributeSet;
10 | import android.view.View;
11 |
12 | import com.mbh.timelyview.animation.TimelyEvaluator;
13 | import com.mbh.timelyview.model.NumberUtils;
14 | import com.nineoldandroids.animation.ObjectAnimator;
15 | import com.nineoldandroids.util.Property;
16 |
17 | public class TimelyView extends View {
18 | private static final float RATIO = 1f; // square
19 | // private static final float RATIO = 4f / 3f; // for any ratio
20 | private static final Property CONTROL_POINTS_PROPERTY = new Property(float[][].class, "controlPoints") {
21 | @Override
22 | public float[][] get(TimelyView object) {
23 | return object.getControlPoints();
24 | }
25 |
26 | @Override
27 | public void set(TimelyView object, float[][] value) {
28 | object.setControlPoints(value);
29 | }
30 | };
31 | int lastEnd = -1;
32 | int lastStart = -1;
33 | private Paint mPaint = null;
34 | private Path mPath = null;
35 | private float[][] controlPoints = null;
36 | private int textColor = Color.BLACK;
37 | private boolean isRoundedCorner = true;
38 | private float strokeWidth = 5.0f;
39 | private int width = 1;
40 | private int height = 1;
41 |
42 | public TimelyView(Context context) {
43 | super(context);
44 | init();
45 | }
46 |
47 | public TimelyView(Context context, AttributeSet attrs) {
48 | super(context, attrs);
49 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TimelyView);
50 | textColor = typedArray.getColor(R.styleable.TimelyView_text_color, Color.BLACK);
51 | isRoundedCorner = typedArray.getBoolean(R.styleable.TimelyView_rounded_corner, true);
52 | typedArray.recycle();
53 | init();
54 | }
55 |
56 | public TimelyView(Context context, AttributeSet attrs, int defStyleAttr) {
57 | super(context, attrs, defStyleAttr);
58 | init();
59 | }
60 |
61 | public void setTextColor(int color) {
62 | this.textColor = color;
63 | init();
64 | }
65 |
66 | public void setRoundedCorner(boolean isRoundedCorner) {
67 | this.isRoundedCorner = isRoundedCorner;
68 | init();
69 | }
70 |
71 | protected void setTextColorAndCorner(int textColor, boolean isRoundedCorner) {
72 | this.textColor = textColor;
73 | this.isRoundedCorner = isRoundedCorner;
74 | init();
75 | }
76 |
77 | public float[][] getControlPoints() {
78 | return controlPoints;
79 | }
80 |
81 | public void setControlPoints(float[][] controlPoints) {
82 | this.controlPoints = controlPoints;
83 | invalidate();
84 | }
85 |
86 | public ObjectAnimator animate(int start, int end) {
87 | lastEnd = end;
88 | lastStart = start;
89 | float[][] startPoints = NumberUtils.getControlPointsFor(start);
90 | float[][] endPoints = NumberUtils.getControlPointsFor(end);
91 |
92 | return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
93 | }
94 |
95 | public ObjectAnimator animate(int end) {
96 | lastEnd = end;
97 | float[][] startPoints = NumberUtils.getControlPointsFor(-1);
98 | float[][] endPoints = NumberUtils.getControlPointsFor(end);
99 |
100 | return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
101 | }
102 |
103 | protected ObjectAnimator animateCarefully(int end) {
104 | if (lastEnd == end) return null;
105 |
106 | return animate(end);
107 | }
108 |
109 | protected ObjectAnimator animateCarefully(int start, int end) {
110 | if (lastEnd == -1 || lastStart == -1) {
111 | lastEnd = end;
112 | lastStart = start;
113 | } else if (lastEnd == end && lastStart == start) {
114 | return null;
115 | }
116 |
117 | return animate(start, end);
118 | }
119 |
120 | @Override
121 | protected void onDraw(Canvas canvas) {
122 | super.onDraw(canvas);
123 | if (controlPoints == null) return;
124 |
125 | int length = controlPoints.length;
126 |
127 | final float minDimen = height > width ? width - strokeWidth : height - strokeWidth;
128 | mPath.reset();
129 | mPath.moveTo(minDimen * controlPoints[0][0], minDimen * controlPoints[0][1]);
130 | for (int i = 1; i < length; i += 3) {
131 | mPath.cubicTo(minDimen * controlPoints[i][0], minDimen * controlPoints[i][1],
132 | minDimen * controlPoints[i + 1][0], minDimen * controlPoints[i + 1][1],
133 | minDimen * controlPoints[i + 2][0], minDimen * controlPoints[i + 2][1]);
134 | }
135 | canvas.drawPath(mPath, mPaint);
136 | }
137 |
138 | @Override
139 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
140 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
141 |
142 | width = getMeasuredWidth();
143 | height = getMeasuredHeight();
144 | int widthWithoutPadding = width - getPaddingLeft() - getPaddingRight();
145 | int heigthWithoutPadding = height - getPaddingTop() - getPaddingBottom();
146 |
147 | int maxWidth = (int) (heigthWithoutPadding * RATIO);
148 | int maxHeight = (int) (widthWithoutPadding / RATIO);
149 |
150 | if (widthWithoutPadding > maxWidth) {
151 | width = maxWidth + getPaddingLeft() + getPaddingRight() + (int) (strokeWidth);
152 | } else {
153 | height = maxHeight + getPaddingTop() + getPaddingBottom() + (int) (strokeWidth);
154 | }
155 | setMeasuredDimension(width, height);
156 | }
157 |
158 | public float getStrokeWidth() {
159 | return strokeWidth;
160 | }
161 |
162 | public void setStrokeWidth(float strokeWidth) {
163 | this.strokeWidth = strokeWidth;
164 | init();
165 | }
166 |
167 | private void init() {
168 | // A new paint with the style as stroke.
169 | mPaint = new Paint();
170 | mPaint.setAntiAlias(true);
171 | mPaint.setColor(textColor);
172 | mPaint.setStrokeWidth(strokeWidth);
173 | mPaint.setStyle(Paint.Style.STROKE);
174 | if (isRoundedCorner) {
175 | mPaint.setStrokeJoin(Paint.Join.ROUND);
176 | mPaint.setStrokeCap(Paint.Cap.ROUND);
177 | }
178 | mPath = new Path();
179 | }
180 | }
181 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/animation/TimelyEvaluator.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.animation;
2 |
3 | import com.nineoldandroids.animation.TypeEvaluator;
4 |
5 | public class TimelyEvaluator implements TypeEvaluator {
6 | private float[][] _cachedPoints = null;
7 |
8 | @Override
9 | public float[][] evaluate(float fraction, float[][] startValue, float[][] endValue) {
10 | int pointsCount = startValue.length;
11 | initCache(pointsCount);
12 |
13 | for(int i = 0; i < pointsCount; i++) {
14 | _cachedPoints[i][0] = startValue[i][0] + fraction * (endValue[i][0] - startValue[i][0]);
15 | _cachedPoints[i][1] = startValue[i][1] + fraction * (endValue[i][1] - startValue[i][1]);
16 | }
17 |
18 | return _cachedPoints;
19 | }
20 |
21 | private void initCache(int pointsCount) {
22 | if(_cachedPoints == null || _cachedPoints.length != pointsCount) {
23 | _cachedPoints = new float[pointsCount][2];
24 | }
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/NumberUtils.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model;
2 |
3 |
4 | import com.mbh.timelyview.model.number.Eight;
5 | import com.mbh.timelyview.model.number.Five;
6 | import com.mbh.timelyview.model.number.Four;
7 | import com.mbh.timelyview.model.number.Nine;
8 | import com.mbh.timelyview.model.number.Null;
9 | import com.mbh.timelyview.model.number.One;
10 | import com.mbh.timelyview.model.number.Seven;
11 | import com.mbh.timelyview.model.number.Six;
12 | import com.mbh.timelyview.model.number.Three;
13 | import com.mbh.timelyview.model.number.Two;
14 | import com.mbh.timelyview.model.number.Zero;
15 |
16 | import java.security.InvalidParameterException;
17 |
18 | public class NumberUtils {
19 |
20 | public static float[][] getControlPointsFor(int start) {
21 | switch (start) {
22 | case (-1):
23 | return Null.getInstance().getControlPoints();
24 | case 0:
25 | return Zero.getInstance().getControlPoints();
26 | case 1:
27 | return One.getInstance().getControlPoints();
28 | case 2:
29 | return Two.getInstance().getControlPoints();
30 | case 3:
31 | return Three.getInstance().getControlPoints();
32 | case 4:
33 | return Four.getInstance().getControlPoints();
34 | case 5:
35 | return Five.getInstance().getControlPoints();
36 | case 6:
37 | return Six.getInstance().getControlPoints();
38 | case 7:
39 | return Seven.getInstance().getControlPoints();
40 | case 8:
41 | return Eight.getInstance().getControlPoints();
42 | case 9:
43 | return Nine.getInstance().getControlPoints();
44 | default:
45 | throw new InvalidParameterException("Unsupported number requested. Must be between -1,9");
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/core/Figure.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.core;
2 |
3 | /**
4 | * Model class for cubic bezier figure
5 | */
6 | public abstract class Figure {
7 | private static final int NO_VALUE = -1;
8 |
9 | private int pointsCount = NO_VALUE;
10 |
11 | //A chained sequence of points P0,P1,P2,P3/0,P1,P2,P3/0,...
12 | private float[][] controlPoints = null;
13 |
14 | protected Figure(float[][] controlPoints) {
15 | this.controlPoints = controlPoints;
16 | this.pointsCount = (controlPoints.length + 2) / 3;
17 | }
18 |
19 | public int getPointsCount() {
20 | return pointsCount;
21 | }
22 |
23 | public float[][] getControlPoints() {
24 | return controlPoints;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Eight.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Eight extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.558011049723757f, 0.530386740331492f}, {0.243093922651934f, 0.524861878453039f}, {0.243093922651934f, 0.104972375690608f},
8 | {0.558011049723757f, 0.104972375690608f}, {0.850828729281768f, 0.104972375690608f}, {0.850828729281768f, 0.530386740331492f},
9 | {0.558011049723757f, 0.530386740331492f}, {0.243093922651934f, 0.530386740331492f}, {0.198895027624309f, 0.988950276243094f},
10 | {0.558011049723757f, 0.988950276243094f}, {0.850828729281768f, 0.988950276243094f}, {0.850828729281768f, 0.530386740331492f},
11 | {0.558011049723757f, 0.530386740331492f}
12 | };
13 |
14 | private static Eight INSTANCE = new Eight();
15 |
16 | protected Eight() {
17 | super(POINTS);
18 | }
19 |
20 | public static Eight getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Five.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Five extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.806629834254144f, 0.110497237569061f}, {0.502762430939227f, 0.110497237569061f}, {0.502762430939227f, 0.110497237569061f},
8 | {0.502762430939227f, 0.110497237569061f}, {0.397790055248619f, 0.430939226519337f}, {0.397790055248619f, 0.430939226519337f},
9 | {0.397790055248619f, 0.430939226519337f}, {0.535911602209945f, 0.364640883977901f}, {0.801104972375691f, 0.469613259668508f},
10 | {0.801104972375691f, 0.712707182320442f}, {0.773480662983425f, 1.01104972375691f}, {0.375690607734807f, 1.0939226519337f},
11 | {0.248618784530387f, 0.850828729281768f}
12 | };
13 |
14 | private static Five INSTANCE = new Five();
15 |
16 | protected Five() {
17 | super(POINTS);
18 | }
19 |
20 | public static Five getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Four.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Four extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.856353591160221f, 0.806629834254144f}, {0.856353591160221f, 0.806629834254144f}, {0.237569060773481f, 0.806629834254144f},
8 | {0.237569060773481f, 0.806629834254144f}, {0.237569060773481f, 0.806629834254144f}, {0.712707182320442f, 0.138121546961326f},
9 | {0.712707182320442f, 0.138121546961326f}, {0.712707182320442f, 0.138121546961326f}, {0.712707182320442f, 0.806629834254144f},
10 | {0.712707182320442f, 0.806629834254144f}, {0.712707182320442f, 0.806629834254144f}, {0.712707182320442f, 0.988950276243094f},
11 | {0.712707182320442f, 0.988950276243094f}
12 |
13 | };
14 |
15 | private static Four INSTANCE = new Four();
16 |
17 | protected Four() {
18 | super(POINTS);
19 | }
20 |
21 | public static Four getInstance() {
22 | return INSTANCE;
23 | }
24 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Nine.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Nine extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.80939226519337f, 0.552486187845304f}, {0.685082872928177f, 0.751381215469613f}, {0.298342541436464f, 0.740331491712707f},
8 | {0.259668508287293f, 0.408839779005525f}, {0.232044198895028f, 0.0441988950276243f}, {0.81767955801105f, -0.0441988950276243f},
9 | {0.850828729281768f, 0.408839779005525f}, {0.839779005524862f, 0.596685082872928f}, {0.712707182320442f, 0.668508287292818f},
10 | {0.497237569060773f, 0.994475138121547f}, {0.497237569060773f, 0.994475138121547f}, {0.497237569060773f, 0.994475138121547f},
11 | {0.497237569060773f, 0.994475138121547f}
12 | };
13 |
14 | private static Nine INSTANCE = new Nine();
15 |
16 | protected Nine() {
17 | super(POINTS);
18 | }
19 |
20 | public static Nine getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Null.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 |
4 | import com.mbh.timelyview.model.core.Figure;
5 |
6 | public class Null extends Figure {
7 | private static final float[][] POINTS = {
8 | {0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
9 | {0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
10 | {0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
11 | {0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, 0.5f},
12 | {0.5f, 0.5f}
13 | };
14 |
15 | private static final Null INSTANCE = new Null();
16 |
17 | private Null() {
18 | super(POINTS);
19 | }
20 |
21 | public static Null getInstance() {
22 | return INSTANCE;
23 | }
24 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/One.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class One extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.425414364640884f, 0.113259668508287f}, {0.425414364640884f, 0.113259668508287f}, {0.577348066298343f, 0.113259668508287f},
8 | {0.577348066298343f, 0.113259668508287f}, {0.577348066298343f, 0.113259668508287f}, {0.577348066298343f, 1f},
9 | {0.577348066298343f, 1f}, {0.577348066298343f, 1f}, {0.577348066298343f, 1f},
10 | {0.577348066298343f, 1f}, {0.577348066298343f, 1f}, {0.577348066298343f, 1f},
11 | {0.577348066298343f, 1f}
12 | };
13 |
14 | private static One INSTANCE = new One();
15 |
16 | protected One() {
17 | super(POINTS);
18 | }
19 |
20 | public static One getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Seven.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Seven extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.259668508287293f, 0.116022099447514f}, {0.259668508287293f, 0.116022099447514f}, {0.87292817679558f, 0.116022099447514f},
8 | {0.87292817679558f, 0.116022099447514f}, {0.87292817679558f, 0.116022099447514f}, {0.7f, 0.422099447513812f},
9 | {0.7f, 0.422099447513812f}, {0.7f, 0.422099447513812f}, {0.477348066298343f, 0.733149171270718f},
10 | {0.477348066298343f, 0.733149171270718f}, {0.477348066298343f, 0.733149171270718f}, {0.25414364640884f, 1f},
11 | {0.25414364640884f, 1f}
12 | };
13 |
14 | private static Seven INSTANCE = new Seven();
15 |
16 | protected Seven() {
17 | super(POINTS);
18 | }
19 |
20 | public static Seven getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Six.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Six extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.607734806629834f, 0.110497237569061f}, {0.607734806629834f, 0.110497237569061f}, {0.607734806629834f, 0.110497237569061f},
8 | {0.607734806629834f, 0.110497237569061f}, {0.392265193370166f, 0.43646408839779f}, {0.265193370165746f, 0.50828729281768f},
9 | {0.25414364640884f, 0.696132596685083f}, {0.287292817679558f, 1.13017127071823f}, {0.87292817679558f, 1.06077348066298f},
10 | {0.845303867403315f, 0.696132596685083f}, {0.806629834254144f, 0.364640883977901f}, {0.419889502762431f, 0.353591160220994f},
11 | {0.295580110497238f, 0.552486187845304f}
12 | };
13 |
14 | private static Six INSTANCE = new Six();
15 |
16 | protected Six() {
17 | super(POINTS);
18 | }
19 |
20 | public static Six getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Three.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Three extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.361878453038674f, 0.298342541436464f}, {0.348066298342541f, 0.149171270718232f}, {0.475138121546961f, 0.0994475138121547f},
8 | {0.549723756906077f, 0.0994475138121547f}, {0.861878453038674f, 0.0994475138121547f}, {0.806629834254144f, 0.530386740331492f},
9 | {0.549723756906077f, 0.530386740331492f}, {0.87292817679558f, 0.530386740331492f}, {0.828729281767956f, 0.994475138121547f},
10 | {0.552486187845304f, 0.994475138121547f}, {0.298342541436464f, 0.994475138121547f}, {0.30939226519337f, 0.828729281767956f},
11 | {0.312154696132597f, 0.790055248618785f}
12 | };
13 |
14 | private static Three INSTANCE = new Three();
15 |
16 | protected Three() {
17 | super(POINTS);
18 | }
19 |
20 | public static Three getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Two.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Two extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.30939226519337f, 0.331491712707182f}, {0.325966850828729f, 0.0110497237569061f}, {0.790055248618785f, 0.0220994475138122f},
8 | {0.798342541436464f, 0.337016574585635f}, {0.798342541436464f, 0.430939226519337f}, {0.718232044198895f, 0.541436464088398f},
9 | {0.596685082872928f, 0.674033149171271f}, {0.519337016574586f, 0.762430939226519f}, {0.408839779005525f, 0.856353591160221f},
10 | {0.314917127071823f, 0.977900552486188f}, {0.314917127071823f, 0.977900552486188f}, {0.812154696132597f, 0.977900552486188f},
11 | {0.812154696132597f, 0.977900552486188f}
12 | };
13 |
14 | private static Two INSTANCE = new Two();
15 |
16 | protected Two() {
17 | super(POINTS);
18 | }
19 |
20 | public static Two getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/java/com/mbh/timelyview/model/number/Zero.java:
--------------------------------------------------------------------------------
1 | package com.mbh.timelyview.model.number;
2 |
3 | import com.mbh.timelyview.model.core.Figure;
4 |
5 | public class Zero extends Figure {
6 | private static final float[][] POINTS = {
7 | {0.24585635359116f, 0.552486187845304f}, {0.24585635359116f, 0.331491712707182f}, {0.370165745856354f, 0.0994475138121547f},
8 | {0.552486187845304f, 0.0994475138121547f}, {0.734806629834254f, 0.0994475138121547f}, {0.861878453038674f, 0.331491712707182f},
9 | {0.861878453038674f, 0.552486187845304f}, {0.861878453038674f, 0.773480662983425f}, {0.734806629834254f, 0.994475138121547f},
10 | {0.552486187845304f, 0.994475138121547f}, {0.370165745856354f, 0.994475138121547f}, {0.24585635359116f, 0.773480662983425f},
11 | {0.24585635359116f, 0.552486187845304f}
12 | };
13 |
14 | private static Zero INSTANCE = new Zero();
15 |
16 | protected Zero() {
17 | super(POINTS);
18 | }
19 |
20 | public static Zero getInstance() {
21 | return INSTANCE;
22 | }
23 | }
--------------------------------------------------------------------------------
/timelyview/src/main/res/layout/timely_shorttimeview_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
15 |
16 |
19 |
20 |
23 |
24 |
25 |
26 |
34 |
35 |
41 |
42 |
45 |
46 |
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 |
--------------------------------------------------------------------------------
/timelyview/src/main/res/layout/timely_timeview_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
20 |
21 |
24 |
25 |
26 |
27 |
35 |
36 |
42 |
43 |
46 |
47 |
50 |
51 |
52 |
53 |
61 |
62 |
68 |
69 |
72 |
73 |
76 |
77 |
--------------------------------------------------------------------------------
/timelyview/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 |
--------------------------------------------------------------------------------
/timelyview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | :
4 |
--------------------------------------------------------------------------------
/timelyview/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
--------------------------------------------------------------------------------