B4A Library B4APhotoPager v3.85

B4APhotoPager v3.80 By Giuseppe Salvi


B4APhotoPager
Author: Giuseppe Salvi
Version: 3.8

  • Properties:
    • FromAssets As String [read only]
      Returns a references to the file added to the files tab. These file are read-only.
    • FromExtSdCard As String [read only]
      Returns image is located on the local file system or external SD card.
    • FromHttp As String [read only]
      Returns image is located in the network.
    • FromHttps As String [read only]
      Returns the image is located in the network.
    • FromSdCard As String [read only]
      Returns image is located on the local file system or SD card

  • Fields:
    • Compress_Format_JPG As CompressFormat
      Compression Format JPG
    • Compress_Format_PNG As CompressFormat
      Compression Format PNG

  • Fields:
    • Accordion As Int
    • BgToFg As Int
    • CardSlide As Int
    • Default As Int
    • DeptPage As Int
    • FadeInOut As Int
    • FgToBg As Int
    • FlipHorizontal As Int
    • FlipVertical As Int
    • HorizontalCube As Int
    • HorizontalElastic As Int
    • RotateDown As Int
    • RotateUp As Int
    • Rotation As Int
    • RotationSquare As Int
    • ScaleBgToFg As Int
    • Stack As Int
    • Tablet As Int
    • Transition_01 As Int
    • Transition_02 As Int
    • Transition_03 As Int
    • VerticalCube As Int
    • VerticalElastic As Int
    • ZoomIn As Int
    • ZoomOut As Int
    • ZoomOutSlide As Int

  • Fields:
    • Center As ScaleType
      Center the image in the view, but perform no scaling.
    • Center_Crop As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or larger than the corresponding dimension of the view (minus padding).
    • Center_Inside As ScaleType
      Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image
      will be equal to or less than the corresponding dimension of the view (minus padding).
    • Fit_Center As ScaleType
      Scale the image using CENTER.
    • Fit_End As ScaleType
      Scale the image using END.
    • Fit_Start As ScaleType
      Scale the image using START.
    • Fit_XY As ScaleType
      Scale the image using FILL.
  • PhotoPager
    Events:
    • Click
    • LongClick
    • MatrixChanged (Left As Int, Top As Int, Right As Int, Bottom As Int, Width As Int, Height As Int, CenterX As Int, CenterY As Int)
    • PageScrollStateChanged (State As Int)
    • PageScrolled (Position As Int, PositionOffset As Float, PositionOffsetPixels As Int)
    • PageSelected (Position As Int)
    • Ready
    • ScaleChanged (ScaleFactor As Int, FocusX As Int, FocusY As Int)
    Methods:
    • AddImage (dir As String, file As String)
      Add an image from sdcard or AssetsDir at the end of the view pager .
    • AddImageAt (index As Int, dir As String, file As String)
      Add an image from sdcard or AssetsDir to the desired position in the view pager.
    • AddImageFromWeb (address As String)
      Add an image from web and from Dropbox at the end of the view pager.
    • AddImageFromWebAt (index As Int, address As String)
      Add an image from web and from Dropbox to the desired position in the view pager.
    • AddView (view As View)
      Adds a view to the page.
      view: View
    • AddView2 (view As View, left As Int, top As Int, width As Int, height As Int)
      Adds a view to the page.
      view: View
      left: Left
      top: Top
      width: Width
      height: Height
    • AddViewAt (index As Int, view As View)
      Adds a view to the specified index.
      index: Page index
      view: View
    • AddViewAt2 (index As Int, view As View, left As Int, top As Int, width As Int, height As Int)
      Adds a view to the specified index.
      view: View
      left: Left
      top: Top
      width: Width
      height: Height
    • BringToFront
    • ClearDiskCache
      Clears disk cache.
    • ClearMemoryCache
      Clears memory cache.
    • DestroyEngine
      Stops ImageLoader and clears current configuration. Use this option on exit app.
    • GetArrayList As List
      Get array from GridView, Gallery, PhotoFlow.
    • GetImageListFromAssets (path As String, sort As Boolean) As List
      Get entire list of images stored in assets or sub-folder
      Examples:
      <code>
      Dim lv as ListView
      Dim l as list
      l.Initialize
      lv.Initialize("lv")
      Sub Menu_Click
      Activity.AddView(lv,0,0,100%x,100%y)
      l = vp.GetImageListFromAssets("Here the Images folder stored in Assets")
      or
      l = vp.GetImageListFromAssets(File.DirAssets)
      or
      l = vp.GetImageListFromAssets("")
      For n = 0 To l.Size-1
      lv.AddSingleLine(l.Get(n))
      next
      End Sub
      </code>
    • GetItem (position As Int) As String
      Returns Item
      Example:
      i.Bitmap=LoadBitmap("",g.GetItem(Position))
    • GetPageTag (index As Int) As Object
      Get or Sets the tag associated with this views. A tag can be used to mark
      a view in its hierarchy and does not have to be unique within the
      hierarchy. Tags can also be used to store data within a view without
      resorting to another data structure.
      index: the index of the page
      tag: return the Object stored in this view as a tag, or null if not set
    • GoToPage (item As Int, smoothScroll As Boolean)
      Get or Sets the currently selected page.
    • Initialize (EventName As String, initializeView As Boolean)
      Initialize the object
    • IsDoubleTapEnabled As Boolean
      Gets double tap from the page.
    • IsFadeEnabled As Boolean
      Gets fade from the page.
    • IsInitialized As Boolean
    • IsLockEnabled As Boolean
      Gets lock from the page.
    • IsPageEnabled (index As Int) As Boolean
      Returns the enabled status for this view. The interpretation of the
      enabled state varies by subclass.
      index: Page index
      Return type: @return:True if this view is enabled, false otherwise.
    • IsPageVisible (index As Int) As Boolean
      Returns the enabled status for this view. The interpretation of the
      enabled state varies by subclass.
      index: Page index
      Return type: @return:True if the view in this page is visible, false otherwise.
    • IsZoomEnabled As Boolean
      Gets zoom from the page.
    • LoadBitmap (Dir As String, FileName As String) As Bitmap
      Loads and decodes image synchronously.
      FileName: Image
      Example:
      <code>
      File.FromAssets,"image.png"
      or
      "assets://","image.png"
      File.FromSdCard,"image.png"
      or
      "file:///mnt/sdcard/","image.png"
      File.FromExtSdCard,"image.png"
      or
      "file:///mnt/extSdCard/","image.png"

      File.FromHttp,"image.png",width,height
      or
      "http://","site.com/image.png",width,height
      File.FromHttps,"image.png",width,height
      or
      "https://","site.com/image.png",width,heigh
      </code>
      Result image Bitmap. Can be <b>null</b> if image loading/decoding was failed or cancelled.
    • LoadBitmap2 (Dir As String, FileName As String, width As Int, height As Int) As Bitmap
      Loads and decodes image synchronously
      FileName: Image
      width: ImageSize
      height: ImageSize
      Example:
      <code>
      File.FromAssets,"image.png",width,height
      or
      "assets://","image.png",width,height
      File.FromSdCard,"image.png",width,height
      or
      "file:///mnt/sdcard/","image.png",width,height
      File.FromExtSdCard,"image.png",width,height
      or
      "file:///mnt/extSdCard/","image.png",width,height
      File.FromHttp,"image.png",width,height
      or
      "http://","site.com/image.png",width,height
      File.FromHttps,"image.png",width,height
      or
      "https://","site.com/image.png",width,heigh
      </code>
      targetImageSize: Minimal size for bitmap which will be returned. Downloaded image will be decoded
      and scaled to bitmap of the size which is <b>equal or larger</b> (usually a bit
      larger) than incoming targetImageSize.
      Result image Bitmap. Can be <b>null</b> if image loading/decoding was failed or cancelled.
    • LoadLayout (FileName As String)
      Loads a layout file(.bal) to PhotoPager as a view.
      LayoutFile: Load a LayoutFile created with designer
    • LoadLayout2 (index As Int, FileName As String)
      Loads a layout file(.bal) to PhotoPager to the specified index.
      index: Page index
      FileName: Load a LayoutFile created with designer
    • PauseEngine
      Pause ImageLoader. All new load and display tasks won't be executed until ImageLoader is resumed.
      Already running tasks are not paused.
    • RemoveAllViews
      Removes all child views.
    • RemoveViewAt (index As Int)
      Removes the view that is stored in specified index.
      index: Page index
    • ResumeEngine
      Resumes waiting load and display tasks.
    • SetArrayList (array As ArrayList)
      Set an array passed from, gallery, grid view, cover flow.
    • SetPageBackgroundColor (index As Int, color As Int)
      Sets Background Color to the page.
      index: Page index
      color: Page color
    • SetPageBackgroundImage (index As Int, bitmap As Bitmap)
      Sets Background bitmap to the page.
      index: Page index
      bitmap: Page bitmap
    • SetPageEnabled (index As Int, enabled As Boolean)
      Set the enabled state of this view. The interpretation of the enabled
      state varies by subclass.
      index: Page index
      enabled: True if this view is enabled, false otherwise.
    • SetPageTag (index As Int, tag As Object)
      Get or Sets the tag associated with this views. A tag can be used to mark
      a view in its hierarchy and does not have to be unique within the
      hierarchy. Tags can also be used to store data within a view without
      resorting to another data structure.
      index: the index of the page
      tag: set the Object stored in this view as a tag
    • SetPageVisible (index As Int, visible As Boolean)
      Set the enabled state of this view.
      index: Page index
      visibility: True if this view is enabled, false otherwise.
    • SetPanelBackgroundColor (index As Int, color As Int)
      Sets Background Color to the panel.
      index: Panel index
      color: Panel color
    • SetPanelBackgroundImage (index As Int, bitmap As Bitmap)
      Sets Background bitmap to the panel.
      index: Panel index
      bitmap: Panel bitmap
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • ShowFromAssets (path As String, sort As Boolean)
      show images from assets or sub-folder not from sdcard.
    • ShowFromBucket (path As String, sort As Boolean)
      Show from media bucket
      path:
      sort:
    • ShowFromMediaStore (sort As Boolean)
      show images from media store.
    • ShowFromSdCard (dir As String, path As String, sort As Boolean)
      show images from sdcard not from assets.
    • ShowFromWeb (webStrings() As String, sort As Boolean)
      show images from web.
    • StopEngine
      Cancels all running and scheduled display image tasks.
      <b>NOTE:</b> This method doesn't shutdown if you set them.
      ImageLoader still can be used after calling this method.
    • SwapView (i As Int, j As Int)
      Swaps the elements at the specified positions in the specified list.
      (If the specified positions are equal, invoking this method leaves
      the list unchanged.)
      i: the index of one element to be swapped.
      j: the index of the other element to be swapped.
    Permissions:
    • android.permission.INTERNET
    • android.permission.MEDIA_CONTENT_CONTROL
    • android.permission.READ_EXTERNAL_STORAGE
    • android.permission.WRITE_EXTERNAL_STORAGE
    Properties:
    • AdjustViewBounds As Boolean
      Get or Sets this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.
    • BackGroundColor As Object [write only]
      Get or Sets the background color for this view.
      Example:
      BackGroundColor = Color.Aqua
      BackGroundColor = "#88666666"
      or
      BackGroundColor = Colors.ARGB(100,20,20,20) or Colors.RGB(20,20,20)
    • Background As Drawable
    • BackgroundColorRandomly As Boolean [write only]
      Set the Background Color Randomly.
    • CacheInMemory As Boolean [write only]
      Sets whether loaded image will be cached in memory - by default false.
    • CacheOnDisk As Boolean [write only]
      Sets whether loaded image will be cached on disk - by default false.
    • Color As Colors
      Returns one of the Color value in the list
    • CompressFormat As PhotoPagerBitmaCompression
      Get or Sets the known formats a bitmap can be compressed into [ JPG or PNG ]
    • CompressQuality As Int
      Get or Sets the quality of a bitmap, that can be compressed. [ 0 = low -> 100 = high ]
    • CurrentItem As Void
      Get or Sets the currently selected page.
    • DoubleTapEnabled As Boolean [write only]
      Sets double tap to the page.
    • FadeEnabled As Boolean [write only]
      Sets fade to the page.
    • FadeInTime As Int [write only]
      Duration of "fade-in" animation (in milliseconds)
      Whether animation should be played if image is loaded from network
      Whether animation should be played if image is loaded from disk cache
      Whether animation should be played if image is loaded from memory cache.
    • File As Files [read only]
      Return File:
      File.FromAssets
      File.FromSdCard
      File.FromExtSdCard
      File.FromHttp
      File.FromHttps
    • Length As Int [read only]
      Returns length.
    • LockEnabled As Boolean [write only]
      Sets lock to the page.
    • MaximumScale As Float [write only]
      Sets the maximum scale
    • MediumScale As Float [write only]
      Sets the medium scale
    • MinimumScale As Float [write only]
      Sets the minimum scale
    • OutlineColor As Int [write only]
      Sets outline color to photo pager.
    • OutlineEnabled As Boolean [write only]
      Enable or disable outline to photo pager.
    • Parent As Object [read only]
    • ProgressBarVisible As Boolean [write only]
      Set the enabled state of this view. - by default is true.
    • ScaleType As PhotoPagerScaleType
      Controls how the image should be resized or moved to match the size of this ImageView.
      by default is Fit_Center.
    • SetImageForEmptyUri As String [write only]
      Sets own icon on loading.
    • SetImageOnFail As String [write only]
      Sets own icon on fail.
    • ShowMessageError As Boolean [write only]
      Set to true if you want to display an error message.
    • Tag As Object
      Get or Sets the tag associated with PhotoPager. A tag can be used to mark
      a view in its hierarchy and does not have to be unique within the
      hierarchy. Tags can also be used to store data within a view without
      resorting to another data structure.
    • Top As Int
    • Transition As PagerTransitionEffects
      Get or Sets transition effect
    • Version As String [read only]
      Return Author and Version of the library
    • ZoomEnabled As Boolean [write only]
      Sets zoom to the page.


 

