From 2f018339be2791a6a4d6b29bd369af840e8aa5fa Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Wed, 4 Feb 2015 21:13:45 +0900 Subject: android: blinking cursor Change-Id: I1e2d5df7917ec0f8e780e3e3481dadd10b1b76ed --- .../LOAndroid3/src/java/org/libreoffice/TextCursorView.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java index d9e51fcedb93..1aed2f0155a2 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java @@ -29,9 +29,11 @@ public class TextCursorView extends ImageView { private int mWidth; private int mHeight; + private int mAlpha = 0; public TextCursorView(Context context, AttributeSet attrs) { super(context, attrs); + postDelayed(cursorAnimation, 500); } public void changePosition(RectF position) { @@ -57,7 +59,6 @@ public class TextCursorView extends ImageView { mTop = Math.round(scaled.centerY() - y); setScaleY(scaled.height()); - setLayoutPosition(); } @@ -76,4 +77,13 @@ public class TextCursorView extends ImageView { setLayoutParams(mLayoutParams); } + + private Runnable cursorAnimation = new Runnable() { + public void run() { + mAlpha = mAlpha == 0 ? 0xFF : 0; + getDrawable().setAlpha(mAlpha); + invalidate(); + postDelayed(cursorAnimation, 500); + } + }; } \ No newline at end of file -- cgit