I'm having an interesting problem...that I can't seem to find the solution for. I'm using an ObjectAnimator to rotate an ImageView; but the onTouchListener only seems to be registering MotionEvent.ACTION_DOWN. (I deduced this from the Log Cats, there is also MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP).
I thought maybe the problem had to do with trying to listen and animate to a veiw at the same time. I wrapped both the imageview and a linear layout (set to MATCH PARENT) in a relative layout, and registered the linear layout to listen for touch events. The Linear Layout is having the same problem; only MotionEvent.ACTION_UP is being handled. Is there something I need to go to get MotionEvent.ACTION_MOVE to be registered?
Here is my code:
touch_pad = (LinearLayout) findViewById(R.id.layout_touch_capture);
touch_pad.setOnTouchListener(this);
touch_pad.requestFocus();
public boolean onTouch(View v, MotionEvent event) {
switch(v.getId()) {
case (R.id.layout_touch_capture):
long end = 0;
long start = 0;
float y = event.getY();
float y_sum = y;
float x = event.getX();
switch(event.getAction()) {
case (MotionEvent.ACTION_UP):
end = animator.getCurrentPlayTime();
Log.d("WheelActivity", "end location = " + end);
break;
case (MotionEvent.ACTION_MOVE):
Log.d("WheelActivity", "event.getY() = " + y);
y_sum += y;
animator.setCurrentPlayTime((long) (start + y_sum));
Log.d("WheelActivity", "animator play time = " animator.getCurrentPlayTime());
Log.d("WheelActivity", "animator fraction = " +
animator.getAnimatedFraction());
break;
case (MotionEvent.ACTION_DOWN):
start = animator.getCurrentPlayTime();
Log.d("WheelActivity", "start location = " + start);
break;
}
}
return false;
}
(Sorry about the poorly formatted code...)
return false;
changed to return true;