├── .gitignore
├── README.md
├── 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
│ │ └── github
│ │ └── adnansm
│ │ └── timelytextview
│ │ └── sample
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── layout
│ └── activity_main.xml
│ ├── menu
│ └── main.xml
│ ├── values-sw720dp-land
│ └── dimens.xml
│ ├── values-v11
│ └── styles.xml
│ ├── values-v14
│ └── styles.xml
│ └── values
│ ├── arrays.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── settings.gradle
└── timelytextview
├── .gitignore
├── build.gradle
└── src
└── main
├── AndroidManifest.xml
├── java
└── com
│ └── github
│ └── adnansm
│ └── timelytextview
│ ├── 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
└── values
└── attrs.xml
/.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
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | TimelyTextView
2 | ==============
3 |
4 | Animated TextView like Timely app
5 |
6 |
7 | v1 :
8 | Thanks to Malinskiy, the project now has Gradle/Maven support ! Few things that have been fixed as well :
9 |
10 | - The layout_height & layout_width parameters are now supported.
11 | - Animate between any two numbers(no need for consecutive numbers, any longer)
12 | - Sample demo available in the repository
13 |
14 | Again a huge thanks to Malinskiy(https://github.com/Malinskiy) for the effort !
15 |
16 | v0 :
17 | Intital commit for Animated TextView present in the Timely(Alarm) App.
18 |
19 |
20 | This is just an addition to the concept explained by Sriram Ramani here : http://sriramramani.wordpress.com/2013/10/14/number-tweening/
21 |
22 | I have just figured out missing bits & pieces and made a simple library out of it. Please thank Sriram if this helped you. Also please note I have been very busy and this was the outcome of just 2hrs of work on a lazy Monday afternoon, so there might be a few bugs. It would be great if anyone else wants to contribute and take this to the next level. Have a few ideas in mind already, feel free to get in touch and send Pull Requests.
23 |
24 |
25 | Usage :
26 |
27 | XML Layout:
28 | ``` xml
29 |
36 | ```
37 |
38 | Java:
39 | ``` java
40 | public class MainActivity extends Activity {
41 | private TimelyView timelyView;
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_main);
46 | timelyView = (TimelyView) findViewById(R.id.textView1);
47 | }
48 | }
49 | ```
50 |
51 | Install
52 | --------
53 |
54 | You can install using Gradle:
55 |
56 | ```gradle
57 | repositories {
58 | maven { url "https://jitpack.io" }
59 | }
60 | dependencies {
61 | compile 'com.github.adnan-SM:TimelyTextView:1.0'
62 | }
63 | ```
64 |
65 | License
66 | --------
67 |
68 | Copyright 2014 Adnan A M.
69 |
70 | Licensed under the Apache License, Version 2.0 (the "License");
71 | you may not use this file except in compliance with the License.
72 | You may obtain a copy of the License at
73 |
74 | http://www.apache.org/licenses/LICENSE-2.0
75 |
76 | Unless required by applicable law or agreed to in writing, software
77 | distributed under the License is distributed on an "AS IS" BASIS,
78 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79 | See the License for the specific language governing permissions and
80 | limitations under the License.
81 |
82 |
83 |
84 | [](https://bitdeli.com/free "Bitdeli Badge")
85 |
86 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:1.3.0'
7 | }
8 | }
9 |
10 | allprojects {
11 | repositories {
12 | mavenCentral()
13 | }
14 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adnan-SM/TimelyTextView/ead3c48eaa9fb5fa28fd0d04a21ad71da6dbb634/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jun 10 18:10:41 MSK 2014
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-1.12-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: 'android'
2 |
3 | android {
4 | compileSdkVersion 19
5 | buildToolsVersion "19.1.0"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 19
10 | versionCode 1
11 | versionName "1.0"
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(':timelytextview')
28 | }
29 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/github/adnansm/timelytextview/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.sample;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.SeekBar;
10 | import android.widget.Spinner;
11 | import com.github.adnansm.timelytextview.TimelyView;
12 | import com.nineoldandroids.animation.ObjectAnimator;
13 |
14 | public class MainActivity extends Activity {
15 | public static final int DURATION = 1000;
16 | public static final int NO_VALUE = -1;
17 | private TimelyView timelyView = null;
18 | private SeekBar seekBar = null;
19 | private Spinner fromSpinner = null;
20 | private Spinner toSpinner = null;
21 | private volatile ObjectAnimator objectAnimator = null;
22 |
23 | private volatile int from = NO_VALUE;
24 | private volatile int to = NO_VALUE;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_main);
30 | timelyView = (TimelyView) findViewById(R.id.textView1);
31 | seekBar = (SeekBar) findViewById(R.id.seekBar);
32 | fromSpinner = (Spinner) findViewById(R.id.fromSpinner);
33 | toSpinner = (Spinner) findViewById(R.id.toSpinner);
34 |
35 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.from_numbers_array, android.R.layout.simple_spinner_item);
36 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
37 | fromSpinner.setAdapter(adapter);
38 | toSpinner.setAdapter(adapter);
39 | fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
40 | @Override
41 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
42 | from = position - 1;
43 | if(from != NO_VALUE && to != NO_VALUE) {
44 | objectAnimator = timelyView.animate(from, to);
45 | objectAnimator.setDuration(DURATION);
46 | } else {
47 | objectAnimator = null;
48 | }
49 | }
50 |
51 | @Override
52 | public void onNothingSelected(AdapterView> parent) {
53 | }
54 | });
55 | toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
56 | @Override
57 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
58 | to = position - 1;
59 | if(from != NO_VALUE && to != NO_VALUE) {
60 | objectAnimator = timelyView.animate(from, to);
61 | objectAnimator.setDuration(DURATION);
62 | } else {
63 | objectAnimator = null;
64 | }
65 | }
66 |
67 | @Override
68 | public void onNothingSelected(AdapterView> parent) {
69 |
70 | }
71 | });
72 |
73 | seekBar.setMax(DURATION);
74 | seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
75 | @Override
76 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
77 | if(objectAnimator != null) objectAnimator.setCurrentPlayTime(progress);
78 | }
79 |
80 | @Override
81 | public void onStartTrackingTouch(SeekBar seekBar) {
82 |
83 | }
84 |
85 | @Override
86 | public void onStopTrackingTouch(SeekBar seekBar) {
87 |
88 | }
89 | });
90 | }
91 |
92 | @Override
93 | public boolean onCreateOptionsMenu(Menu menu) {
94 | // Inflate the menu; this adds items to the action bar if it is present.
95 | getMenuInflater().inflate(R.menu.main, menu);
96 | return true;
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adnan-SM/TimelyTextView/ead3c48eaa9fb5fa28fd0d04a21ad71da6dbb634/sample/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adnan-SM/TimelyTextView/ead3c48eaa9fb5fa28fd0d04a21ad71da6dbb634/sample/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adnan-SM/TimelyTextView/ead3c48eaa9fb5fa28fd0d04a21ad71da6dbb634/sample/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
21 |
22 |
28 |
29 |
34 |
35 |
40 |
41 |
42 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/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/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 | TimelyTextView
5 | Settings
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':timelytextview'
2 | include ':sample'
--------------------------------------------------------------------------------
/timelytextview/.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
--------------------------------------------------------------------------------
/timelytextview/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 19
9 | buildToolsVersion '19.1.0'
10 |
11 | defaultConfig {
12 | minSdkVersion 1
13 | targetSdkVersion 19
14 | versionCode 1
15 | versionName "1.0"
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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/TimelyView.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview;
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 | import com.github.adnansm.timelytextview.animation.TimelyEvaluator;
12 | import com.github.adnansm.timelytextview.model.NumberUtils;
13 | import com.nineoldandroids.animation.ObjectAnimator;
14 | import com.nineoldandroids.util.Property;
15 |
16 | public class TimelyView extends View {
17 | private static final float RATIO = 1f;
18 | private static final Property CONTROL_POINTS_PROPERTY = new Property(float[][].class, "controlPoints") {
19 | @Override
20 | public float[][] get(TimelyView object) {
21 | return object.getControlPoints();
22 | }
23 |
24 | @Override
25 | public void set(TimelyView object, float[][] value) {
26 | object.setControlPoints(value);
27 | }
28 | };
29 | private Paint mPaint = null;
30 | private Path mPath = null;
31 | private float[][] controlPoints = null;
32 | private int textColor;
33 |
34 | public TimelyView(Context context) {
35 | super(context);
36 | init();
37 | }
38 |
39 | public TimelyView(Context context, AttributeSet attrs) {
40 | super(context, attrs);
41 | TypedArray typedArray=context.obtainStyledAttributes(attrs, R.styleable.TimelyView);
42 | textColor=typedArray.getColor(R.styleable.TimelyView_text_color,Color.BLACK);
43 | typedArray.recycle();
44 | init();
45 | }
46 |
47 | public TimelyView(Context context, AttributeSet attrs, int defStyleAttr) {
48 | super(context, attrs, defStyleAttr);
49 | init();
50 | }
51 |
52 | public float[][] getControlPoints() {
53 | return controlPoints;
54 | }
55 |
56 | public void setControlPoints(float[][] controlPoints) {
57 | this.controlPoints = controlPoints;
58 | invalidate();
59 | }
60 |
61 | public ObjectAnimator animate(int start, int end) {
62 | float[][] startPoints = NumberUtils.getControlPointsFor(start);
63 | float[][] endPoints = NumberUtils.getControlPointsFor(end);
64 |
65 | return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
66 | }
67 |
68 | public ObjectAnimator animate(int end) {
69 | float[][] startPoints = NumberUtils.getControlPointsFor(-1);
70 | float[][] endPoints = NumberUtils.getControlPointsFor(end);
71 |
72 | return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
73 | }
74 |
75 | @Override
76 | protected void onDraw(Canvas canvas) {
77 | super.onDraw(canvas);
78 | if (controlPoints == null) return;
79 |
80 | int length = controlPoints.length;
81 |
82 | int height = getMeasuredHeight();
83 | int width = getMeasuredWidth();
84 |
85 | float minDimen = height > width ? width : height;
86 |
87 | mPath.reset();
88 | mPath.moveTo(minDimen * controlPoints[0][0], minDimen * controlPoints[0][1]);
89 | for (int i = 1; i < length; i += 3) {
90 | mPath.cubicTo(minDimen * controlPoints[i][0], minDimen * controlPoints[i][1],
91 | minDimen * controlPoints[i + 1][0], minDimen * controlPoints[i + 1][1],
92 | minDimen * controlPoints[i + 2][0], minDimen * controlPoints[i + 2][1]);
93 | }
94 | canvas.drawPath(mPath, mPaint);
95 | }
96 |
97 | @Override
98 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
99 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
100 |
101 | int width = getMeasuredWidth();
102 | int height = getMeasuredHeight();
103 | int widthWithoutPadding = width - getPaddingLeft() - getPaddingRight();
104 | int heigthWithoutPadding = height - getPaddingTop() - getPaddingBottom();
105 |
106 | int maxWidth = (int) (heigthWithoutPadding * RATIO);
107 | int maxHeight = (int) (widthWithoutPadding / RATIO);
108 |
109 | if (widthWithoutPadding > maxWidth) {
110 | width = maxWidth + getPaddingLeft() + getPaddingRight();
111 | } else {
112 | height = maxHeight + getPaddingTop() + getPaddingBottom();
113 | }
114 |
115 | setMeasuredDimension(width, height);
116 | }
117 |
118 | private void init() {
119 | // A new paint with the style as stroke.
120 | mPaint = new Paint();
121 | mPaint.setAntiAlias(true);
122 | mPaint.setColor(textColor);
123 | mPaint.setStrokeWidth(5.0f);
124 | mPaint.setStyle(Paint.Style.STROKE);
125 | mPath = new Path();
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/animation/TimelyEvaluator.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.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 |
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/NumberUtils.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model;
2 |
3 | import com.github.adnansm.timelytextview.model.number.*;
4 |
5 | import java.security.InvalidParameterException;
6 |
7 | public class NumberUtils {
8 |
9 | public static float[][] getControlPointsFor(int start) {
10 | switch (start) {
11 | case (-1):
12 | return Null.getInstance().getControlPoints();
13 | case 0:
14 | return Zero.getInstance().getControlPoints();
15 | case 1:
16 | return One.getInstance().getControlPoints();
17 | case 2:
18 | return Two.getInstance().getControlPoints();
19 | case 3:
20 | return Three.getInstance().getControlPoints();
21 | case 4:
22 | return Four.getInstance().getControlPoints();
23 | case 5:
24 | return Five.getInstance().getControlPoints();
25 | case 6:
26 | return Six.getInstance().getControlPoints();
27 | case 7:
28 | return Seven.getInstance().getControlPoints();
29 | case 8:
30 | return Eight.getInstance().getControlPoints();
31 | case 9:
32 | return Nine.getInstance().getControlPoints();
33 | default:
34 | throw new InvalidParameterException("Unsupported number requested");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/core/Figure.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.core;
2 |
3 | /**
4 | * Model class for cubic bezier figure
5 | */
6 | public abstract class Figure {
7 | public static final int NO_VALUE = -1;
8 |
9 | protected int pointsCount = NO_VALUE;
10 |
11 | //A chained sequence of points P0,P1,P2,P3/0,P1,P2,P3/0,...
12 | protected 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 |
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Eight.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Five.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Four.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Nine.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Null.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 |
4 | import com.github.adnansm.timelytextview.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 | protected Null() {
18 | super(POINTS);
19 | }
20 |
21 | public static Null getInstance() {
22 | return INSTANCE;
23 | }
24 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/One.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Seven.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Six.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Three.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Two.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/java/com/github/adnansm/timelytextview/model/number/Zero.java:
--------------------------------------------------------------------------------
1 | package com.github.adnansm.timelytextview.model.number;
2 |
3 | import com.github.adnansm.timelytextview.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 | }
--------------------------------------------------------------------------------
/timelytextview/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------