@Override public void onClick(View v) { ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( SharedElementActivity.this, draweeView, SHARED_ELEMENT_NAME); // FIX BUG https://github.com/facebook/fresco/issues/1445 ActivityCompat.setExitSharedElementCallback(SharedElementActivity.this, new androidx.core.app.SharedElementCallback() { @Override public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots); for (final View view : sharedElements) { if (view instanceof SimpleDraweeView) { view.setVisibility(View.VISIBLE); } } } }); ActivityCompat.startActivity(SharedElementActivity.this, new Intent(SharedElementActivity.this, SharedElementLaunchedActivity.class), optionsCompat.toBundle()); } });
private void onClickImage(ItemViewHolder holder, Gallery gallery, Image image) { Intent intent = new Intent(this, GalleryActivity.class) .putExtra(Intents.EXTRA_GALLERY, Parcels.wrap(gallery)) .putExtra(Intents.EXTRA_IMAGE, Parcels.wrap(image)); Bundle options = null; if (Const.HAS_L) { Drawable drawable = holder.photo.getDrawable(); if (drawable != null) { Holder.set(drawable); options = ActivityOptions.makeSceneTransitionAnimation(this, holder.photo, getString(R.string.gallery_photo_hero)).toBundle(); } } ActivityCompat.startActivity(this, intent, options); }
@Override public void itemClicked(View view, MediaInfo item, int position) { if (view instanceof ImageButton) { Utils.showQueuePopup(getActivity(), view, item); } else { String transitionName = getString(R.string.transition_image); VideoListAdapter.ViewHolder viewHolder = (VideoListAdapter.ViewHolder) mRecyclerView.findViewHolderForPosition(position); Pair<View, String> imagePair = Pair .create((View) viewHolder.getImageView(), transitionName); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(getActivity(), imagePair); Intent intent = new Intent(getActivity(), LocalPlayerActivity.class); intent.putExtra("media", item); intent.putExtra("shouldStart", false); ActivityCompat.startActivity(getActivity(), intent, options.toBundle()); } }