4

I am working with Harism Page Curl(Open GL) https://github.com/harism/android_page_curl and its works perfectly fine

enter image description here

But in this example the condition I found is that we must have all Bitmap resource ready(downloaded) but what I want is image will going to load(runtime) from web and will be cache for future like this.

enter image description here

Want some idea that how would I achieve this? a small help/hint is also appreciated. :)

Thanks.

Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115
  • 2
    It will not be a good user experience to see a progress bar for images to load in a magazine kind of application. It would be better if the images could be loaded beforehand by anticipating the page turn. You could show a placeholder image for unloaded images. Please see various magazine apps and also FlipBoard – Rajesh May 31 '12 at 05:29
  • @Rajesh have a look on this http://app2.diariolibre.com/revistas/mujerunica/ – Mohammed Azharuddin Shaikh May 31 '12 at 05:33
  • It was just a usability comment. Technically, it is possible and I will post a suggestion to achieve it, as an answer. – Rajesh May 31 '12 at 05:36
  • 1
    You can achieve this thing, but you have to create your own custome view , to do that. What it would do is it will draw this view on canvas and then effect the page curl on canvas instead of view. so by doing that you can put any view inside your custom view on make it curl. Hope this example will help you, cos its creating own view and making it curl.http://code.google.com/p/android-page-curl/ – mayank_droid May 31 '12 at 05:40
  • there is no view that will satisfy your runtime needs..!! You will definately have to make a custom view, draw it on canvas and give it a curl effect – mayank_droid May 31 '12 at 05:43
  • I had seen code.google.com/p/android-page-curl but its having issues. May be you are right that I have to deal with CustomView. – Mohammed Azharuddin Shaikh May 31 '12 at 05:52
  • @hotveryspicy what was the solution finally that you opted. – Prateek May 02 '13 at 11:12
  • @Rajesh Will you please help me with a similar thread, I am almost done just need an advice. – Prateek May 06 '13 at 10:01
  • @hotveryspicy is there some sort of listener that can tell if the page has been changed? – Tushar Gogna Apr 22 '15 at 12:04
  • @hotveryspicy Please see my question: http://stackoverflow.com/questions/30726077/page-curl-with-best-quality – Dr.jacky Jun 09 '15 at 08:15

2 Answers2

2

This answer assumes that you want to use the Page Curl by Harri Smått (harism) and nothing else.

There are different ways to achieve the wait screen with progress bar:

  1. Create a custom view that will display the image for every page. When the required image is not available, it will display the wait message together with the progress bar while downloading the image in the background. The BitmapProvider returns the bitmap captured from this custom view (by either using a Canvas or using the drawingCache). What is to be noted is that the CurlView will need to be updated with the latest image from the view whenever there is a change in progress. This can be done by requestRender method.
  2. Create an OpenGL progress widget. Whenever the image is not available and need to be downloaded, this progress widget together with the message is shown in place of the page. When the download gets completed, the view is re-rendered with the downloaded image.
Rajesh
  • 15,724
  • 7
  • 46
  • 95
  • Where do I need to call requestRender can you help on that? – Prateek May 03 '13 at 09:38
  • Without seeing your implementation, it is difficult to make a suggestion. If you are using an AsyncTask for the download, the ideal place would be the [onProgressUpdate](http://developer.android.com/reference/android/os/AsyncTask.html#onProgressUpdate(Progress...)) method. – Rajesh May 03 '13 at 12:53
  • Ok I will post a thread and then comment here for your reply. – Prateek May 03 '13 at 13:43
  • http://stackoverflow.com/q/16373550/1503130 , I have created a thread of my question here, Please have a look at it. – Prateek May 04 '13 at 11:01
  • I saw your question and there was already an accepted answer. – Rajesh May 06 '13 at 12:10
  • Yea but I want to understand the concept of how do I control this customview – Prateek May 06 '13 at 12:11
  • Also I can award a bounty if I get the right answer to my question but with some code example. – Prateek May 06 '13 at 12:12
  • @Rajesh Please see my question: http://stackoverflow.com/questions/30726077/page-curl-with-best-quality – Dr.jacky Jun 09 '15 at 08:16
0

One option is to do something like this How To apply click listener?, which suggests to maintain two views (one on top of another).

The first one will hold the views you need (the current page if already loaded, otherwise the ProgressBar). The second one will be the OpenGL surface view by harism, which will make the page curling. This way, you can play with hiding/showing/bringing them to top/bottom when you need it.

Community
  • 1
  • 1
jihonrado
  • 409
  • 2
  • 11
  • Can you give some sample code of tweaked harism project with progress bar functionality. – Prateek May 07 '13 at 10:25
  • @pKs No, I'm sorry. The way I used harism library is far from the desired behaviour here. – jihonrado May 07 '13 at 12:03
  • Actualy one thing that I want is to simulate page drag on click button , how can I do this. Any clues? – Prateek May 07 '13 at 12:10
  • @pKs You could try creating your custom MotionEvent's and sent them to the CurlView (mCurlView.onTouch(null, event)). This way you don't need to modify the harism library. – jihonrado May 07 '13 at 17:27
  • But this doesn't curl the page, I have generated the `MotionEvent` object and am able to simulate `onTouch` but can't able to turn the page. – Prateek May 08 '13 at 08:51
  • @pks You need to create a ton of them. The first one with the ACTION_DOWN, the following ones with ACTION_MOVE and the last one with ACTION_UP. You also have to be concerned about different screen sizes. – jihonrado May 08 '13 at 10:40
  • How can I come to know if my page has been completely curled as I have to check this condition and then execute some code in the `if block` – Prateek May 22 '13 at 10:12
  • hey I have done the button click motion part , but I have got another problem , when I tried to curl from left to right then the indexes are not properly maintained the bitmaps are not the right ones with respect to the current indices. you must have faced this while doing a curl from left to right. Can you give me a clue on this. – Prateek May 27 '13 at 12:45