Kaydet (Commit) 2f018339 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

android: blinking cursor

Change-Id: I1e2d5df7917ec0f8e780e3e3481dadd10b1b76ed
üst e2d4cfa4
...@@ -29,9 +29,11 @@ public class TextCursorView extends ImageView { ...@@ -29,9 +29,11 @@ public class TextCursorView extends ImageView {
private int mWidth; private int mWidth;
private int mHeight; private int mHeight;
private int mAlpha = 0;
public TextCursorView(Context context, AttributeSet attrs) { public TextCursorView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
postDelayed(cursorAnimation, 500);
} }
public void changePosition(RectF position) { public void changePosition(RectF position) {
...@@ -57,7 +59,6 @@ public class TextCursorView extends ImageView { ...@@ -57,7 +59,6 @@ public class TextCursorView extends ImageView {
mTop = Math.round(scaled.centerY() - y); mTop = Math.round(scaled.centerY() - y);
setScaleY(scaled.height()); setScaleY(scaled.height());
setLayoutPosition(); setLayoutPosition();
} }
...@@ -76,4 +77,13 @@ public class TextCursorView extends ImageView { ...@@ -76,4 +77,13 @@ public class TextCursorView extends ImageView {
setLayoutParams(mLayoutParams); 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment