B4A Library PageTurnView library providing a page turn animation

Discussion in 'Additional libraries, classes and official updates' started by agraham, Aug 12, 2011.

  1. Smee

    Smee Well-Known Member Licensed User

    Code:
    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
     
  2. agraham

    agraham Expert Licensed 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.
     
  3. Smee

    Smee Well-Known Member Licensed User

    Yes I do

    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
     
  4. Smee

    Smee Well-Known Member Licensed User

    :sign0060::sign0060:

    Yep that did it. Now on to the next hurdle

    Thanks Andrew
     
  5. karmba_a

    karmba_a Member Licensed User

    How do I browse page from right to left :confused:
     
  6. Smee

    Smee Well-Known Member Licensed User

    Just draw your finger across the screen r to l or l to r
     
  7. karmba_a

    karmba_a Member Licensed User

    Thank you very much

    But I mean The direction of the book from right to left :sign0085:
     
  8. karmba_a

    karmba_a Member Licensed User

    But I mean The direction of the book from right to left :confused:

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

    Please help me and thank you
     
  9. Smee

    Smee Well-Known Member Licensed 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
     
  10. karmba_a

    karmba_a Member Licensed User

    thank you
     
  11. karmba_a

    karmba_a Member Licensed 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.
     
  12. Smee

    Smee Well-Known Member Licensed 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.
     
  13. agraham

    agraham Expert Licensed User

    Look at this post. You cannot assume that the last requested page is the presently displayed page. CurrentPage gives you that.
     
  14. karmba_a

    karmba_a Member Licensed User

    Thank you very much :D
     
  15. Rusty

    Rusty Well-Known Member Licensed User

    Page Turn View

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

    agraham Expert Licensed User

    No, it only works with the bitmaps you pass to it.
     
  17. hackhack

    hackhack Active Member Licensed User

    Small request, couldn't you write the version changes in the first post? (or if not, then link to the messages?)
     
  18. susu

    susu Well-Known Member Licensed User

    Agraham, I tried to read a text file into text string

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

    How can I fix it?
    Thank you so much.
     
  19. agraham

    agraham Expert Licensed User

    This has nothing to do with the library and the answer is already in the logs you posted.
     
  20. susu

    susu Well-Known Member Licensed User

    I found out that "Data exceeds" error. Maybe I need to "trim" the text file first?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice