2

Page Curl animation i am being using. I wanted to ask Harism that how am i suppose to change the images after all of them are drawn once. For eg. I have 10 Images Drawn on the First Instance for 10 pages, now when i come back from some other Activity I want to get the same pages to show modified 10 pages according to the (now) new/modified data, Currently i get my New/modified Data appended to the first 10 pages and thus i get a result of 20 pages, instead of only 10. Can anyone working with the Curl animation help me in this? Thanking in anticipation !!

    private class BitmapProvider implements CurlView.BitmapProvider {

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

        //  LinearLayout linearLayout=(LinearLayout) findViewById(R.id.linearLayout1);


        Bitmap b = Bitmap.createBitmap(width,height,
                Bitmap.Config.ARGB_8888);
        b.eraseColor(Color.BLACK);
        Canvas c = new Canvas(b);

TextView textPageCount= new TextView(AllQuotesActivity.this);
        textPageCount.setText((index+1) +" of " + (allQuotes.size()));
        textPageCount.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM);

        textPageCount.setTextColor(Color.WHITE);
        textPageCount.setTypeface(Typeface.createFromAsset(getAssets(), "Samba.ttf"));
        textPageCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        textPageCount.setLayoutParams(new LayoutParams(c.getWidth(),c.getHeight()));
        fLayout.addView(textPageCount);



        fLayout.setBackgroundColor(Color.BLACK);
        fLayout.measure(c.getWidth(), c.getHeight());
        fLayout.layout(0, 0, c.getWidth(), c.getHeight());
        fLayout.draw(c);

        return b;
    }


    // I actually call all of these instantiating methods while refreshing the CurlView in hopes that it wouldn't Append the Pages and reDraw it.    
           mCurlView = (CurlView) findViewById(R.id.curl);
    mCurlView.sendClassInstance(this);
    mCurlView.setBitmapProvider(new BitmapProvider());
    mCurlView.setSizeChangedObserver(new SizeChangedObserver());
    mCurlView.setCurrentIndex(index);
    mCurlView.setAllowLastPageCurl(false);
    //  mCurlView.setBackgroundColor(0xFF202830);
    mCurlView.setBackgroundColor(Color.BLACK);
Some one Some where
  • 777
  • 1
  • 8
  • 26
  • care to share the code so all of us can enjoy it nd maybe try to answer ? this is not a private forum. – codeScriber Feb 19 '12 at 21:45
  • sorry for that, Actually I need to refresh this method of the Curl Activity View but it seems like whenever I try to modify and add new pages, the PageCount Text view always keeps on doubling instead of simply modifying, can u throw some light on it? – Some one Some where Feb 19 '12 at 23:10
  • where do you get this library from ? github ? sourceforge ? paid ? – codeScriber Feb 20 '12 at 07:00
  • yes its on github named as Curl page animation in android, has 3d page curl animation using open GL, the bitmap renderer method seems to return all the images stored in it during the onCreate method, wanted to clear my doubts as to how can i refresh the images, so that new images can be replaced on the same, here is the link https://github.com/harism/android_page_curl – Some one Some where Feb 21 '12 at 20:44

1 Answers1

0

Did you try setting the updated image directly to the corresponding index in the mBitmapIds int[].

DDas
  • 306
  • 3
  • 12