Attachments

  • B4APhotoPager_lib_v2.20.zip
    388.7 KB · Views: 662
  • B4APhotoPager_v3.80.zip
    396 KB · Views: 424
  • B4APhotoPager_v3.85.zip
    399 KB · Views: 623
Last edited:

Creaky

Member
Licensed User
Longtime User
Hi All,

There are several mentions of a demo app in this thread, yet the OP doesn't contain one, just the libs. Where can I find a sample app for this library?
 

Creaky

Member
Licensed User
Longtime User
Hi Shahid,

Thanks for the link, but I'm actually looking for example code. I've tried to make very simple app but it keeps crashing when I initialize the Photopager. So I'm in need of example code to see what I'm doing wrong.
 

Creaky

Member
Licensed User
Longtime User
Whatever I do, my app crashes with an outofmemory error as soon as I initialise the PhotoPager object.
 

Creaky

Member
Licensed User
Longtime User
Shahid, I found your example, but it doesn't contain the layout files, so I can't get it to work.
The error I get when I initialise the object on a Galaxy S6 is:

java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available

This is my code:

#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim objPager As PhotoPager
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
objPager.Initialize("pg")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

Shahid Saeed

Active Member
Licensed User
Longtime User
Shahid, I found your example, but it doesn't contain the layout files, so I can't get it to work.
The error I get when I initialise the object on a Galaxy S6 is:

