0

I have this application which consists of 1 activity and 1 fragment inside it. Let's name it Fragment A. So Fragment A consists of 3 buttons BtnA, BtnB, and BtnC. When I click on BtnA in Fragment A, Fragment B will replace this Fragment A. Inside Fragment B, I will have another 3 buttons BtnD, BtnE, BtnF. I'm thinking of making use of the Material Transition and having the following animations:

Transitions.gif
(source: googledrive.com)

I wanted it to be backward compatible with at least Android Api 14. So I have researched and I'm making use of Transitions-Everywhere. It doesn't appear that I can do Fragment-Fragment transition using this though. So I thought of using other methods instead. Here are some ways which I think would do the job:

  1. Make it activity-activity instead (this seems a little overkill as I'm actually reusing some stuffs in the activity)
  2. Make everything in 1 activity and use scenes to bring the buttons in:
    1. Have those 6 buttons in the activity.
    2. Have only 3 buttons in the activity and when click on BtnA, proceed to change BtnA, BtnB, BtnC to BtnD, BtnE, BtnF.

So how should the design be? Is there any particular consideration I need to take? I'm more in favor of the option 2.1 i.e. the 6 buttons in 1 activity but wasn't sure if this is the recommended approach. Any recommendations?

Thanks in advance!

aminography
  • 21,986
  • 13
  • 70
  • 74
skyplor
  • 251
  • 3
  • 8

1 Answers1

1

I am author of Transitions-Everywhere, so maybe i can help. Any real reasons to use different fragments in this case? Fragment transitions are not backported for now, i doesn't have to much free time for this.

You can perform transition this way:

TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new Slide(Gravity.BOTTOM));
transitionSet.addTransition(new ChangeBounds());
TransitionManager.beginDelayedTransition(buttonsContainer, transitionSet);
btnA.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
btnB.setVisibility(View.GONE)
btnC.setVisibility(View.GONE)