Drag "page" animation
<p>I'm working on an eBook reader for android. I have my content set up in a none scrollable webview. In order to turn page, i would like to create a kind of page/drag effect like shown here:
<a href="http://www.youtube.com/watch?v=sd5f4nauKTE#t=1m8s" rel="nofollow">http://www.youtube.com/watch?v=sd5f4nauKTE#t=1m8s</a></p>

<p>I've setted up a onTouchListener to my webview and added a cached image of it to a ImageView, and managed to drag it around wiht my finger, but i'm having trouble setting up animations on the way.</p>

<p>Here is my code so far:</p>

<pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;


    &lt;ImageView
        android:id="@+id/imgContentBitmap"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center"
    /&gt;

    &lt;ImageView
        android:id="@+id/imgNext"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center"
    /&gt;

    &lt;ImageView
        android:id="@+id/imgPrev"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center"
    /&gt;

    &lt;android.webkit.WebView
        android:id="@+id/webPageContent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" &gt;
    &lt;/android.webkit.WebView&gt;
&lt;/FrameLayout&gt;
</code></pre>

<p>And the activity:</p>

<pre><code>public class TestPageActivity extends Activity {
    /** Called when the activity is first created. */

    private WebView webView;
    private Bitmap bitmap;
    private ImageView contentBitmap;
    private FrameLayout.LayoutParams params;
    private int pressedX;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        params = new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
        params.leftMargin = 0;
        params.topMargin = 0;

        webView = (WebView) findViewById(R.id.webPageContent);

        webView.setVerticalScrollBarEnabled(false);
        webView.setHorizontalScrollBarEnabled(false);

        ((FrameLayout)(webView.getParent())).setOnTouchListener(new OnTouchListener(){
            @Override
            public boolean onTouch(View v, MotionEvent event){

                int eventAction = event.getAction();
                int currentX = (int) event.getX();

                Log.d("main", "current x = "+currentX);
                Log.d("main", "pressed x = "+pressedX);

                switch(eventAction){
                    case MotionEvent.ACTION_DOWN:
                        Log.d("main", "down");
                        pressedX = (int) event.getX();
                        break;
                    case MotionEvent.ACTION_MOVE:
                        Log.d("main", "move");
                        params.leftMargin = (pressedX-currentX);
                        contentBitmap.setLayoutParams(params);
                        break;
                    case MotionEvent.ACTION_UP:
                        Log.d("main", "up");
                        break;
                }
                return true;
            }
        });

        webView.loadData(getString(R.string.lorem_ipsum), "text/html", "utf-8");

        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {

            }
        });

        webView.setPictureListener(new PictureListener() {

            @Override
            public void onNewPicture(WebView view, Picture picture){
                webView.setDrawingCacheEnabled(true);
                webView.layout(0, 0, webView.getWidth(), webView.getBottom());
                webView.buildDrawingCache(true);
                bitmap = Bitmap.createBitmap(webView.getDrawingCache());
                webView.setVisibility(WebView.INVISIBLE);

                webView.setDrawingCacheEnabled(false);

                contentBitmap.setImageBitmap(bitmap);
                webView.setPictureListener(null);

            }
        });

        contentBitmap = (ImageView) findViewById(R.id.imgContentBitmap);
        /*

        contentBitmap.setImageBitmap(bitmap);*/

    }
}
</code></pre>