java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available

This is my code:

#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim objPager As PhotoPager
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
objPager.Initialize("pg")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

I have attached a working example for an older version of PhotoPager. I hope it may help you
 

Attachments

  • B4APhotoPager v1.30.zip
    508.2 KB · Views: 312

Creaky

Member
Licensed User
Longtime User
Please help. I'm trying to use the B4APhotoPager library in an app for a customer. While the 1.3 example code/app works fine, the library crashes when I incorporate it in my app. I've simply copy/pasted the 1.3 example code in a new activity module in my project and I start the activity by clicking a button in my app.

As soon as the activity tries to initialize the vp object, the app crashes with this line in the Logs:

java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available

If I compile and run the 1.3 example on the same device it works just fine.

My deadline is very near and I really need this library to work, someone please lend me a hand! :eek:

Here is my code:
B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: False
#End Region

Sub Process_Globals

End Sub

Sub Globals

    Dim vp As PhotoPager
    Dim fromWeb() As String
   
End Sub

Sub Activity_Create(FirstTime As Boolean)

    Activity.AddMenuItem("Show From SdCard","a")
    Activity.AddMenuItem("Show From MediaStore","b")
    Activity.AddMenuItem("Show From Assets","c")
    Activity.AddMenuItem("Show Media From Web","d")
    Activity.AddMenuItem("Clear Memory Cache","f")
    Activity.AddMenuItem("Clear Disk Cache","g")
    Activity.AddMenuItem("Exit","exit")
    vp.Initialize("vp")
    Activity.AddView(vp, 0, 0, 100%x, 100%y)
   
