B4A Library PageTurnView library providing a page turn animation

MikieK

Member
Licensed User
look, you have to bare in mind that I have absolutely no training in VB. I started off years ago playing around with qbasic. So I'm not going to understand most anything. The way I find my way is by trial and error.

I willl try to explain...
Why would you put a call to a subroutine in a place where it will never run???????
Because I don't understand what return means.

I reckon the only way that you can put more than a bmp in the PageTurner_GetBitmap sub is to use a webview and then use CaptureBitmap to return an actual bitmap. (personally, I'm not interested in javascript as I want to stick to one language)
If you where to load a WebView, I think theoretically you could control before the pageturner is initialised and then produce a bitmap based on the current view to be used in the page turner.

Again, I'm new at this, so I could be wrong. BUT I think that this library would be more useful if you ripped out the draw ellements of it and let us handle the touch events.
I don't understand why this would be impossible, surely the library in question will just refer to the java module or code that handles the event, in wich case it will require similar inputs?

Let me know If I'm wrong, I'm constantly trying to learn.
 

Smee

Well-Known Member
Licensed User
We are all new at some time or another. But you probably should not give advice like

you won't get an error if you call the sub after "Return bmp".
if you dont know what the result would be or if you do not know what the statement itself means. As for the rest of it i'll let that go through to the keeper.

Andrew,
This is the code snippet
B4X:
If Page = MaxRecs Then       ' Last page Load new Records from Next Directory
   CatNum=CatNum+1      ' Increment the directory flag
   LastPageNum=MaxRecs ' in case we need to go back a directory
   OpenPictureTable         'loads all pic names in array for this directory
   PageTurner.CurrentPage=0  'Start the display at zero
end if
Hope you can help with this

Joe
 

MikieK

Member
Licensed User
We are all new at some time or another. But you probably should not give advice like

Quote:
you won't get an error if you call the sub after "Return bmp".
again, all I know is what I've tried, and strangely enough, I didn't get an error when I tried that- I didn't get what I was looking for, but I didn't get an error.
Again, If you look at my zip file I uploaded, I'm working on an alternative to this library (one that works with list views or simiar). Give me a day or two, and I will upload it, and you will be free to criticise/ use it as much as you want. Assuming that you want a similar thing... ie. a page turning animation that works with a non bitmap layout?
 

Smee

Well-Known Member
Licensed User
again, all I know is what I've tried, and strangely enough, I didn't get an error when I tried that- I didn't get what I was looking for, but I didn't get an error.
Again, If you look at my zip file I uploaded, I'm working on an alternative to this library (one that works with list views or simiar). Give me a day or two, and I will upload it, and you will be free to criticise/ use it as much as you want. Assuming that you want a similar thing... ie. a page turning animation that works with a non bitmap layout?
No offence meant. I look forward to reading through your alternative

Cheers

@ Andrew
Looks OK but you haven't really described the problem you are getting. Did you put the Log statements in as I suggested earlier?
yep i have logs in but i am getting a diff of 1 each time. Gunna try something different 2morrow. too tired now

Joe
 

agraham

Expert
Licensed User
i am getting a diff of 1 each time.
I think I know what is confusing you. The library will ask for the previous and maybe the next page when you set CurrentPage so you will need to cope with that as you change your picture tables. Maybe you need to keep two tables open at any one time to cope with the overlap.

EDIT:- Only the previous page I now suspect.
 
Last edited:

ZJP

Active Member
Licensed User
Hi,

Nice update and example Agraham.
It works with RichString? I tried without success.

JP
 
Last edited:

ZJP

Active Member
Licensed User
Thx.
The solution: Build a page with RichtString, save it in jpg and reload it in the "book".

JP
 
Last edited:

Smee

Well-Known Member
Licensed User
Maybe you need to keep two tables open at any one time to cope with the overlap.

EDIT:- Only the previous page I now suspect.
Yes i thought of that but the trouble is there could be 13 directories that the user may arbitrarily start at and they may decide to go forwards OR backwards. I'm gunna have to think about how i can deal with that.
 

Smee

Well-Known Member
Licensed User
Andrew,

I have come across a problem with tracing the pages. They dont seem to count properly, following is a list of the log

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
0/9 /cats/baby/BABY 123.jpg
1/9 /cats/baby/BABY 124.jpg
2/9 /cats/baby/BABY 140.jpg
3/9 /cats/baby/BABY 168.jpg
4/9 /cats/baby/BABY 169.jpg
5/9 /cats/baby/BABY 170.jpg
6/9 /cats/baby/BABY 67.jpg
7/9 /cats/baby/BABY 67A.jpg
8/9 /cats/baby/BABY 68.jpg
9/9 /cats/baby/BABY 69.jpg
9 - 9
0/8 /cats/bagswallets/BAGS 01.jpg
1/8 /cats/bagswallets/GENERAL 367.jpg
1/8 /cats/bagswallets/GENERAL 367.jpg
2/8 /cats/bagswallets/GENERAL 367A.jpg
3/8 /cats/bagswallets/GENERAL 494.jpg
4/8 /cats/bagswallets/GENERAL 523.jpg
5/8 /cats/bagswallets/GENERAL 559.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
7/8 /cats/bagswallets/WALLETS 44.jpg
8/8 /cats/bagswallets/WALLETS 58.jpg
5/8 /cats/bagswallets/GENERAL 559.jpg
5/8 /cats/bagswallets/GENERAL 559.jpg
4/8 /cats/bagswallets/GENERAL 523.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
4/8 /cats/bagswallets/GENERAL 523.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
3/8 /cats/bagswallets/GENERAL 494.jpg
3/8 /cats/bagswallets/GENERAL 494.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
6/8 /cats/bagswallets/WALLETS 41.jpg
4/8 /cats/bagswallets/GENERAL 523.jpg
3/8 /cats/bagswallets/GENERAL 494.jpg

you can see it seems to jump a few pages at times. any idea how i could rectify this

Regards

joe
 

agraham

Expert
Licensed User
Is this a perceived problem from reading the log or an actual visual problem? I can't see how the library could ask for out of sequence pages unless you are directly setting CurrentPage or giving it the wrong reply to the GetPages event. It might look in the log out order when turning backwards. If you are on page 5 and turn back the library will ask for page 3 in order to display the reverse of page 3 together with page 4. As it already has page 4 displayed reversed with page 5 it has no need to re-request it. So you see a request for page 5 then page 3 but that is in fact correct.
 

Smee

Well-Known Member
Licensed User
It is an actual problem. If the page is slightly turned but then released the page no is set at the following page but the page shown is not the one in the log
 

Smee

Well-Known Member
Licensed User
this is the log of turning pages in a smooth motion
Installing file.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
0/9 /cats/baby/BABY 123.jpg
1/9 /cats/baby/BABY 124.jpg
2/9 /cats/baby/BABY 140.jpg
3/9 /cats/baby/BABY 168.jpg
4/9 /cats/baby/BABY 169.jpg
5/9 /cats/baby/BABY 170.jpg
6/9 /cats/baby/BABY 67.jpg
7/9 /cats/baby/BABY 67A.jpg
8/9 /cats/baby/BABY 68.jpg
9/9 /cats/baby/BABY 69.jpg
it is all corect

After reversing back to the start

0/9 /cats/baby/BABY 123.jpg
1/9 /cats/baby/BABY 124.jpg
1/9 /cats/baby/BABY 124.jpg

The log shows that we are showing page 1 but in reality it is page 0. I half turned the page and let go.

The reason it is a problem is because i need to display item numbers of items that are on that page. It will show the item codes from page 1 not page 0. (They are stored in an array with the same number as the page)
 

Smee

Well-Known Member
Licensed User
But is it the one the user expects?
[/Unquote]

No. The page number shown on the page has different items on it so when the log may be showing page 0it is still actually showing page 1 so consequently the items listed are different to the ones being shown.

Is there an event that is fired when the page has been completely turned.
As it stands, if the pages are turned the sequencing is correct. However the PageTurner_GetBitmap sub is fired as soon as the screen is touched whether the page is turned or not

Hope this makes sense
 

agraham

Expert
Licensed User
[However the PageTurner_GetBitmap sub is fired as soon as the screen is touched whether the page is turned or not
That is correct, that is how it is designed. You can't assume that the displayed page is the last page requested as the user may have dropped the page back to the previous one.

I'm missing something here. If it asks for a specific page why can't you just build it and give it to it? How can it get out of order :confused:
 
Top