1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4A Library PageTurnView library providing a page turn animation

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

  1. Fox

    Fox Active Member Licensed User

    You have an option to show a second pic or text on the page 1? and other pages.. at me there is no pic / Text on the page :)
     
  2. Smee

    Smee Well-Known Member Licensed User

    Unable to show text but can show another pic not on the back of the page but on the subsequent page. by loading another image to the next page

    When I rotate device the program just exits as does the demo. Any one else have that problem?
     
    Last edited: Aug 13, 2011
  3. agraham

    agraham Expert Licensed User

    Are you using version 1.2? It works fine on the three devices that I have. Look in the unfiltered logs for an exception.

    The GetBitmap and GetPages run on the OpenGL rendering thread, not the application main thread so you can't touch any view or you'll get an exception. I'll put that in the xml. You probably got a file not found exception and Basic4android couldn't display the error message box because it was not on the main thread.
     
  4. Smee

    Smee Well-Known Member Licensed User

    Andrew,

    Using Ver 2.2

    The jpgs all display ok forward and backward. It is only when i rotate from Vertical to Horizontal or vice versa the program drops out.

    ** Activity (main) Pause, UserClosed = false **
    ** Activity (main) Resume **
    Process anywheresoftware.b4a.agraham.pageturnviewdemo (pid 10376) has died.
    WIN DEATH: Window{ae49e7d0 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    WIN DEATH: Window{ae4da310 SurfaceView paused=false}
    WIN DEATH: Window{ae46e070 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    Unexpected resume of anywheresoftware.b4a.b4abridge while already resumed in anywheresoftware.b4a.agraham.pageturnviewdemo
    showStatusIcon on inactive InputConnection
    GC_EXPLICIT freed 5293 objects / 282720 bytes in 29ms
    GC_EXPLICIT freed 111 objects / 8552 bytes in 14ms
    GC_EXPLICIT freed 96 objects / 3912 bytes in 14ms
    GC_EXPLICIT freed 2788 objects / 179064 bytes in 16ms

    The above is what i get after changing rotation
     
  5. agraham

    agraham Expert Licensed User

    I assume you version mean 1.2. What device and Android version are you using?

    Are you sure there isn't an exception showing in the log as by itself that doesn't make sense as an application normally doesn't die without any indication of what went wrong?

    Does it do the same with the unedited demo from the library archive?
     
  6. Smee

    Smee Well-Known Member Licensed User


    The device is a viewsonic and android version is 2.2. I updated from 1.5 cos it did the same in 1.5

    This is the log with the demo . i cleared the log file then rotated so this is the entire log as it shuts down

    Setting rotation to 0, animFlags=1
    Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=1/2 orien=2 layout=35 uiMode=17 seq=114}
    Unexpected resume of anywheresoftware.b4a.agraham.pageturnviewdemo while already resumed in anywheresoftware.b4a.agraham.pageturnviewdemo
    ** Activity (main) Pause, UserClosed = false **
    Process 10834 terminated by signal (11)
    WIN DEATH: Window{ae4e4440 SurfaceView paused=false}
    WIN DEATH: Window{ae3f8518 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    Process anywheresoftware.b4a.agraham.pageturnviewdemo (pid 10834) has died.
    Unexpected resume of anywheresoftware.b4a.b4abridge while already resumed in anywheresoftware.b4a.agraham.pageturnviewdemo
    WIN DEATH: Window{ae45c090 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    ** Activity (main) Resume **
    showStatusIcon on inactive InputConnection
    GC_EXPLICIT freed 5381 objects / 288240 bytes in 29ms

    EDIT.

    Sorry yes the example is the latest one 1.2

    The cpu on the device is atom
     
    Last edited: Aug 13, 2011
  7. agraham

    agraham Expert Licensed User

    Which device is it? I assume you mean an x86 Intel Atom! If so then my guess it that it is a bug, probably in OpenGL, related to the port of Android to that architecture. All my devices are ARM based.
     
  8. Smee

    Smee Well-Known Member Licensed User

    Andrew,

    I set the IDE to allow only Landscape and when i turned it this is what i got in the log. On Demo 1.2

    GC_EXPLICIT freed 115 objects / 8928 bytes in 16ms
    ACTION_BATTERY_CHANGED pluggedType: 0
    Setting rotation to 3, animFlags=1
    ** Activity (main) Pause, UserClosed = false **
    Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=1/2 orien=1 layout=35 uiMode=17 seq=18}
    Unexpected resume of anywheresoftware.b4a.agraham.pageturnviewdemo while already resumed in anywheresoftware.b4a.agraham.pageturnviewdemo
    Process 2317 terminated by signal (11)
    WIN DEATH: Window{ae4b2a40 SurfaceView paused=false}
    WIN DEATH: Window{ae448df0 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    WIN DEATH: Window{ae481488 anywheresoftware.b4a.agraham.pageturnviewdemo/anywheresoftware.b4a.agraham.pageturnviewdemo.main paused=false}
    Process anywheresoftware.b4a.agraham.pageturnviewdemo (pid 2317) has died.
    Unexpected resume of org.adw.launcher while already resumed in anywheresoftware.b4a.agraham.pageturnviewdemo
    aborting loaders
    GC_EXPLICIT freed 8724 objects / 575432 bytes in 26ms
    csju_screen->width:600
    csju_screen->height:1024
    GC_EXTERNAL_ALLOC freed 4585 objects / 259632 bytes in 40ms
    load applications
    --> applications loaded, return
    loading user items in Thread[main,5,main]
    --> items loaded, return
    --> loading from cache: 6, 0
    ------> binding 6 items
    ------> binding 0 widgets
    ------> start binding items
    GC_EXTERNAL_ALLOC freed 7760 objects / 505416 bytes in 27ms
    GC_EXPLICIT freed 765 objects / 34712 bytes in 37ms
    showStatusIcon on inactive InputConnection
    Setting rotation to 0, animFlags=1
    Config changed: { scale=1.0 imsi=0/0 loc=en_US touch=3 keys=2/1/2 nav=1/2 orien=2 layout=35 uiMode=17 seq=19}
    Unexpected resume of org.adw.launcher while already resumed in org.adw.launcher
    aborting loaders
    GC_EXPLICIT freed 6120 objects / 417216 bytes in 37ms
    csju_screen->width:600
    csju_screen->height:1024
    GC_EXTERNAL_ALLOC freed 2171 objects / 120672 bytes in 39ms
    load applications
    --> applications loaded, return
    loading user items in Thread[main,5,main]
    --> items loaded, return
    --> loading from cache: 6, 0
    ------> binding 6 items
    ------> binding 0 widgets
    ------> start binding items
    GC_EXTERNAL_ALLOC freed 7448 objects / 482376 bytes in 27ms
    GC_EXPLICIT freed 188 objects / 7112 bytes in 37ms
    GC_EXPLICIT freed 202 objects / 8976 bytes in 30ms
    GC_EXPLICIT freed 330 objects / 13152 bytes in 15ms
    GC_EXPLICIT freed 425 objects / 20224 bytes in 16ms
     
  9. agraham

    agraham Expert Licensed User

    Which device is it?
     
  10. agraham

    agraham Expert Licensed User

    There's something strange happening on that device. With an application restricted to a single orientation you should never get a pause event when you rotate the device.

    You could try commenting out the PageTurner.OnPause and PageTurner.OnResume lines but I don't hold out much hope. It looks like a device specific problem to me I'm afraid.
     
  11. Smee

    Smee Well-Known Member Licensed User

    its Viewsonic vpad10.

    it only happens with this program. All other tests i have tried work ok

    i already tried commenting everthing out of the two subs. no good
     
  12. agraham

    agraham Expert Licensed User

    Definitely x86 then. Have you tried the OpenGL library demo and this example?

    I'm afraid that I can think of nothing do do to the library code as it runs fine on other devices and there is no indication of what the cause of the failure might be on the Viewpad.
     
  13. Fox

    Fox Active 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
       
    Dim c As Canvas
       
    Dim b As Bitmap
       
    Dim brect As Rect

       bmp.InitializeMutable(Width, Height)
       cnv.Initialize2(bmp)
       
       cnv.DrawColor(PageColors(
    Page))
       
       
    If page = 0 Then
       
       cnv.DrawText( 
    "Page 0 Text Center", Width/2180dipTypeface.DEFAULT, 24Colors.White, "CENTER")
       
       b.Initialize(
    File.DirAssets, "picture.png")
       brect.Initialize(
    0,0,b.Width, b.Height)
       cnv.DrawBitmap(b, 
    Null, brect)
       
       
    If page = 1 Then 
    cnv.DrawText( 
    "Page1 Text", Width/2260dipTypeface.DEFAULT, 24Colors.White, "CENTER")
       
       
    If Page = PageColors.Length - 1 Then
       cnv.DrawText( 
    "Letzte Seite", Width/2100dipTypeface.DEFAULT, 24Colors.White, "CENTER")
       
    End If
       
    End If
       
    End If
       
    Return bmp
       
    End Sub
    Where is my problem Page 0 is fantastic if i changed to page 1 no error but just a blue page no text nothing...
     
  14. agraham

    agraham Expert Licensed User

    Your Ifs are incorrectly nested.
     
  15. Fox

    Fox Active Member Licensed User

    Thanks for the hint. but how it should be correct i have tryout somethink...
     
  16. Smee

    Smee Well-Known Member Licensed User

    The First demo will not run. When i load it a message says to install b4a into a path without spaces and that the path hass illegal characters.
    Both of which are incorrect.

    The second demo crashes the same way when rotated

    :sign0148:

    BooHooooooo


    Thanks very much for your efforts regardless Andrew. It is still a great library even though it will not run on my device
    :BangHead::BangHead::BangHead:
     
  17. Fox

    Fox Active Member Licensed User

    Thanks for the hint. but how it should be correct i have tryout somethink...

    Thanks for the help with the hint.
     
    Last edited: Aug 15, 2011
  18. nfordbscndrd

    nfordbscndrd Well-Known Member Licensed User

    Just to nitpick a little for the sake of complete accuracy (at least as far as my Toshiba Thrive tablet goes). The steps below (copied from the Wiki) describes how an app restricted to a single orientation can be made to rotate. While the steps below only talk about the restart, before that point Pause will be executed (unless this is something peculiar to the Thrive).

     
  19. Smee

    Smee Well-Known Member Licensed User

    Yep, There is definitely something wierd about this device. Not only does it drop out on a change of orientation but if i start the program from the device (as opposed to compiling and running from the bridge) it always starts in landscape regardless of how i am holding the device.
     
  20. MikieK

    MikieK Member Licensed User

    Gradient on underside of the page

    Firstly, can I just say what a fantastic job you have done with this library Andrew. The demo runs great on my milestone. :sign0188:
    Sorry to nit pick (as I could never have achieved what you have here)
    I have looked everywhere in the documentation, but to no gain.
    Is there a way to control the colors shown in the gradient on the underside of the turning page?
     
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