Hi, All
I'm trying to make my own images gallery to sort my photos and delete garbage since 2012.
Now my code works rather slow, comparing to system Gallery apps.
Tons of photos, 3000+ pcs, sizes were always rising these years, 2....16 Mpix.
Trying to prepare class to get info about any image: https://www.b4x.com/android/forum/threads/lib-class-for-meta-info-about-any-image-file.148745, help is also welcomed...
Questions:
1. MediaManager v.1.13 - does it use some image resizing internally ?
4 pcs per row i'm sure they should be resized. Opening to view bigger is anyway by the path to a fullscreen HugeImageView.
2. Log sometimes shows:
I'm trying to make my own images gallery to sort my photos and delete garbage since 2012.
Now my code works rather slow, comparing to system Gallery apps.
Tons of photos, 3000+ pcs, sizes were always rising these years, 2....16 Mpix.
My code::
Sub CreateGallery
Log("Gallery creation is started")
MediaManager.Initialize
MediaManager.MaxImageSize = 30000000
PCLV.Initialize(Me, "PCLV", CustomListView1)
Dim height As Int
If xui.IsB4J Then height = 200dip Else height = 150dip
For i = 1 To lstRepresetativeImages.Size Step 4
Log(i)
PCLV.AddItem(height, xui.Color_White, CreateMyImageData(i))
Next
PCLV.ShowScrollBar = True
PCLV.ExtraItems = 3
PCLV.Commit
Log("Gallery is created")
End Sub
Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
For Each i As Int In PCLV.VisibleRangeChanged(FirstIndex, LastIndex)
Dim item As CLVItem = CustomListView1.GetRawListItem(i)
Dim pnl As B4XView = xui.CreatePanel("")
item.Panel.AddView(pnl, 0, 0, item.Panel.Width, item.Panel.Height)
Dim data As MyImageData = item.Value
'Create the item layout
pnl.LoadLayout("item")
For x = 0 To 3
Dim idx As Int = data.IndexOfFirstImage + x
pnl.GetView(x).GetView(1).Text = idx
pnl.GetView(x).GetView(0).Tag = idx
If idx >= lstRepresetativeImages.Size Then
Exit
End If
Dim folder As String = others.GetPath(lstRepresetativeImages.Get(idx))
Dim fn As String = others.GetFileName(lstRepresetativeImages.Get(idx))
MediaManager.SetMediaFromFile(pnl.GetView(x).GetView(0), folder, fn, "image/*", Null) 'CreateMap(MediaManager.REQUEST_BACKGROUND: xui.Color_Transparent, MediaManager.REQUEST_CALLBACK: Me))
'Wait For SMM_MediaReady (Success As Boolean, Media As SMMedia) 'it's very slow if to use Extra REQUEST_CALLBACK
Next
Next
'The purpose of this call is to find panels that are no longer in the views tree and cancel any ongoing request that is no longer relevant.
'It also happens automatically from time to time but in this case, as many requests are sent frequently, it is better to force it to trim the cache.
MediaManager.TrimMediaCache
End Sub
Trying to prepare class to get info about any image: https://www.b4x.com/android/forum/threads/lib-class-for-meta-info-about-any-image-file.148745, help is also welcomed...
Questions:
1. MediaManager v.1.13 - does it use some image resizing internally ?
4 pcs per row i'm sure they should be resized. Opening to view bigger is anyway by the path to a fullscreen HugeImageView.
2. Log sometimes shows:
But now only MediaManager.MaxImageSize property exists - is it the same ?File larger than MaxFileSize 10,871,308