android - Shared Element Transition not working on first load with Picasso -


i trying load image url imageview using picasso.

the image shared transition inside cardview in recyclerview , second in linearlayout. first time request made element doesn't animate picasso needs load image view, on subsequent requests fine.

how can ensure imageview has been populated before initiating transition?

the solution in using postponeentertransition() , startpostponedentertransition() calls ensure picasso has finished loading image view before activity starts.

this great blog entry this.

below example of might use in oncreate

activitycompat.postponeentertransition(this); picasso.with(this.getapplicationcontext())     .load("https://goo.gl/oiytor")     .nofade()     .fit()     .centerinside()     .error(r.drawable.user_placeholder_error)     .into(((imageview) findviewbyid(r.id.game_view_image)), new callback() {         @override         public void onsuccess() {             activitycompat.startpostponedentertransition(targetactivity);         }          @override         public void onerror() {             activitycompat.startpostponedentertransition(targetactivity);         }     }); 

Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -