Activity animation, simulation swipe left/right between activities

bluedude

Well-Known Member
Licensed User
Longtime User
Hi,

Because of the problems I have with sliding content in one activity (touch events) I want to simulate swiping between activities.

Attached is a sample project that has some issues with the left-right animation in the first activity.

When in the first activity I want to slide in the second activity from the right (so right to left) and when pressing back in the second one it should go left to right again.

Sliding right to left in the second activity works but I cannot get to work the left to right in the first activity.

Any help is appreciated.
 

Attachments

  • actanimation.zip
    11.4 KB · Views: 679

stevel05

Expert
Licensed User
Longtime User
I haven't looked at animation but it seems to work (and be logical from the little I have just read) with the in and out set the same direction, so in Main:

B4X:
SetAnimation("right_left","right_left")

and in actText:

B4X:
SetAnimation("left_right","left_right")

Edit, Or was the problem that only one activity moves?
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You really need 4 transform files for it to be smooth, two for each activity, try the attached.
 

Attachments

  • anim.zip
    13.1 KB · Views: 735
Last edited:
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Could also try AHViewPager with PagingEnabled=False, and then use custom events to force a page change. Just be sure smooth is set to true.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
AHViewPager is great but has some issues with some other libraries.

It does not work with the ArcMenu for example and I noticed a few other things. Sliding activities could be a better solution in the end, also because of code separation etc.

Sure it also has some disadvantages because you lose the Tabs etc. and you have to implement these in every activity.

Cheers,
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
It does not work with the ArcMenu for example and I noticed a few other things. Sliding activities could be a better solution in the end, also because of code separation etc.

Sure it also has some disadvantages because you lose the Tabs etc. and you have to implement these in every activity.

Cheers,

Ah, yes, might have issues with bars.

Whatever gets the job done and looks pretty. Good luck!
 
Upvote 0

JakeBullet70

Well-Known Member
Licensed User
Longtime User
If anyone is trying to get this to work in your own programs and it is failing... do not forget to add the 'anim' folder from the source project to your destination project. :)

"THIS TEST APP\Objects\res\anim" ** copy this **
"YOUR NEW APP\Objects\res\anim" ** to this **
 
Upvote 0
Top