How can we show Page Curl Animation on click of the Button in android
Asked Answered
H

2

11

I am using the Page curl animation in my application.

Code can be found here: https://github.com/harism/android_page_curl/.

That code is working fine but i want to make some Modifications in it.

1.To display the image on full screen with no background.

2.I want to show this curl animation on click of the button also.

The code for the mail CurlActvity class is http://pastebin.com/ZLzP6Zxt at there.

If anyone have some Idea about where i have to made changes the code then please help me. Any help is appreciated.

Edit: The 1st problem To display the image on full screen with no background is solved by some modifications in the private class SizeChangedObserver . The only issue is to set the animation onClick of the button.

Hescock answered 28/5, 2012 at 5:46 Comment(2)
Hey Naresh see this one .. #5740414Conwell
Can you please help me resolving an issue when I try to go back to the previous pages then the bitmaps are not refreshed and they repeat. Why does this happen? https://mcmap.net/q/1176448/-curl-page-from-left-to-right-android/1503130Tributary
Y
6

For the full screen display you have to use like that

private class SizeChangedObserver implements CurlView.SizeChangedObserver {
        public void onSizeChanged(int w, int h) {
            if (w > h) {
                mCurlView.setViewMode(CurlView.SHOW_TWO_PAGES);
                mCurlView.setMargins(0f, 0f, 0f, 0f);
            } else {
                mCurlView.setViewMode(CurlView.SHOW_ONE_PAGE);
                mCurlView.setMargins(0f, 0f, 0f, 0f);
            }
        }
    }

}

Also to show the animation see that link Page curl animation - issue

Yarkand answered 28/5, 2012 at 7:20 Comment(0)
P
2
  1. Have you tried changing

    int margin = 7;

    int border = 3;

to eks.

int margin = 0;
int border = 0; 

the loadBitmap(..) function?

I actually removed the boarder and margins within loadBitmap some time ago in a project i worked on, but i dont have the code anymore..

Pharmacy answered 2/6, 2012 at 20:45 Comment(2)
given the 0 margin not make it full screen above ans given by @shifu working fine for thatHescock
just comment this portion of code and u will get fullscreen 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(); }Julieannjulien

© 2022 - 2024 — McMap. All rights reserved.