XCaf,
I think you have a very minor issue in your code. I noticed you set the ending X & Y values of your rectangles to the Width and Height of the screen. However, shouldn't it actually be set to (width - 1) & (height - 1), since the actual screen coordinates on for example a 320 x 480 display, X would range from 0 - 319 and Y would range from 0 - 479. Where the Width and Height you grab would be 320 & 480 respectively. So, I think you are setting the height and width of your rectangle by 1 pixel to many.
BTW, nice code. I needed to scroll only a portion of my screen (your idea of a scrolling rect vs a display rect works great for that). Think of a spacecraft with controls and viewport. The view port you look out would have space scrolling by, but the spaceship controls would be stationary. I also needed to process a doubletap for zooming and I needed to drag and drop other small bitmaps to be merged into the viewport bitmap (the area that zooms & scrolls).
I first tried combining your idea of scrolling and display rectangles with OnGestureListener & OnDoubleTapListener and although it worked, there seemed to be a lag when I first started to scroll or drag anything. After it got started it was smooth, but that initial move would lag behind and then jump to catch up. When I logged the output of event.getX(), I noticed the first move had between 10-25 pixels jump from the starting DownX. Where all other moves only had a 1-3 pixel change. It seems it was taking to long after the initial down to register it as a scroll (the lag), so I had a larger history of movements built up by the time it did (hence the jump).
I started wondering if the lag was do to all the gestures - such as LongPress and DoubleTap that OnGestureListener had to wait for to decide if one occurred. So, now I am trying to use a modified version of low level event processing that you showed in your tutorial to see if I can reduce this lag effect.
Thanks again for the great tutorial,
--Kirgan


