B4A Library PageTurnView library providing a page turn animation

Smee

Well-Known Member
Licensed User
Longtime User
B4X:
Sub PageTurner_GetBitmap(Width As Int, Height As Int, Page As Int) As Bitmap 'Called when the Bitmap for the given page number is required. Return the Bitmap
   Dim bmp As Bitmap
   Dim cnv As Canvas
   
   bmp.InitializeMutable(Width, Height)
   cnv.Initialize2(bmp)
   
   FilenameOnly=PicFileName(Page)
   Filenamex= "/cats/" & DirName & PicFileName(Page)

   Log(Page & "/" & MaxRecs & " " & Filenamex)

   Try
      b.Initialize(File.DirInternal,Filenamex)
   Catch
      b.Initialize(File.DirInternal,"/cats/blank.jpg")
   End Try
   
   brect.Initialize(0,0,b.Width, b.Height)
   cnv.DrawBitmap(b, Null, brect)
   PageNumber=page
           Return bmp

End Sub

As far as i can tell i am feeding the next page in the sequence each time the user makes a turn. But as i say if the screen is touched the page is advanced by one but the screen is showing the previous page becuse the user has not completed the entire turn. Therefore my PageNumber=page becomes incorrect because in that instance PageNumber=page-1.
In other words my links will point to Page 1 but the screen shows page 0.

A synchronisation error
 

agraham

Expert
Licensed User
Longtime User
You are making the erroneous assumption that the page requested is the page displayed. Surely you don't need to track the page number, just give it the page it requests. If the user subsequently makes a decision to react to something he sees on the page just fetch CurrentPage in whatever event he causes to be raised and carry on from there.
 

Smee

Well-Known Member
Licensed User
Longtime User
You are making the erroneous assumption that the page requested is the page displayed. Surely you don't need to track the page number, just give it the page it requests.

Yes I do

If the user subsequently makes a decision to react to something he sees on the page just fetch CurrentPage in whatever event he causes to be raised and carry on from there.

Sometimes i dont see the forest for the trees

I will modify my code but i think that will do the trick. I am using the pagename to track but i will modify

Thanks Andrew.

Hopefully that will work
 

Smee

Well-Known Member
Licensed User
Longtime User
:sign0060::sign0060:

Yep that did it. Now on to the next hurdle

Thanks Andrew
 

karmba_a

Member
Licensed User
Longtime User
But I mean The direction of the book from right to left

Browse its pages starting from the left how to make him start from the right.

Please help me and thank you
 

Smee

Well-Known Member
Licensed User
Longtime User
But I mean The direction of the book from right to left

Browse its pages starting from the left how to make him start from the right.


Just start the pages from the last page. i.e if you have 11 pages then start at page 10

PageTurner.CurrentPage=10 then you will move back 1 page at a time

Hope this helps
 

karmba_a

Member
Licensed User
Longtime User
Just start the pages from the last page. i.e if you have 11 pages then start at page 10

PageTurner.CurrentPage=10 then you will move back 1 page at a time

Hope this helps

thank you
 

karmba_a

Member
Licensed User
Longtime User
Click when the right or left of the page it changes the page number with me and I do not want to change only if the turned the page.
 

Smee

Well-Known Member
Licensed User
Longtime User
Read through this whole thread again. ifr i understand you properly you are making the same mistake i was making

Quote:Originally Posted by agraham
You are making the erroneous assumption that the page requested is the page displayed. Surely you don't need to track the page number, just give it the page it requests.

Yes I do

Quote:If the user subsequently makes a decision to react to something he sees on the page just fetch CurrentPage in whatever event he causes to be raised and carry on from there.
 

Rusty

Well-Known Member
Licensed User
Longtime User
Page Turn View

This is wonderful.
Is there a way to do this with views on the pages?
Thanks,
 

hackhack

Active Member
Licensed User
Longtime User
Small request, couldn't you write the version changes in the first post? (or if not, then link to the messages?)
 

susu

Well-Known Member
Licensed User
Longtime User
Agraham, I tried to read a text file into text string

text = File.GetText(File.DirAssets, "content.txt")

but I got "java.io.IOException" error.


How can I fix it?
Thank you so much.
 

susu

Well-Known Member
Licensed User
Longtime User
I found out that "Data exceeds" error. Maybe I need to "trim" the text file first?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…