code: @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      private boolean addTransitionListener(final ImageView imageView, final Item item) {
          final Transition transition = getWindow().getSharedElementEnterTransition();
  
          if (transition != null) {
              // There is an entering shared element transition so add a listener to it
              transition.addListener(new Transition.TransitionListener() {
                  @Override
                  public void onTransitionEnd(Transition transition) {
                      // As the transition has ended, we can now load the full-size image
                      loadFullSizeImage(imageView, item);
  
                      // Make sure we remove ourselves as a listener
                      transition.removeListener(this);
                  }
  
                  @Override
                  public void onTransitionStart(Transition transition) {
                      // No-op
                  }
  
                  @Override
                  public void onTransitionCancel(Transition transition) {
                      // Make sure we remove ourselves as a listener
                      transition.removeListener(this);
                  }
  
                  @Override
                  public void onTransitionPause(Transition transition) {
                      // No-op
                  }
  
                  @Override
                  public void onTransitionResume(Transition transition) {
                      // No-op
                  }
              });
              return true;
          }
  
          // If we reach here then we have not added a listener
          return false;
      }
docs: Try and add a {@link Transition.TransitionListener} to the entering shared element
  {@link Transition}. We do this so that we can load the full-size image after the transition
  has completed.
  
  @param imageView
  @param item
  @return true if we were successful in adding a listener to the enter transition