'    vp.ScaleType = vp.ScaleType.Center_Inside
    vp.FadeEnabled = True
    vp.ScaleType = vp.ScaleType.Center_Crop
'    vp.PagingEnabled = True
    vp.OutlineEnabled = True
    vp.OutlineColor = Colors.Black
    vp.Effect = vp.Effect.Standard '.CubeOut
'    vp.DoubleTapEnabled = False
'    vp.ScaleEnabled = False
'    vp.ScrollEnabled = False
'    vp.CacheInMemory = True
    vp.CacheOnDisk = True
    vp.ProgressBarVisible = True
   
'    vp.CompressQuality = 80
'    vp.CompressFormat = vp.CompressFormat.Compress_Format_JPG
'    vp.ToggleRotation = True

loadweb
d_Click
End Sub

Sub loadweb
fromWeb = Array As String( _
            "https://lh4.googleusercontent.com/-Z4zGiC5nWdc/URqvBdEwivI/AAAAAAAAAbs/ZRZR1VJ84QA/s1024/Sin%252520Lights.jpg", _
            "https://lh4.googleusercontent.com/-_0cYiWW8ccY/URqvBz3iM4I/AAAAAAAAAbs/9N_Wq8MhLTY/s1024/Starry%252520Lake.jpg", _
            "https://lh3.googleusercontent.com/-A9LMoRyuQUA/URqvCYx_JoI/AAAAAAAAAbs/s7sde1Bz9cI/s1024/Starry%252520Night.jpg", _
            "https://lh3.googleusercontent.com/-KtLJ3k858eY/URqvC_2h_bI/AAAAAAAAAbs/zzEBImwDA_g/s1024/Stream.jpg", _
            "https://lh5.googleusercontent.com/-dFB7Lad6RcA/URqvDUftwWI/AAAAAAAAAbs/BrhoUtXTN7o/s1024/Strip%252520Sunset.jpg", _
            "https://lh5.googleusercontent.com/-at6apgFiN20/URqvDyffUZI/AAAAAAAAAbs/clABCx171bE/s1024/Sunset%252520Hills.jpg", _
            "https://lh4.googleusercontent.com/-7-EHhtQthII/URqvEYTk4vI/AAAAAAAAAbs/QSJZoB3YjVg/s1024/Tenaya%252520Lake%2525202.jpg", _
            "https://lh6.googleusercontent.com/-8MrjV_a-Pok/URqvFC5repI/AAAAAAAAAbs/9inKTg9fbCE/s1024/Tenaya%252520Lake.jpg", _
            "https://lh5.googleusercontent.com/-B1HW-z4zwao/URqvFWYRwUI/AAAAAAAAAbs/8Peli53Bs8I/s1024/The%252520Cave%252520BW.jpg", _
            "https://lh3.googleusercontent.com/-PO4E-xZKAnQ/URqvGRqjYkI/AAAAAAAAAbs/42nyADFsXag/s1024/The%252520Fisherman.jpg", _
            "https://lh4.googleusercontent.com/-iLyZlzfdy7s/URqvG0YScdI/AAAAAAAAAbs/1J9eDKmkXtk/s1024/The%252520Night%252520is%252520Coming.jpg", _
            "https://lh6.googleusercontent.com/-G-k7YkkUco0/URqvHhah6fI/AAAAAAAAAbs/_taQQG7t0vo/s1024/The%252520Road.jpg", _
            "https://lh6.googleusercontent.com/-h-ALJt7kSus/URqvIThqYfI/AAAAAAAAAbs/ejiv35olWS8/s1024/Tokyo%252520Heights.jpg", _
            "https://lh5.googleusercontent.com/-Hy9k-TbS7xg/URqvIjQMOxI/AAAAAAAAAbs/RSpmmOATSkg/s1024/Tokyo%252520Highway.jpg", _
            "https://lh6.googleusercontent.com/-83oOvMb4OZs/URqvJL0T7lI/AAAAAAAAAbs/c5TECZ6RONM/s1024/Tokyo%252520Smog.jpg", _
            "https://lh3.googleusercontent.com/-FB-jfgREEfI/URqvJI3EXAI/AAAAAAAAAbs/XfyweiRF4v8/s1024/Tufa%252520at%252520Night.jpg", _
            "https://lh4.googleusercontent.com/-vngKD5Z1U8w/URqvJUCEgPI/AAAAAAAAAbs/ulxCMVcU6EU/s1024/Valley%252520Sunset.jpg", _
            "https://lh6.googleusercontent.com/-DOz5I2E2oMQ/URqvKMND1kI/AAAAAAAAAbs/Iqf0IsInleo/s1024/Windmill%252520Sunrise.jpg", _
            "https://lh5.googleusercontent.com/-biyiyWcJ9MU/URqvKculiAI/AAAAAAAAAbs/jyPsCplJOpE/s1024/Windmill.jpg", _
            "https://lh4.googleusercontent.com/-PDT167_xRdA/URqvK36mLcI/AAAAAAAAAbs/oi2ik9QseMI/s1024/Windmills.jpg", _
            "https://lh5.googleusercontent.com/-kI_QdYx7VlU/URqvLXCB6gI/AAAAAAAAAbs/N31vlZ6u89o/s1024/Yet%252520Another%252520Rockaway%252520Sunset.jpg", _
            "https://lh4.googleusercontent.com/-e9NHZ5k5MSs/URqvMIBZjtI/AAAAAAAAAbs/1fV810rDNfQ/s1024/Yosemite%252520Tree.jpg")
