Android Question Custom Cardview with okhttputils

PumaCyan

Member
Licensed User
2.png


I have a problem showing the next data to the right hand column
i am using xCLV and OkHttputils...
my question, how so that "Lorem Ipsum Book 2" can go on the right
following my code :

My Code:
Sub Globals
    Private strCountEbook As Int
    Private PCLV As PreoptimizedCLV
    Private xui As XUI
    Private CLV1 As CustomListView
    Private lblJudul1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("lyebookls")
    imgNoData.Visible = False
    PCLV.Initialize(Me, "PCLV", CLV1)
    '
    Total_Ebook
    List_Ebook
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Activity_KeyPress(KeyCode As Int) As Boolean
    '
    If KeyCode = KeyCodes.KEYCODE_BACK Then
        Activity.Finish
        Return False
    Else if KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
        Dim p As Phone
        Dim jo As JavaObject
        jo.InitializeContext
        jo.RunMethod("setVolumeControlStream", Array(p.VOLUME_MUSIC))
        Return False
    Else if KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
        Dim p As Phone
        Dim jo As JavaObject
        jo.InitializeContext
        jo.RunMethod("setVolumeControlStream", Array(p.VOLUME_MUSIC))
        Return False
    Else
        Return True
    End If
    '
End Sub

Sub Total_Ebook
    Dim TotalEbook As HttpJob
    TotalEbook.Initialize("TotalEbook", Me)
    TotalEbook.Download(ModURL.URLEbook & "total-ebook.php")
    ProgressDialogShow2("Please Wait...",False)
End Sub

Sub List_Ebook
    Dim ListEbook As HttpJob
    ListEbook.Initialize("ListEbook", Me)
    ListEbook.Download(ModURL.URLEbook & "list-ebook.php")
    ProgressDialogShow2("Please Wait...",False)
End Sub

Sub JobDone (Job As HttpJob)
    ProgressDialogHide
    If Job.Success = True Then
        Dim result As String
        'Dim action As String
        Dim parser As JSONParser
        '
        result = Job.GetString
        parser.Initialize(result)
        '
        Log(Job.JobName)
        '
        Select Job.JobName
            '
            Case "TotalEbook"
                '
                Dim root As List = parser.NextArray
                For Each colroot As Map In root
                    Dim cd As Ebook
                    cd.totalebook = colroot.Get("total")
                    strCountEbook = cd.totalebook
                Next
               
            Case "ListEbook"
                '
                Dim root As List = parser.NextArray
                For Each colroot As Map In root
                    Dim cd As Ebook
                    '
                    cd.kode = colroot.Get("kode")
                    cd.nama_buku = colroot.Get("nama_buku")
                    cd.kategori = colroot.Get("kategori")
                    cd.view = colroot.Get("view")
                    '
                    Dim p As B4XView = xui.CreatePanel("")
                    p.Color = Colors.White
                    p.SetLayoutAnimated(0, 0, 0, CLV1.AsView.Width, 225dip)
                    CLV1.Add(p, cd)
                    '
                Next
        End Select
    Else
        MsgboxAsync("Error", "Kesalahan")
    End If
    Job.Release
End Sub

Sub CLV1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    Dim ExtraSize As Int = 25
    For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, CLV1.Size - 1)
        Dim p As B4XView = CLV1.GetPanel(i)
        If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
            If p.NumberOfViews = 0 Then
                Dim cd As Ebook = CLV1.GetValue(i)
                p.LoadLayout("lyebooklsv")
                '
                lblJudul1.Text = cd.nama_buku
            End If
        Else 'Not visible
            If P.NumberOfViews > 0 Then
                P.RemoveAllViews
            End If
        End If
    Next
End Sub
 
Top