Delay shared element transition to complete statelist animation

ⅰ亾dé卋堺 提交于 2019-12-02 04:35:17

I ended up using a work around, but I still would want to know what is the right way of doing this and therefore leaving the question open.

The work around I did was 1. remove the state list animator and add that as an animator in the onclick method. 2. Used a Handler to post a delayed call to the activity

new Handler().postDelayed(new Runnable() {
                      @Override
                      public void run() {

                          Intent i=new Intent(SearxhJobs.this,JobsTypes.class);
                          startActivity(i);
                      }
                  }, 200);

P.S- I did end up removing the effect as it was not very intuitive.

The way that may help some that already have the Transitions setup in Second Activity:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().getSharedElementEnterTransition().setDuration(500);
    getWindow().getSharedElementReturnTransition().setDuration(500)
        .setInterpolator(new DecelerateInterpolator());
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!