End Sub

Sub a_Click

    vp.ShowFromSdCard(File.DirRootExternal, "Images2",False)

End Sub

Sub b_Click

    vp.ShowFromMediaStore(False)

End Sub

Sub c_Click
   
    vp.ShowFromAssets("Images",False)  'or  vp.ShowFromAssets("Image/",false)
   
End Sub

Sub d_Click
   
    vp.ShowFromWeb(fromWeb,False)
    vp.GoToPage(Main.intCurrentAlbumPhoto,False)
End Sub

Sub f_Click

    vp.ClearMemoryCache
   
End Sub

Sub g_Click

    vp.ClearDiskCache
   
End Sub

Sub vp_PageSelected(Position As Int)

    Activity.Title  = "Current Item = " & Position
   
End Sub

Sub vp_PageScrollStateChanged(State As Int)
    ' here some event
End Sub

Sub vp_PageScrolled(Position As Int, PositionOffset As Float, PositionOffsetPixels As Int)
    ' here some event
End Sub

Sub vp_LongClick
    vp.DestroyEngine
    ExitApplication
End Sub

Sub exit_Click
    vp.DestroyEngine
    ExitApplication
   
End Sub

Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
 
Last edited:

Creaky

Member
Licensed User
Longtime User
I think I just found out what the problem was.
The three images (empty_photo.png, ic_error.png, icon.png) in the files dir of the example project ARE REQUIRED by the B4APhotoPager library!
If they are not present you will receive the OutOfMemoryError error.

