I have a custom view that does some custom drawing when touched, and I'd like to fire the click event after drawing has finished.
I tried overriding the onTouchEvent to start the animation and call performClick() when drawing has finished, but I'm losing the click event here....
has anybody been able to get this done?
in my ontouch I start the drawing process with the drawFantastic
@Override
public boolean onTouchEvent(MotionEvent event) {
touch_x = event.getX();
touch_y = event.getY();
fantasticRadius = 0;
fantasticRadius2 = 0;
drawFantastic();
return super.onTouchEvent(event);
}
and this is how I draw the view and want to call the performClick after it's been drawn
private void drawFantastic() {
final Runnable fantasticRunnable = new Runnable() {
@Override
public void run() {
fantasticRadius+=15;
// 2nd radius :)
if(fantasticRadius>35)
fantasticRadius2+=15;
invalidate();
if(!isFantastic()){
fantasticHandler.postDelayed(this, 15);
} else {
animationFinished = true;
performClick();
}
}
};
fantasticHandler.post(fantasticRunnable);
}
and here is how I try to interscept the click event
@Override
public boolean performClick() {
if(animationFinished == true) {
return super.performClick();
}else {
return false;
}
}
I added some logging and basically looks like super.performClick(); isn't doing what I think it should be doing....