If you use the ItemClick event to open another activity, the color of SenderPanel changes to PressedColor and The activity opens, but when second activity closes and the app returns to first Activity, the Item is still with the PressedColor.
This is the code In xCustomListView:
B4X:
Private Sub PanelClickHandler(SenderPanel As B4XView)
Dim clr As Int = GetRawListItem(SenderPanel.Tag).Color
SenderPanel.SetColorAnimated(50, clr, PressedColor)
If xui.SubExists(CallBack, EventName & "_ItemClick", 2) Then
CallSub3(CallBack, EventName & "_ItemClick", SenderPanel.Tag, GetRawListItem(SenderPanel.Tag).Value)
End If
Sleep(200)
SenderPanel.SetColorAnimated(200, PressedColor, clr)
End Sub
So, aparently if the Activity is changed, the second SetColorAnimated is never executed.
Any idea on how to fix this?
Workaround: add a sleep in the ItemClick to allow the animation to end before start the new Activity.
Moving the CallSub3 statement to the end of the PanelClickHandler sub solves the problem too.
Like this:
B4X:
Private Sub PanelClickHandler(SenderPanel As B4XView)
Dim clr As Int = GetRawListItem(SenderPanel.Tag).Color
SenderPanel.SetColorAnimated(50, clr, PressedColor)
Sleep(200)
SenderPanel.SetColorAnimated(200, PressedColor, clr)
If xui.SubExists(CallBack, EventName & "_ItemClick", 2) Then
CallSub3(CallBack, EventName & "_ItemClick", SenderPanel.Tag, GetRawListItem(SenderPanel.Tag).Value)
End If
End Sub
It's another workaround. It has just the same problem than mine, we are adding a pause and the user can "feel" the delay between the click and the action. I put my pause outside the xCustomListView because if you have other lists that dont start an activity, those are not afected.
The ListView has the animationand doesn't have this problem, color is changenged to normal state even if the activity changed. So, it should be possible somehow. I'm updating an App on ios and Android, porting all the lists to xCustomListView for easier code sharing. For now, I will use sleep on Android