B4A Library [Class] Multi Type SlidingPanels

Dominex

Active Member
Licensed User
[Class/Library] Multi Type SlidingPanels

I wanted to make one SlidingPanels that it could be used in multiple ways. Now that I have finished writing the code I put at your disposal.

At the moment you can do these variants SlidingPanels:

- Classic full screen mode.
- Sliding panels with smaller screen.
- Sliding panels with smaller screen and with zoom!
- With or without friction.

Methods:
- Click.
- Change.

Methods:
- JumpToPanel () - Runs the SlidingPanels up to a specific Panel.
- GetCurrentPanel - Returns the number of the current Panel.
- GetSlidingInProgress - Return if the SlidingPaneles is in progress.
- SetSpeedScroll () - Sets the speed of sliding.

It is possible to easily create a page counter thanks to the events.

[UPDATE V1.10]
- Added the ability to use the touch events of Activity, which is useful when you must insert many objects on the panels. Recommended this mode.
- Added the field area to be used for zooming.

[UPDATE V1.10a]
- Minor bug fix for small display.

[UPDATE V1.20]
- Added the LongClick event.
- Changed the type of data sent with the Click events and LongClick.
- Minor improvements.

[UPDATE V1.21]
- Bugfix in FullScreen mode (loop setup).

IMPORTANT
For most fluidity add this code to the Manifest:
B4X:
SetActivityAttribute(Main, android:hardwareAccelerated, "true")
For suggestions and bug reports please do not hesitate to post it here.
 

Attachments

Last edited:

susu

Well-Known Member
Licensed User
It's very nice & easy to use! Thank you so much :D
 

NJDude

Expert
Licensed User
Nice, however, there's a lot of jerkiness when I use the Full screen or little panels mode, the little panels zoom mode doesn't work, I can't move the panels. I tried that on a Nexus 7 running Jelly Bean 4.2, on my ICS phone runs fine, runs fine on Froyo too.

On a Galaxy tab runs fine too, just a little jerkiness depending on how you place your fingers on the panels.

I also noticed that if you are moving the panels and then click on "Jump to panel 7" the animation doesn't occur and I see that "sliding in progress" toast. is that intended?

NOTE: I even enabled hardware accelereration on that Nexus and nothing improved.

One thing I have to say, those "zooming" panels are absolutely awesome!!!

Keep up the good work.
 
Last edited:

Dominex

Active Member
Licensed User
Nice, however, there's a lot of jerkiness when I use the Full screen or little panels mode, the little panels zoom mode doesn't work, I can't move the panels. I tried that on a Nexus 7 running Jelly Bean 4.2, on my ICS phone runs fine, runs fine on Froyo too.
You can increase the frequence current update lowering the interval of Timer1, this should give greater fluidity.

Of all of the few devices that I've tested worked. If you do not happen to me it could be difficult to pinpoint the problem.

The Match Demo work for you?

On a Galaxy tab runs fine too, just a little jerkiness depending on how you place your fingers on the panels.

I also noticed that if you are moving the panels and then click on "Jump to panel 7" the animation doesn't occur and I see that "sliding in progress" toast. is that intended?
It is expected, but I'm thinking of removing it.

NOTE: I even enabled hardware accelereration on that Nexus and nothing improved.

One thing I have to say, those "zooming" panels are absolutely awesome!!!

Keep up the good work.
Thanks, was the most difficult part, but it was worth it.

It must be said that the functions used are as basic as the Touch, for so it should work on all devices ... ... at least in theory. :)
 

Informatix

Expert
Licensed User
the little panels zoom mode doesn't work, I can't move the panels.
I tried with a (fast) emulator under JellyBean 4.1.1 and it's quite impossible to move the panels in zoom mode. So it's not related to the Nexus 7, but to the OS version, I think. I had to make a few changes in my own classes because of JellyBean, especially when it comes to animation or touch events (it does not like BringToFront after you touched a view).
EDIT: I confirm the BringToFront issue. If I remove it from CalculateZoom, the zoom mode works as expected (except the center panel is not on top of other views).
 
