Android Question Further to my Previous question about AS_Cardslider

rabbitBUSH

Well-Known Member
Licensed User
Previously posted question......

PROCESS TEXT : testCards - > I finally found time to create an example you can test -> attached below

run the project example
click View
select a card item to Manage
click Manage
Manage Page/Panel will show
{{Don't worry about changing stuff it won't do anything
The object being to test the return to the Viewing page}}
In the log you can follow the Card index numbers as you flick through the database, something like ->
PageChanged : old index 0 new index 0
PageChanged : old index 0 new index 1
PageChanged : old index 1 new index 2
PageChanged : old index 2 new index 3
PageChanged : old index 3 new index 4
Click the "return" arrow at the top left of the Manage Panel
which will return you to the Viewing Panel
At which point the log shows as follows ->
PageChanged : old index 0 new index 4
Error occurred on line: 486 (AS_CardSlider)
java.lang.IndexOutOfBoundsException: Index 5 out of bounds for length 2
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
...
...
...

{I have tried forcing OldIndex to be NewIndex - 1 -> but that doesn't work }

At this stage the project has called PageChanged on its return (doesn't need to go to Page_Appear its already loaded)
But as one can see the values of OldIndex and Newindex are not consecutive. In this case (my example run)
one expects that they should be 3 and 4 respectively.

The main point being that when one returns to the Viewing Page/Panel one wants to be able to carry on scrolling around
the database so that another card to review/manage can be selected.

As in the previous question I posted, the issue is about moving between the two Page/Panels and preserving the state of
of the cardSlider and its indexing.

If anyone finds a solution I'd be grateful since this would allow me to set the project up so that users have less
menu clicks (I could eliminate at least two menu buttons and so on etc..)

Thanks for your attention guys......
 

Attachments

  • testCards.zip
    79.7 KB · Views: 110

rabbitBUSH

Well-Known Member
Licensed User
Thanks Alexander - I tried just using a hidden panel on the Viewing page and pop it when wanting to Manage. Which works (of course). But, when one goes back to the menu and hit View again it crashes in the same way. (Confess, it just occurred to me now that perhaps Page_Disappear might need to close the View page etc.. Hmmm.) Anyway, so, the issue does seem to lie in how your library interacts with B4X Pages when an already loaded page is called back into view. At that time the library, I think, assumes that the card has changed (goes straight into PageChanged Sub).

I guess that you developed the library before Erel presented B4XPages and couldn't have catered for that.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I guess that you developed the library before Erel presented B4XPages
I only started developing the view last year. I've been using B4XPages since it came out in 2020. However, I have not yet dealt with your crash.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Actually, closing the View page wouldn't work since it's a continuous process (moving between two or more pages description in original post) without returning to the menu each time.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I just saw the implementation of the CardSlider in the app and the question came to my mind, why don't you just use the AS_ViewPager? So if this is the finished implementation as I see it in the example app, the ViewPager would be more suitable.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
why don't you just use the AS_ViewPager?
Um - good question. I did see ViewPager : i don't recall any particular thoughts about it at the time. I suppose the CardSlider appeared a good option for the way the user selects an item from the database. So that was driven by the need I had to "slip" around the database.

Are you suggesting to use ViewPager instead of CardSlider or in combination with it? In other words to use the ViewPager to move between the :pages" and still use CardSlider as the mechanism to select the required item.

So if this is the finished implementation as I see it in the example app, the ViewPager would be more suitable.
As far as I can anticipate, now, I think so essentially. I made the example by taking the working implementation apart - but - as the example is, is the result of what I was doing to make less clicking for users and to simplify what I had originally thought was the structure of the Main Menu. (that looks a bit awkward as a sentence :) Oi.)

I will check up on ViewPager though how I continue might depend on your clarification to the above question about combination or not.

Thanks very much for your thoughts and considerations, I know you normally have a lot stuff going on - so much appreciated.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
As you can see in the pictures, the card slider is designed to display 1 full item and 2 half items. The slide mechanics here is very simple and rather made for sliding to the left or right to see the next full item. The ViewPager, on the other hand, has a very sophisticated slide mechanism and is already used in many apps and custom views.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
I just downloaded ASViewPager seeking the updated 2.07 : its in Additional Libraries but the Library manager reports it as 2.05 when I restart the IDE.

Library manager took me here when I clicked the 2.07 link. Assumed that this is the updated version in #1?

SORRY this does seem a bit off topic - apologies.

HERE

Did I get something wrong? I get an error when I run the B4X Example from that thread link :
B4A Version: 12.80
Parsing code. Error
Error parsing program.
Error description: Undeclared variable 'm_ignore' is used before it was assigned any value.
Error occurred on line: 983 (ASViewPager)
If xclv_main.FindIndexFromOffset(Offset) <> m_CurrentIndex And Offset = IIf(m_Orientation = "Vertical",mBase.Height,mBase.Width) * xclv_main.FindIndexFromOffset(Offset) And m_Ignore = False Then
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
reports it as 2.05
The B4XLib has the right version and the right bas file. The fault must lie with you.
I assume that you still have an old version of AS_ViewPager in the B4A folder. Or something went wrong during copying.
 
Upvote 0
Top