B4J Question [ABMaterial] realtime updating ABMImage with .IsMaterialBoxed = True

peacemaker

Expert
Licensed User
Longtime User
Hi, All

I'm making a dynamical image lister, with zoomable images:
B4X:
Sub Show_Image(nextOne As Boolean)
    If nextOne Then
        source_frames_counter = source_frames_counter + 1
    Else
        source_frames_counter = source_frames_counter - 1
    End If
    If source_frames_counter > source_frames_files.Size - 1 Then
        source_frames_counter = 0
    End If
    If source_frames_counter < 0 Then
        source_frames_counter = source_frames_files.Size - 1
    End If
    Dim img_file As String = source_frames_files.Get(source_frames_counter)  'file name from List with file names
    Delete_Img_Files_Only(File.Combine(File.DirApp, "www"), ".jpg")
    File.Copy(source_frames_folder, img_file, File.Combine(File.DirApp, "www"), img_file)
    img_source_frame.Source = "../../" & img_file
    img_source_frame.Refresh
    card_source_frame.Content = img_file
    card_source_frame.Refresh
End Sub

Sub Delete_Img_Files_Only (folder1 As String, ext As String)
    If folder1 = "" Then Return
    Try
        Dim L As List = File.ListFiles(folder1)
        For i = 0 To L.Size - 1
            Dim fn As String = L.Get(i)
            If File.IsDirectory(folder1, fn) = False Then
                If fn.EndsWith(ext) Then
                    File.Delete(folder1, fn)
                End If
            End If
        Next
    Catch
        Log("Delete_All_Files_Only=" & fn & ": " & LastException)
    End Try
End Sub

1) Trick (https://www.b4x.com/android/forum/threads/abmaterial-change-abmimage-image.79560/) does not work anymore:
B4X:
 ipcam1.Source="../icons/shot.jpg" & DateTime.Now
 ipcam1.Refresh
But different img links - work, image is updated realtime (but i have to delete previous .jpg file)

2) img.IsMaterialBoxed = True - is required, but closing the opened image ... shows just grey empty screen, when enlarged image is closed back.

Any suggestion ?

upd: if to scroll the page by mouse - after some steps - the page is again visible (scrolled)
 
Last edited:
Top