Last edited:

Dominex

Active Member
Licensed User
I tried with a (fast) emulator under JellyBean 4.1.1 and it's quite impossible to move the panels in zoom mode. So it's not related to the Nexus 7, but to the OS version, I think. I had to make a few changes in my own classes because of JellyBean, especially when it comes to animation or touch events (it does not like BringToFront after you touched a view).
Very interesting and useful this your observation. I'll see if with an emulator I presents the problem.

Thanks.
 

barx

Well-Known Member
Licensed User
Appears to work fine on my Desire Z / G2.

Nice work, will be very good if the above issues are resolved. Hard to fix something you cannot see though. So, if you don't have the problem device.... Good luck
 

moster67

Expert
Licensed User
Nice work. Grazie!

I can confirm that with Jelly Bean on my Samsung Galaxy S3, it is indeed very difficult in zoom-mode to move the panels. However on my Acer Iconia A500 tablet with ICS, it is very fluid.
 

NJDude

Expert
Licensed User
Ok, without that line it works fine on the N7, but like Informatix said, the middle panel is not on top.

There's some jerkiness depending on how you tap on the panels but at least I can move them.

A workaround for the N7 would be, define the panels as size 90:
B4X:
SD.ModeLittlePanelsZoom(15,50%x,50%x,50%y,5%x,True,90dip) 'Creates the mode of SlidingPanels.
positioning and sizing should be always done using DIP.
 
Last edited:

Dominex

Active Member
Licensed User
Ok, without that line it works fine on the N7, but like Informatix said, the middle panel is not on top.

There's some jerkiness depending on how you tap on the panels but at least I can move them.

A workaround for the N7 would be, define the panels as size 90:
B4X:
SD.ModeLittlePanelsZoom(15,50%x,50%x,50%y,5%x,True,90dip) 'Creates the mode of SlidingPanels.
positioning and sizing should be always done using DIP.
Ok, so we know where the problem is, I have to come up with a solution now.

The zoom value in this case is substantially a percentage, 150 = 150% of original size. You can also use the DIP, but it is has been designed for a proportion of percentage.

I wonder if the bug is due to the OS BringToFront or B4A. Maybe can answer Erel.

I have half a mind, would you please try one more? Replace Panels(c).BringToFront with Panels(c).SendToBack.
I just want to see if the same problems as before.
 
Last edited:

NJDude

Expert
Licensed User
I have half a mind, would you please try one more? Replace Panels(c).BringToFront with Panels(c).SendToBack.
I just want to see if the same problems as before.
If I replace that line I get the same problem as before.
 

Dominex

Active Member
Licensed User
Two solutions:

- replace BringToFront by:
B4X:
Dim r As Reflector
r.Target = Panels(c)
r.RunMethod("bringToFront")
That needs the Reflection library.

- ask Erel for fixing his BringToFront/SendToBack methods.
Ask if Erel can solve the problem if possible, not because I do not want to use a library, but because this problem will occur for future app.

For now, those who suffer can use your solution with the library Reflection.

Thanks very much.
 

Dominex

Active Member
Licensed User
[UPDATE V1.1]

- Added the ability to use the touch events of Activity, which is useful when you must insert many objects on the panels.
- Added the field area to be used for zooming.

Here.

@NJDude
I'd be curious to know if anything changes with the touch of Activity.
 

NJDude

Expert
Licensed User
@NJDude
I'd be curious to know if anything changes with the touch of Activity.
Ok, I tried the new version on the N7 tab, SlidePanelDominex still doesn't work, but, SlidingPanels (Activity Touch) works as intended, YAY!.

One thing I noticed on the (activity touch) sample, if I tap on Panel7 I get THIS error
 
Last edited:
Top