Press on the image to return to the main documentation page.
PageTurnView
Written by Andrew Graham
This PageTurnView inherits the properties and methods of a normal Basic4android view. Some are overriden to provide the correct behaviour of this view, some will work correctly while others may have no, or a detrimental effect when invoked. Experiment will inform.
There are no touch or click events available as the page turning animation swallows all gestures.
Note that the PageTurnerView events run on a separate thread to the main thread. They therefore must not try to manipulate GUI elements or an exception will occur. The RunOnGuiThread method allows an event to invoke a Sub to be run on the main thread.
The GetPages() As Int event is called when the number of pages is required. Return the total number of pages that are available for display.
The GetBitmap(Width as Int, Height As Int, Page as Int) As Bitmap event is called when the Bitmap for the given page number is required. Return the appropriate Bitmap. If the returned Bitmap is not of the requested size it will be displayed scaled to fit.
This library contains a View that presents a Bitmap as a book page and simulates the turning of pages with an animation in reponse to touch events. It is based on an OpenGL implementation by Harri Smått at https://github.com/harism/android_page_curl with additions by Andrew Graham to adapt it for use with Basic4android. This library is based on page_curl-339d9e0.zip whose sources are dated 8/8/11 The library is released under Apache 2.0 and can be used in commercial or personal projects.
Copyright 2011 Harri Smått Copyright 2011 Andrew Graham
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
Events:
GetPages() As Int 'Called when the number of pages is required. Return the number of pages 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 Click LongClick