android - Explode transition affects shared element transition -
i have recyclerview displaying images in grid. when click 1 of these images add new fragment image shared element. use explode transition move other items in recyclerview off screen. when add fragment transitions run fine , image scales full screen. when pop stack animations dont run in reverse though would. shared elements scale , translates wrong position on screen. dont have problems if use transition such fade.
here grid fragment add detail fragment.
public class gridfragment extends fragment implements itemadapter.bobbleclicklistener { @bind(r.id.image_recycler_view) recyclerview mimagerecycler; public static gridfragment newinstance(int imagearrayresource, int titlesarrayresource) { gridfragment fragment = new gridfragment(); bundle args = new bundle(); args.putint("key_images", imagearrayresource); args.putint("key_titles", titlesarrayresource); fragment.setarguments(args); return fragment; } public gridfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view root = inflater.inflate(r.layout.fragment_grid, container, false); butterknife.bind(this, root); bundle args = getarguments(); int imagearrayresource = args.getint("key_images"); int titlesarrayresource = args.getint("key_titles"); itemadapter mainadapter = new itemadapter(getactivity(), this, imagearrayresource, titlesarrayresource); mimagerecycler.sethasfixedsize(true); mimagerecycler.setlayoutmanager(new gridlayoutmanager(getactivity(), 4)); mimagerecycler.setadapter(mainadapter); return root; } @override public void onbobbleclick(imageview imageview, int resource) { setexittransition(new explode()); detailfragment detailfragment = detailfragment.newinstance(resource, imageview.gettransitionname()); detailfragment.setsharedelemententertransition(transitioninflater.from(getactivity()).inflatetransition(r.anim.trans_move)); fragmenttransaction trans = getactivity().getsupportfragmentmanager().begintransaction(); trans.replace(r.id.content, detailfragment); trans.addsharedelement(imageview, imageview.gettransitionname()); trans.addtobackstack(null); trans.commit(); } }
here detail fragment
public class detailfragment extends fragment { @bind(r.id.detail_iv) imageview mimageview; public static detailfragment newinstance(int imageresource, string transitionname){ detailfragment fragment = new detailfragment(); bundle args = new bundle(); args.putint("resource_key", imageresource); args.putstring("resource_transition_name", transitionname); fragment.setarguments(args); return fragment; } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view root = inflater.inflate(r.layout.fragment_detail, container, false); butterknife.bind(this, root); mimageview.settransitionname(getarguments().getstring("resource_transition_name")); mimageview.setimageresource(getarguments().getint("resource_key")); return root; } }
here shared element transition set trans_move
<?xml version="1.0" encoding="utf-8"?> <transitionset xmlns:android="http://schemas.android.com/apk/res/android"> <changebounds/> <changetransform/> <changeclipbounds/> <changeimagetransform/> </transitionset>
this problem below
Comments
Post a Comment