B4A Library [Library] B4aGridView v3.80

Shahid Saeed

Active Member
Licensed User
Longtime User

Copy the images from library example's assets folder to your projects files folder.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Hi shahid, i'm not using asset images etc. I just download images from the web. As said, in my simple B4A projects it works but when I have stuff like actionbars and other graphical elements if gives me a stackoverflow all the time.
 

Shahid Saeed

Active Member
Licensed User
Longtime User
Hi shahid, i'm not using asset images etc. I just download images from the web. As said, in my simple B4A projects it works but when I have stuff like actionbars and other graphical elements if gives me a stackoverflow all the time.
I understand what you are doing, but the library need the following images in the Files folder:-

empty_photo.png
ic_error.png
icon.png

You can copy these files from library's example folder or create your own. Initially I had same issue and after placing the files the error gone.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Hi Shahid,

That did the trick Now let's hope the library developer will make it possible to change these images by code, not a big fan of the style of these.
 

Constantin Cosoiu

New Member
Licensed User
Longtime User
Hi,

Thank you for your library. I would like to use it and to donate for it, as it is closest to what I want to achieve. My purpose is to pass as much processing as possible to the display library, rather than handling in my code, because my code has a huge amount of other calculations to make and I need to focus on them, not on the image display part.

There are 2 important things:

1. Titles or other texts/views for each item
If the titles are so needed (I need some pieces of texts on the image, too), let's do it more general.

Please take a look at Expedia's screenshot attached. There are some texts needed for each view, including a semitransparent Panel.

What about passing for each item, not only the image source, but a list of Maps containing the definitions of the Views to be created for that item?

For instance:
viewType - just few primitive types, like Panel, Label, Image, Checkbox
viewColor
viewPosition
viewText - where applicable (for instance, for an Image like a "star" to mark Favorite/Unfavorite, this is not needed)
viewTextFace
viewTextColor
viewTextSize
viewImageSource
viewTag
viewClickable

These views can be created for each item and, if clicked, they can trigger an event "_Click", that I can handle, having passed either item position or viewTag.

If you want, give me the function to display one item and I can implement the above code and send you back to verify it and to incorporate it in the Gallery, Gridview....

2. Items with different heights.

Given that you already handled different CENTER and SCALE types so well (I especially like the "CENTER_INSIDE" and "CENTER_FIT"), please think of a method of accepting items with different heights, when column number = 1. So that, we could we GridView like a vertical scrollview, but with all the above benefits.

That would mean another parameter viewPositionRelativeTo at the above 1., to reposition the views of each item AFTER its height is known. Some texts need to be displayed at the bottom.

Please contact me if you think I can help.
Thank you,
Constantin
 

Attachments

  • Expedia_Panels.jpg
    131.2 KB · Views: 281

stanks

Active Member
Licensed User
Longtime User
would be nice to have title label under every thumb....and some other views such as checkbox (e.g. Favorite checkbox)
 

Mrjoey

Active Member
Licensed User
Longtime User
hi mr Lonleystar , first of all , thank u very much for ur awsome libraries , u deserve a big donation , im using this library and B4aGallery , first i have 2 questions :
1 : for this library , i noticed that GridView_ItemClick takes time to be called , why? is that possible to solve this problem?
2 : for B4aGallery , im using 2 in my app , if i call GalleryB.ClearCache on 1 of the 2 i get an error : "arraylist cannot be empty" (im using GalleryB.SetArrayList(lst)) even though i ve created different cache name for both using GalleryB.CreateCache , so what is going here? and how to solve it?
thank u best regards.
 

Douglas Farias

Expert
Licensed User
Longtime User
why this error on debug?
libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
its normal ?


and how can use only square on grid? i dont want use circle *-*
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
thx man

man why i have this



my main
B4X:
Sub Globals
    Dim GridView As PhotoGridView
    Dim fromWeb() As String
    Dim posSelected As Int
End Sub




Sub Activity_Create(FirstTime As Boolean)

    fp = File.Combine(File.DirDefaultExternal,"click")
    kv.Initialize(fp, "data")
  
    Activity.LoadLayout("telaprincipal")

    sm.Initialize(Activity, Me, "SlideMenu", menu.Height, 80%x  )
    sm.AddItem("Meu Perfil", LoadBitmap(File.DirAssets, "icon_menu_001.png"), 1)
    sm.AddItem("Votar em Batalhas", LoadBitmap(File.DirAssets, "icon_menu_002.png"), 2)
    sm.AddItem("Ver Ranking", LoadBitmap(File.DirAssets, "icon_menu_003.png"), 3 )
    sm.AddItem("Eventos", LoadBitmap(File.DirAssets, "icon_menu_006.png"), 4)
    sm.AddItem("Sair", LoadBitmap(File.DirAssets, "icon_menu_005.png"), 5)
  
    MyFont = Typeface.LoadFromAssets("HavingWritBold.ttf")
    lb1.Typeface = MyFont
    lb2.Typeface = MyFont
    lb3.Typeface = MyFont
  
  
    'GRID
    GridView.Initialize("GridView")
    '*************************************
    Activity.AddView(GridView,0%X,55%Y,100%x,70%y)
    '*************************************
    GridView.ItemWidth= 16%y
    GridView.ItemHeight=GridView.ItemWidth
    GridView.HorizontalSpacing = 4dip
    GridView.VerticalSpacing = 4dip
    GridView.NumColumns = 4
    '*************************************
    GridView.ScaleType = GridView.ScaleType.Center
    '*************************************
    GridView.SetNoEffect = False
    GridView.FadeInTime = 300
    GridView.RoundedBitmap = False
    GridView.SetBorderColor = Colors.White
    GridView.SetCornerRadius = 20
    GridView.SetBorderWidth = 2
    '*************************************
    GridView.ProgressBarIndeterminate = False
    GridView.ProgressBarVisible = True
    '*************************************
    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")
  
  
End Sub

Sub Activity_Resume
    GridView.ResumeEngine
  
        GridView.ShowFromWeb(fromWeb,False)
    If posSelected > GridView.Length Then
        posSelected = GridView.Length-1
    End If
    GridView.Selection = posSelected
  
End Sub


i need to add webimages
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hey guys, take a look at the thumbnails below.

I've this little issue to [ Text_Top_OutSide ]
 

Attachments

  • Text_Top_Outside.jpg
    173.8 KB · Views: 261
  • Text_Top_Inside.jpg
    194.1 KB · Views: 249
  • Text_Center_Inside.jpg
    190.2 KB · Views: 252
  • Text_Bottom_Inside.jpg
    186.1 KB · Views: 244
Cookies are required to use this site. You must accept them to continue using the site. Learn more…