android - Lollipop shared element transition for mapView? -


i have mapview takes small portion of screen, when touched opens full screen view.

i accomplish switching between 2 fragments.

i'd love use new lollipop animation framework expand small mapview seamlessly larger mapview (from fragment1 fragment2).

unfortunately, haven't been able work -- , wondering if has been able mapview work new animation framework.

my code:

@suppresslint("newapi") public void launchmapfullscreenfragment(fragment previousfragment, mapview mapview) {     // launch fragment view google maps     fragmentmapfullscreen fragment = new fragmentmapfullscreen();      if (build.version.sdk_int >= build.version_codes.lollipop) {         previousfragment.setsharedelementreturntransition(transitioninflater.from(this).inflatetransition(r.transition.change_image_transform));         previousfragment.setexittransition(transitioninflater.from(this).inflatetransition(android.r.transition.explode));          // create new fragment add (fragment b)         fragment.setsharedelemententertransition(transitioninflater.from(this).inflatetransition(r.transition.change_image_transform));         fragment.setentertransition(transitioninflater.from(this).inflatetransition(android.r.transition.explode));          // add fragment b         fragmenttransaction ft = getsupportfragmentmanager().begintransaction()                 .replace(r.id.content_frame, fragment)                 .addtobackstack("transaction")                 .addsharedelement(mapview, "mytransition");         ft.commit();     }     else     {         fragmentmanager fm = getsupportfragmentmanager();         fragmenttransaction ft = fm.begintransaction();         ft.setcustomanimations(r.anim.slide_in_left, r.anim.abc_fade_out);         ft.replace(r.id.content_frame, fragment, fragment_map_fullscreen);         ft.addtobackstack(null);         ft.commit();     } } 

change_image_transform.xml

<?xml version="1.0" encoding="utf-8"?> <transitionset xmlns:android="http://schemas.android.com/apk/res/android">     <changetransform /> </transitionset> 

i haven't explicitly worked mapview, docs show framelayout, should work. haven't shown 2 layout files. changetransform animate scale, translation, , rotation in target fragment values in source fragment. if don't have scalex or scaley set in source or target fragment's mapviews, changetransform won't special.

if mapviews changing size (not scale), should add changebounds transition along changetransform.

another problem may parameter pass addsharedelement. name "mytransition" should match transitionname of mapview in target fragment (fragmentmapfullscreen). mapview should this:

<mapview android:transitionname="mytransition" ... /> 

if suspect mapview culprit (and may be, depending on implementation), can try textview see if transitions expect.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -