I have a base FrameLayout. I have added a harism's page curl
SurfaceView component. Above it have added a Video.
The layout XML is like this:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/base" >

<fi.harism.curl.CurlView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginLeft="200dp"
    android:layout_marginTop="200dp"
    android:id="@+id/curl" />

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/holder" />

</merge>


In the Activity the code is:
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    mCurlView = ( CurlView ) findViewById( R.id.curl );
    layout = (RelativeLayout)findViewById(R.id.holder);

    BitmapProvider bProvider = new BitmapProvider();
    mCurlView.setBitmapProvider( bProvider );
    mCurlView.setSizeChangedObserver( new SizeChangedObserver() );
    mCurlView.setCurrentIndex( 0 );
    mCurlView.setBackgroundColor( 0xFF202830 );
    mCurlView.setAllowLastPageCurl( false );
    mCurlView.setBackgroundColor( 0xFF000000 );

    String path = "android.resource://" + getPackageName() + "/" +
R.raw.scene1;

    final VideoViewCustom cvp = new VideoViewCustom( this );
    cvp.setDimensions( 400, 250 );
    cvp.getHolder().setFixedSize( 400, 250 );
    cvp.setVideoPath( path );
    layout.addView( cvp );
    cvp.requestFocus();
    cvp.start();
}


private class BitmapProvider implements CurlView.BitmapProvider {

    private int[] mBitmapIds = { R.drawable.page_01,
R.drawable.page_02 };

    public Bitmap getBitmap( int width, int height, int index )
    {

        Bitmap b = Bitmap.createBitmap( width, height,
Bitmap.Config.ARGB_8888 );
        b.eraseColor( 0xFFFFFFFF );
        Canvas canvas = new Canvas( b );
        Drawable d =
getResources().getDrawable( mBitmapIds[ index ] );


        int margin = 0;//7;
        int border = 0;//3;
        Rect r = new Rect( margin, margin, width - margin, height -
margin );

        int imageWidth = r.width() - (border * 2);
        int imageHeight = imageWidth * d.getIntrinsicHeight() /
d.getIntrinsicWidth();

        if (imageHeight > r.height() - (border * 2)) {
            imageHeight = r.height() - (border * 2);
            imageWidth = imageHeight * d.getIntrinsicWidth() /
d.getIntrinsicHeight();
        }


        r.left += ((r.width() - imageWidth) / 2) - border;
        r.right = r.left + imageWidth + border + border;
        r.top += ((r.height() - imageHeight) / 2) - border;
        r.bottom = r.top + imageHeight + border + border;


        Paint p = new Paint();
        p.setColor( 0xFFC0C0C0 );
        canvas.drawRect( r, p );
        r.left += border;
        r.right -= border;
        r.top += border;
        r.bottom -= border;

        d.setBounds( r );
        d.draw( canvas );

        return b;
    }

    //@Override
    public int getBitmapCount() {
        return mBitmapIds.length;
    }
}

/**
 * CurlView size changed observer.
 */
private class SizeChangedObserver implements
CurlView.SizeChangedObserver {
    //@Override
    public void onSizeChanged(int w, int h) {
        mCurlView.setViewMode(CurlView.SHOW_ONE_PAGE);
        mCurlView.setMargins(0f, 0f, 0f, 0f);
    }
}


Now on display, the video displays below the page curl component. How
can I bring the video to front and why is this happening?
bringChildToFront did not work, already tried that. Also cannot use
setVisibility asI require both, the video to play on top of curl
view.

Thank you in advance for a guidance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to