From 5d2a753c519f36640cde4c89bba3133fd219e268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Guill=C3=A9n=20Moreno?= Date: Wed, 10 Jun 2020 22:51:40 +0200 Subject: [PATCH 1/3] Add files via upload --- .../com/tomer/fadingtextview/FadingTextView.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java index d85e69f..4515a86 100644 --- a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java +++ b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java @@ -79,15 +79,27 @@ public void stop() { } /** - * Restarts the animation - * Only use this to restart the animation after stopping it using {@link #stop} + * Fades text to the indicated position in array + * It's recommended to call pause() method before calling this function */ + public void fadeTo(int position){ + this.position = position; + isShown = true; + startAnimation(); + pause(); + } + public void restart() { isShown = true; stopped = false; startAnimation(); invalidate(); } + + /** + * Resumes the animation + * Should only be used if you notice {@link #onAttachedToWindow()} ()} is not being executed as expected + */ @Override protected void onDetachedFromWindow() { From 13e6573bfcf5b3b2c7cc0aa55e2f974c95169803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Guill=C3=A9n=20Moreno?= Date: Wed, 10 Jun 2020 22:54:54 +0200 Subject: [PATCH 2/3] Add files via upload Added fadeTo() method --- .../main/java/com/tomer/fadingtextview/FadingTextView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java index 4515a86..f98b944 100644 --- a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java +++ b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java @@ -88,7 +88,11 @@ public void fadeTo(int position){ startAnimation(); pause(); } - + + /** + * Restarts the animation + * Only use this to restart the animation after stopping it using {@link #stop} + */ public void restart() { isShown = true; stopped = false; From 8c2e84118d5a7237b852a59269dc7fe9f881d027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Guill=C3=A9n=20Moreno?= Date: Wed, 10 Jun 2020 23:00:23 +0200 Subject: [PATCH 3/3] Add files via upload --- .../main/java/com/tomer/fadingtextview/FadingTextView.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java index f98b944..91ef6e1 100644 --- a/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java +++ b/fadingtextview/src/main/java/com/tomer/fadingtextview/FadingTextView.java @@ -88,7 +88,7 @@ public void fadeTo(int position){ startAnimation(); pause(); } - + /** * Restarts the animation * Only use this to restart the animation after stopping it using {@link #stop} @@ -99,11 +99,6 @@ public void restart() { startAnimation(); invalidate(); } - - /** - * Resumes the animation - * Should only be used if you notice {@link #onAttachedToWindow()} ()} is not being executed as expected - */ @Override protected void onDetachedFromWindow() {