0

Making a project I am faced with the following problem.

I have to perform some animations on views that belong to Activity A while at the same time perform animations that belong to Activity B.

Minimum SDK is 16 so I cannot use the Shared Elements approach.

The best approach I can think of is to start Activity B WITHOUT ANIMATION and create a mechanism that passes from Activity A to activity B instructions to create the necessary views dynamically, add them to the parent layout and perform the desired animations on all views.

Could someone share some insight about how to do something like that? My first thought was to pass a list of the InstanceState bundles for each view. something like

for(ViewReplicationData data:viewReplicationData){
    if(data.getViewClassName().equals("TextView"){
        TextView tv = new TextView(this);
        rootLayout.addView(tv);
        tv.onRestoreInstanceState(data.getInstanceState());
    }
}

Since everyone is providing solutions that work only for ImageViews let me be clear...I m talking about animating whole layouts that have TextViews, Buttons, ImageViews, ToggleButtons, CheckBoxes..everything.

Anonymous
  • 4,470
  • 3
  • 36
  • 67
  • How will both your activities run at the same time? But in any case, you can send a broadcast between your activities to inform about the changes. – Rachit Feb 10 '17 at 12:21
  • try this: https://www.google.lk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjhuKe_xYXSAhXEOY8KHf-DDXAQtwIIGDAA&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCPxkoe2MraA&usg=AFQjCNE69GKlesndj5G6_t987yxf-SEzXA&sig2=Ga8dzG_WBm0i0E622aovSA&bvm=bv.146496531,d.c2I – Naveen Dissanayake Feb 10 '17 at 12:36
  • i have seen this video...but this is only for ImageViews which is a very simple case. My layout could contain any kind of views...Textview, Spinner, Button etc.. – Anonymous Feb 10 '17 at 12:40

1 Answers1

0

Hope this is what you are looking for

https://github.com/lgvalle/Material-Animations

Thanks.

Hamza
  • 674
  • 4
  • 13