Code example for ViewPager

Methods: getCurrentItem, getScrollX, getWidth, onDraw

0
        current_offset = offset;
    } 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (!insufficientMemory && parallaxEnabled) {
            if (current_position == -1)
                current_position=getCurrentItem();
            // maybe we could get the current position from the getScrollX instead? 
            src.set((int) (overlap_level * (current_position + current_offset)), 0,
                    (int) (overlap_level * (current_position + current_offset) + (getWidth() * zoom_level)), imageHeight);
 
            dst.set((int) (getScrollX()), 0,
                    (int) (getScrollX() + canvas.getWidth()), canvas.getHeight());
 
            canvas.drawBitmap(saved_bitmap, src, dst, null);
        } 
    } 
 
    public void set_max_pages(int num_max_pages) {