0

Is it possible to create an activity slide in and slide out transition without animating the whole activity? Similar to fragment transition but with activities.

I know this could easily be done with fragments but I would like to avoid handling multiple fragments in a single activity to avoid creating a God Activity.

What are your thoughts on this?

halfer
  • 19,824
  • 17
  • 99
  • 186
Archie G. Quiñones
  • 11,638
  • 18
  • 65
  • 107
  • 1
    God activity has nothing to do with managing multiple fragments. "God" anything is a result of bad software design – Tim Mar 22 '18 at 14:39
  • Hi @Tim, I have this experience where the activity gets really messy as it implements all interfaces that the fragment requires. When my activity handles say for example 10 fragments where each of that fragment has an interface requirement, the activity becomes really bloated. Can you guide me what Im doing wrong? – Archie G. Quiñones Mar 22 '18 at 14:43
  • why is that wrong? – Tim Mar 22 '18 at 15:07
  • Well coz at some point it becomes hard to maintain? Am I wrong? – Archie G. Quiñones Mar 22 '18 at 15:08
  • I don't know, are you? Do you find an activity with 10 fragment callbacks hard to maintain? – Tim Mar 22 '18 at 15:13
  • This happened when i tried to maintain an app with a bottom navigation. The requirement was to keep the bottom navigation across all screens. I got way more than 20 fragments. The activity became bloated real quickly. I just though maybe I could have smaller activities instead of having only one handling everything. – Archie G. Quiñones Mar 22 '18 at 15:27
  • [this?] (https://stackoverflow.com/questions/10243557/how-to-apply-slide-animation-between-two-activities-in-android?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) Maybe you can also try creating child fragments. For example i have 4 fragment in an activity. And in one of them it has 4 more child fragments. – ruben Mar 22 '18 at 16:41
  • 1
    Hi @ruben, the link you provided animates the activity as a whole not just part of it. As for child fragments I think that would be a good idea to implement. I never really though of using child fragments until you mentioned it. Maybe you could put that in as an answer so I could marked it as accepted. – Archie G. Quiñones Mar 23 '18 at 01:14

1 Answers1

0

As we have discussed in the comments, using Child Fragments could be an idea to solve the issue.

ruben
  • 1,745
  • 5
  • 25
  • 47