Giuseppe please mention these files in your documentation :)
 
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
I think I just found out what the problem was.
The three images (empty_photo.png, ic_error.png, icon.png) in the files dir of the example project ARE REQUIRED by the B4APhotoPager library!
If they are not present you will receive the OutOfMemoryError error.

Giuseppe please mention these files in your documentation :)


Hi, really U dont need The three images (empty_photo.png, ic_error.png, icon.png) but U've to use your own images by ( SetImageForEmptyUri and SetImageOnFail )

Example:

PhotoPager.SetImageForEmptyUri(YourImage.png)

PhotoPager.SetImageOnFail(YourImage.png)

Let me know.
 

itgirl

Active Member
Licensed User
Longtime User
Hello guys ive tried this amazing lib nice work except i found a problem while you pinch the image 3 or 4 time [Hold fingers]

B4X:
LogCat connected to: 4d009d040c4430ef
--------- beginning of main
vp scrolled
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
    at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
    at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1282)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2310)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568)
    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776)
    at android.app.Activity.dispatchTouchEvent(Activity.java:2866)
    at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529)
    at android.view.View.dispatchPointerEvent(View.java:9173)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
    at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
    at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
    at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6625)
    at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6677)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
    at android.view.Choreographer.doCallbacks(Choreographer.java:590)
    at android.view.Choreographer.doFrame(Choreographer.java:558)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5942)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$Me
