B4J Library [B4X] [XUI] [B4XLib] SD_ShopListView

This new view allows you to have an ordered and distributed list of images (left) and their name, description and info (right)
Or you can view the images in grid (if the screen size allows it, otherwise in column) where there will be related images with the name just below
There is an add button and a close button that makes the visit invisible (mBase.Visible = False so to speak)
Note: In the asset file you must always put the empty.png file. The file can be found in the examples

NOTE: You can use this library for personal and commercial use. Include it in your projects.. Attention, even if it is a B4XLib library, it is not allowed to decompress it, modify it, change its name or redistribute it without the permission of the author

SD_ShopListView

Author:
Star-Dust
Version: 0.13
  • ShopListView
    • Events:
      • Add
      • Clicked (Pos As Int, ID As String)
    • Fields:
      • Animated As Boolean
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • AddItem (ID As String, Image As B4XBitmap, Name As String, Description As String, Info As String)
        Add Item - with Image
      • AddItemAsync (ID As String, FileName As String, Name As String, Description As String, Info As String)
        Add Item - with local file image
      • AddItemNoImage (ID As String, Name As String, Description As String, Info As String)
        Add Item - Without image - The image can be set later asynchronously
      • AddToParent (MainPane As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)
      • Base_Resize (Width As Double, Height As Double)
      • BringToFront
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • GetDescription (ID As String) As String
      • Getid (position As Int) As String
      • GetInfo (ID As String) As String
      • GetName (ID As String) As String
      • GrayBitmap (bmp As B4XBitmap) As B4XBitmap
      • ImageView (EventName As String) As B4XView
      • Initialize (Callback As Object, EventName As String)
      • Invalidate
      • isGrid As Boolean
      • RequestFocus
      • SendToBack
      • SetImage (ID As String, Image As B4XBitmap)
      • SetItem (ID As String, NewName As String, NewDescription As String, NewInfo As String)
      • SetVisibleAnimated (Duration As Int, Visible As Boolean)
      • size As Int
      • Snapshot As B4XView
      • TurnToGrid
      • TurnToList
    • Properties:
      • ButtonAddVisible As Boolean [write only]
      • ButtonExitVisible As Boolean [write only]
      • ButtonsGridListVisible As Boolean [write only]
      • Enable As Boolean
      • FilterFont As B4XFont ' Hint Font
      • FilterHint As String
      • FilterSearchText As String
      • FilterVisible As Boolean [write only]
      • Height As Int
      • Left As Int
      • Top As Int
      • Visible As Boolean
      • Width As Int
  • xSD_Scroll
    • Events:
      • ScrollChanged (X As Double, Y As Double)
      • ScrollChangedX (X As Double)
      • ScrollChangedY (Y As Double)
    • Fields:
      • PX As Double
      • PY As Double
    • Functions:
      • AddToParent (MainPane As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)
        Create from codice
      • AddView (View As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)
      • BringToFront
      • ClearAll
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • FullScroll (Bottom As Boolean)
      • GetAllViewsRecursive As List
      • GetBase As B4XView
      • GetView (Index As Int) As B4XView
      • Initialize (Callback As Object, EventName As String)
      • IsInitialized As Boolean
      • LoadLayout (LayoutFile As String)
      • NativeObject As Object
      • NumberOfViews As Int
      • Parent As B4XView
      • RemoveAllViews
      • RemoveViewFromParent
      • RequestFocus
      • SendToBack
      • SetBitmap (bmp As B4XBitmap)
      • SetColorAndBorder (Backgroundcolor As Int, BorderWidth As Int, BorderColor As Int, BorderCornerRadius As Int)
      • SetColorAnimated (Duration As Int, FromColor As Int, ToColor As Int)
      • SetLayoutAnimated (Duration As Int, Left As Int, Top As Int, Width As Int, Height As Int)
      • SetPanelBitmap (bmp As B4XBitmap)
      • SetRotationAnimated (Duration As Int, Degree As Int)
      • SetVisibleAnimated (Duration As Int, Visible As Boolean)
      • Snapshot As B4XView
    • Properties:
      • Color As Int
      • Enable As Boolean
      • Height As Int
      • HorizontalBar As Boolean
      • Left As Int
      • Panel As B4XView [read only]
      • PanelHeight As Int
      • PanelWidth As Int
      • PositionX As Double
      • PositionY As Double
      • Tag As Object
      • Top As Int
      • VerticalBar As Boolean
      • Visible As Boolean
      • Width As Int


Video1.gif
Video2.gif
 

Attachments

  • iSample.zip
    110.3 KB · Views: 418
  • jSample.zip
    60.4 KB · Views: 455
  • aSample.zip
    8.3 KB · Views: 480
  • SD_ShopListView.b4xlib
    10.2 KB · Views: 303
Last edited:

AnandGupta

Expert
Licensed User
Longtime User
Why it is named 'SD_StrangeListView' ?
Any specific reason.
 

Star-Dust

Expert
Licensed User
Longtime User
Why it is named 'SD_StrangeListView' ?
Any specific reason.
I've done a lot of cross-platform ListViews and ran out of names.
Then since it works in two modes, in List and Grid, it is an anomalous thing that I have translated Strange .... If you have a better name I change it
 

AnandGupta

Expert
Licensed User
Longtime User
Exist ?‍♂️
forum search did not give any for 'SD_ListGridImageView'
Anyway you are the best judge. Only later on looking at the name may not give much info about it.
 

Star-Dust

Expert
Licensed User
Longtime User

However, it does not reflect the two modes well
 

epiCode

Active Member
Licensed User
SD_InfoListView
 

Star-Dust

Expert
Licensed User
Longtime User

However, it does not reflect the two modes well
It's a good idea.
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.03
  • Added isGrid Properties (boolean)
  • Added TurnToList method
  • Added TurnToGrid method
 

netsistemas

Active Member
Licensed User
Longtime User
I install your last version. Method TurntoList not work (may by in horizontal)

B4X:
    ShopListView1.Invalidate
    'ShopListView1.TurnToList

(method i can write my previous code and use)


But the important is this:


I think there are a bug.
To replicate:
-run app in horizontal mode
-my phone show 4 items per line.
-i have 23 photos
the program crak. To solve i change this code in xSD_Scroll



with this i have not error, but only view 20 photos (4 photos por row, 5 rows -> 20 photos)

i'm sure the last row are not showed, because i sort the photos (by name), and the last 3 photos are not displayed.

and other efect. in a old tablet, when scroll the view in Grid Mode (only 1 element by row), is very slow....
in previous version, i think was ok (i'm not sure)
 
Last edited by a moderator:

Star-Dust

Expert
Licensed User
Longtime User
I don't get any crashes in the conditions you described to me. But it is true that the last row in the grid is not displayed. and does not depend on xSD_Scroll.

I have updated the version. Please do not unzip and / or open the library, this is not allowed
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.04
  • added ButtonsGridListVisible As Boolean (Only Write)
  • fix bugs
 

netsistemas

Active Member
Licensed User
Longtime User
i continue testing and implementin you library in my proyect.

This doit:
- button no visible - i do this:
B4X:
    ShopListView1.GetBase.GetView (5) .Visible = False
    ShopListView1.GetBase.GetView (4) .Visible = False
    ShopListView1.GetBase.GetView (0).Visible  = False
Ok.



but i need set the LISTVIEW ON TOP = 0 , thats is, somethins like this:

ShopListView1.Photos.ToTopOfScreen

may be in this method you can set NO VISIBLE buttons, because if the panel set to top, is not pretty the others buttons.


And importante for me (the errror in other message continue)



..

This code i can NOT change in final proyect (i must use .b4xlib library, no code. OK)
if you need my proyect, i can send you. No problem.
(If no solve this problem, i can't use you library and change to other solution.)
Thanks again for all your time!
 
Last edited by a moderator:

Star-Dust

Expert
Licensed User
Longtime User
i continue testing and implementin you library in my proyect.

This doit:
- button no visible - i do this:
B4X:
    ShopListView1.GetBase.GetView (5) .Visible = False
    ShopListView1.GetBase.GetView (4) .Visible = False
    ShopListView1.GetBase.GetView (0).Visible  = False
Ok.



but i need set the LISTVIEW ON TOP = 0 , thats is, somethins like this:

ShopListView1.Photos.ToTopOfScreen

may be in this method you can set NO VISIBLE buttons, because if the panel set to top, is not pretty the others buttons.


And importante for me (the errror in other message continue)

In your code :

Public Sub setPositionY(Y As Double)
y need do this or the component CRACK:

...

B4X:
Dim B As Long
        A = sc.Panel.Height
        B=  sc.Panel.Height   'TO solve the problem... but i don't know what do this code ?¿?¿?¿
        Dim p As Int = Y*(A-B)
sc.VerticalScrollPosition=p
..

This code i can NOT change in final proyect (i must use .b4xlib library, no code. OK)
if you need my proyect, i can send you. No problem.
(If no solve this problem, i can't use you library and change to other solution.)
Thanks again for all your time!


this code is wrong. So A Is Always equal B...
B4X:
A = sc.Panel.Height
b=  sc.Panel.Height   'TO solve the problem... but i don't know what do this code ?¿?¿?¿

Dim p As Int = Y*(A-B)

This Is wrong
B4X:
ShopListView1.GetBase.GetView(5).Visible = False
ShopListView1.GetBase.GetView (4) .Visible = False
ShopListView1.GetBase.GetView (0).Visible  = False

Thie Is right
B4X:
ShopListView1.FilterVisible = False
ShopListView1.ButtonExitVisible = False
ShopListView1.ButtonAddVisible = False
ShopListView1.ButtonsGridListVisible = False

I have warned several times not to open the code both in public and in private. I am forced to take action
 
Last edited:

netsistemas

Active Member
Licensed User
Longtime User
Ah.. and how to set the size of photos/images (all imagen, more big. In my tablet, the image are small....)
 

netsistemas

Active Member
Licensed User
Longtime User
okay. Sorry. It was not my intention and I take note of my serious error.
I apologize for my gross irregularity.
Star Dust, I hope you can excuse me.
 
Top