Bug? xcustomlistview 1.71 crash when resizeItem in 9.0 pie

rkxo

Active Member
Licensed User
Longtime User
Hi,
I try in v8 oreo and 9 pie anD only crash in v9 when run ResizeItem
specifically in InsertAtImpl function from xcustomlistview v1.71.
Any idea?

B4X:
Sub Search_QueryChanged(Query As String)
    Try
 
 

        'CargadadosPendentsFast
        If Query<>"" Then
            For i=0 To CLV3XCUS.Size-1
       
                Dim p As Panel = CLV3XCUS.GetPanel(i)
                If p.Tag<>"fecha" Then
                    Dim cd As AveriaData = CLV3XCUS.GetValue(i)
 
                    If cd.L_coment.Contains(Query.ToLowerCase) Or cd.L_coment.Contains(Query.ToUpperCase) Then
                        If p.Height=0 Then
                            CLV3XCUS.ResizeItem(i,valu)
                        End If
                        Log(valu)
               
                    else If cd.L_Averia.Contains(Query.ToLowerCase) Or cd.L_Averia.Contains(Query.ToUpperCase) Then
                        If p.Height=0 Then
                            CLV3XCUS.ResizeItem(i,valu)
                        End If
                        Log(valu)
               
                    else If cd.L_NumAveria.Contains(Query.ToLowerCase) Or cd.L_NumAveria.Contains(Query.ToUpperCase) Then
                        If p.Height=0 Then
                            CLV3XCUS.ResizeItem(i,valu)
                        End If
                        Log(valu)
               
                    else If cd.L_nomCruce.Contains(Query.ToLowerCase) Or cd.L_nomCruce.Contains(Query.ToUpperCase) Then
                        If p.Height=0 Then
                            CLV3XCUS.ResizeItem(i,valu)
                        End If
                        Log(valu)
               
                    else If cd.L_NumCruce.Contains(Query.ToLowerCase) Or cd.L_NumCruce.Contains(Query.ToUpperCase) Then
                        If p.Height=0 Then
                            CLV3XCUS.ResizeItem(i,valu)
                        End If
                        Log(valu)
               
                    Else
           
                        If p.Height>0 Then
                            CLV3XCUS.ResizeItem(i,0)'---> CRASH
                        End If
   
   
                    End If
       
                End If
       
 
            Next
 
            Log(Query)
            Else
           
            For i=0 To CLV3XCUS.Size-1
       
                Dim p As Panel = CLV3XCUS.GetPanel(i)
                If p.Tag<>"fecha" Then
                    If p.Height=0 Then
                    CLV3XCUS.ResizeItem(i,valu)
                    End If
                End If
            Next
        End If
    Catch
        Log(LastException)
    End Try
    Log(Query)
End Sub

(IllegalArgumentException) java.lang.IllegalArgumentException: Cannot set 'scaleY' to Float.NaN
h
--------- beginning of crash
java.lang.IllegalArgumentException: Cannot set 'scaleY' to Float.NaN
at android.view.View.sanitizeFloatPropertyValue(View.java:16572)
at android.view.View.sanitizeFloatPropertyValue(View.java:16546)
at android.view.View.setScaleY(View.java:15937)
at android.animation.PropertyValuesHolder.nCallFloatMethod(Native Method)
at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38)
at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1387)
at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:990)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:684)
at android.animation.ValueAnimator.start(ValueAnimator.java:1081)
at android.animation.ValueAnimator.start(ValueAnimator.java:1098)
at android.animation.ObjectAnimator.start(ObjectAnimator.java:852)
at android.animation.ValueAnimator.startWithoutPulsing(ValueAnimator.java:1091)
at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1149)
at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1053)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964)
at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:721)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Exacly crash here

B4X:
Private Sub InsertAtImpl(Index As Int, Pnl As B4XView, ItemSize As Int, Value As Object, InitialSize As Int)
    'create another panel to handle the click event
    Dim p As B4XView = CreatePanel("Panel")
    p.Color = Pnl.Color
    Pnl.Color = xui.Color_Transparent
    If horizontal Then
        p.AddView(Pnl, 0, 0, ItemSize, sv.ScrollViewContentHeight)
    Else
        p.AddView(Pnl, 0, 0, sv.ScrollViewContentWidth, ItemSize)
    End If
    p.Tag = Index
    Dim IncludeDividierHeight As Int
    If InitialSize = 0 Then IncludeDividierHeight = mDividerSize Else IncludeDividierHeight = 0
    Dim NewItem As CLVItem
    NewItem.Panel = p
    NewItem.Size = ItemSize
    NewItem.Value = Value
    NewItem.Color = p.Color
    If Index = items.Size And InitialSize = 0 Then
        items.Add(NewItem)
        Dim offset As Int
        If Index = 0 Then
            offset = mDividerSize
        Else
            offset = GetScrollViewContentSize
        End If
        NewItem.Offset = offset
        If horizontal Then
            sv.ScrollViewInnerPanel.AddView(p, offset, 0, ItemSize, sv.Height)
        Else
            sv.ScrollViewInnerPanel.AddView(p, 0, offset, sv.Width, ItemSize)
        End If
    Else
        Dim offset As Int
        If Index = 0 Then
            offset = mDividerSize
        Else
            Dim PrevItem As CLVItem = items.Get(Index - 1)
            offset = PrevItem.Offset + PrevItem.Size + mDividerSize
        End If
        For i = Index To items.Size - 1
            Dim It As CLVItem = items.Get(i)
            Dim NewOffset As Int = It.Offset + ItemSize - InitialSize + IncludeDividierHeight
            If Min(NewOffset, It.Offset) - GetScrollViewOffset < GetScrollViewVisibleSize Then
                It.Offset = NewOffset
                If horizontal Then
                    It.Panel.SetLayoutAnimated(AnimationDuration, NewOffset, 0, It.Size, It.Panel.Height)
                Else
                    It.Panel.SetLayoutAnimated(AnimationDuration, 0, NewOffset, It.Panel.Width, It.Size)
                End If
            Else
                SetItemOffset(It, NewOffset)
            End If
            It.Panel.Tag = i + 1
        Next
        items.InsertAt(Index, NewItem)
        NewItem.Offset = offset
        If horizontal Then
            sv.ScrollViewInnerPanel.AddView(p, offset, 0, InitialSize, sv.Height)
            p.SetLayoutAnimated(AnimationDuration, offset, 0, ItemSize, p.Height)
        Else
            sv.ScrollViewInnerPanel.AddView(p, 0, offset, sv.Width, InitialSize)
            p.SetLayoutAnimated(AnimationDuration, 0, offset, p.Width, ItemSize) ''->>> CRASH ITEMSIZE=0
        End If
    End If
    SetScrollViewContentSize(GetScrollViewContentSize + ItemSize - InitialSize + IncludeDividierHeight)
    If items.Size = 1 And Index = 0 Then SetScrollViewContentSize(ItemSize + mDividerSize * 2)
    If Index < mLastVisibleIndex Or GetRawListItem(mLastVisibleIndex).Offset + _
            GetRawListItem(mLastVisibleIndex).Size + mDividerSize < GetScrollViewVisibleSize Then
        UpdateVisibleRange
    End If
End Sub

thanks
 
Last edited:

rkxo

Active Member
Licensed User
Longtime User
The error is when itemsize=0 . If i set itemsize=1 works fine.Why only in v9.0?
 
Top