Message longer than Log limit (4000). Message was truncated.
** Activity (main) Create, isFirst = true **
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hello guys ive tried this amazing lib nice work except i found a problem while you pinch the image 3 or 4 time [Hold fingers]

B4X:
LogCat connected to: 4d009d040c4430ef
--------- beginning of main
vp scrolled
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
    at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
    at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1282)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2310)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2709)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2425)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2568)
    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1776)
    at android.app.Activity.dispatchTouchEvent(Activity.java:2866)
    at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2529)
    at android.view.View.dispatchPointerEvent(View.java:9173)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4706)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4544)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6564)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6454)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6425)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6654)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
    at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
    at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
    at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6625)
    at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6677)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
    at android.view.Choreographer.doCallbacks(Choreographer.java:590)
    at android.view.Choreographer.doFrame(Choreographer.java:558)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5942)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$Me
Message longer than Log limit (4000). Message was truncated.
** Activity (main) Create, isFirst = true **


Hi, just now I tried the library I pinch the image 3,4 time and Hold also the fingers, I dont see any problem it work well.
 

itgirl

Active Member
Licensed User
Longtime User
Hi, just now I tried the library I pinch the image 3,4 time and Hold also the fingers, I dont see any problem it work well.
im not 100% sure how to reproduce the error but try to to pinch 3-4 time slowly it happen , i run android 5... by the way thank you for this amazing work and thank you for your quick response.
 
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
More info about this bug can be found https://github.com/chrisbanes/PhotoView/issues/72
theres is a simple solution or workaround for the meanwhile by simply try and catch
onInterceptTouchEvent
could you please update the library with this fix ?

Hi, as I said to Laurent and Susu, I had problems with the shop where I bought the computer. He sold me a computer with used motherboard and faulty.
When I went to talk to him about motherboard , he told me that I had no more warranty and I went to a lawyer to reclaim my motherboard and 2 new SSD were burnt about motherboard .

I'm already working to fix the libraries because I lost part of them was on the ssd.

Thank you for the tip I'll put it in to the library.
 

itgirl

Active Member
Licensed User
Longtime User
Hi, as I said to Laurent and Susu, I had problems with the shop where I bought the computer. He sold me a computer with used motherboard and faulty.
When I went to talk to him about motherboard , he told me that I had no more warranty and I went to a lawyer to reclaim my motherboard and 2 new SSD were burnt about motherboard .

I'm already working to fix the libraries because I lost part of them was on the ssd.

Thank you for the tip I'll put it in to the library.
Ohh im sorry to hear that... i know what it feels :/ Sorry hope to get ur Motherboard back ;)
 
Top