Search code examples
androidandroid-gallery

android gallery "snappiness"


I am wondering if there's a way to increase the "snappiness" of the stock android gallery. in other words, I want the speed of a fling to drop off quicker than it does by default. a given fling should result in less scrolling and should stop quicker.

looking at the source, it looks like what I want is to change the value of ViewConfiguration.SCROLL_FRICTION, but as you can see that's a constant, and getting to the code makes use of that involves burrowing into private classes used by Gallery.

Any ideas?


Solution

  • I found something that gave the effect I want with little trouble. extend Gallery, and override onFling(),

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        return super.onFling(e1, e2, velocityX / 10, velocityY / 10);
    }
    

    Dividing the actual velocity by 10 gave me the effect I wanted.