caipivara
3/3/2016 - 9:26 PM

Android - fix first time shared transition animation dont work using picasso (thanks to http://www.androiddesignpatterns.com/2015/03/activit

Android - fix first time shared transition animation dont work using picasso (thanks to http://www.androiddesignpatterns.com/2015/03/activity-postponed-shared-element-transitions-part3b.html)

class MyActivity {

  fun onCreate(){
    supportPostponeEnterTransition()
  }
  
  fun setImage(imageUrl: String) {
    Picasso.with(applicationContext)
            .load(imageUrl)
            .fit()
            .noFade()
            .noPlaceholder()
            .into(imageView, object : Callback {
                override fun onSuccess() = supportStartPostponedEnterTransition()
                override fun onError() = supportStartPostponedEnterTransition()
            })
  }
}