Android Question XUI Views (Ver 2.00) Breaks CustomListView

MrKim

Well-Known Member
Licensed User
Longtime User
I just needed an Input Dialog similar to the one in Access/VBA.
It looks like XUI Views has what I need.
The problem is it breaks a bunch of existing code that uses CustomListView (Which I have modified for my needs)

Exisiting example:
B4X:
    CLV1.Add(CreateListItem("Done", CLV1.AsView.Width, 50dip, Colors.DarkGray, Colors.White, 16), 50dip, "TextColorsDone")

Evidently XUI Views also contains/steps on something called CustomListView?

What is breaking is the .Add - Mine has an extra parameter for the height of the added panel.
I also notice that the XUI version requires a B4XView, not a panel. How much recoding is involved there?

OLD:
upload_2019-5-9_23-59-50.png


VS NEW:

upload_2019-5-9_23-59-0.png


Don't mind fixing the code if I can get the same results and it is the future. And it doesn't take too long.

On the other hand keep in mind all I am after here is a 'Modal' Dialog to enter some text. I am just trying to get a job done.

Thanks for your help.
 

Attachments

  • upload_2019-5-9_23-55-50.png
    upload_2019-5-9_23-55-50.png
    6.5 KB · Views: 134

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem is that you are using a modified version of xCustomListView. What have you modified? Maybe it is not needed.

If you must use a modified version then you have two options:
1. Rename the modified module. You will also need to rename the custom types and update the code. It will require some work.
2. Build a library from the modified code and replace the internal xCustomListView library with your own.

Best option is to use the stock library. You can probably use it and change the behavior from outside the class.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
The problem is that you are using a modified version of xCustomListView. What have you modified? Maybe it is not needed.

If you must use a modified version then you have two options:
1. Rename the modified module. You will also need to rename the custom types and update the code. It will require some work.
2. Build a library from the modified code and replace the internal xCustomListView library with your own.

Best option is to use the stock library. You can probably use it and change the behavior from outside the class.

Thanks for your help Erel.

The xCustomListView library is not loaded. I am using a Class Module Called CustomListView that I got here somewhere.
Here is the list of Libs in my app:
upload_2019-5-10_0-49-26.png


Here is the beginning code from the Class Module:
B4X:
'version: 1.10
#Event: ItemClick (Index As Int, Value As Object)
Sub Class_Globals
    Public sv As ScrollView
    Private items As List
    Private panels As List
    Private dividerHeight As Float
    Private pressedDrawable As Object
    Private EventName As String
    Private CallBack As Object
    Private su As StringUtils
    Public DefaultTextSize As Int
    Public DefaultTextColor As Int
    Public DefaultTextBackgroundColor As Int
    Private DefaultTextBackground As Object
End Sub

Public Sub Initialize (vCallback As Object, vEventName As String)
    sv.Initialize2(0, "sv")
    items.Initialize
    panels.Initialize
    dividerHeight = 2dip
    EventName = vEventName
    CallBack = vCallback
    sv.Color = 0x597E89 'this sets the dividers color
    Dim r As Reflector
    Dim idPressed As Int
    idPressed = r.GetStaticField("android.R$drawable", "list_selector_background")
    r.Target = r.GetContext
    r.Target = r.RunMethod("getResources")
    pressedDrawable = r.RunMethod2("getDrawable", idPressed, "java.lang.int")
    DefaultTextColor = Colors.White
    DefaultTextSize = 16
    DefaultTextBackgroundColor = Colors.Black
    DefaultTextBackground = Null
End Sub

'Returns a view object that holds the list.
Public Sub AsView As View
    Return sv
End Sub
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
A better solution is to use the xcustomlistview library instead of the class module. Delete the old customlistview element from the layout and create a new one.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
FYI, I solved the problem by Renaming my Class Module CustomListView to KimsCustomListView. Once I did that it showed up as a new custom view so I added it to my activity in designer, copied all of the properties from the old CustomListView to the new KimsCustomListView, then deleted CustomListView and renamed KimsCustomListView CLV1.
Everything works and I have my Input Dialog. I am a happy man!

Yes, at some point I would like to switch everything over to the newer stuff but sometimes we just need to get a job done.
This is one of those times.
I'm guessing that if I had been using xcustomlistview library instead of the class the fix would not have been so simple.
 
Upvote 0
Top