List of usage examples for android.app SharedElementCallback SharedElementCallback
SharedElementCallback
From source file:com.fastbootmobile.encore.app.PlaylistActivity.java
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.activity_playlist); FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (PlaylistViewFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstance == null) { mInitialIntent = getIntent().getExtras(); } else {//from ww w . j a va 2 s. c om mInitialIntent = savedInstance.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new PlaylistViewFragment(); fm.beginTransaction().add(R.id.playlist_container, mActiveFragment, TAG_FRAGMENT).commit(); mActiveFragment.setArguments(mInitialIntent); } // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View imageHeader = mActiveFragment.getHeroImageView(); if (imageHeader != null) { sharedElements.put("itemImage", imageHeader); } View albumName = mActiveFragment.findViewById(R.id.tvAlbumName); if (albumName != null) { final int cx = albumName.getMeasuredWidth() / 4; final int cy = albumName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(albumName, cx, cy); if (albumName.isAttachedToWindow()) { if (mIsEntering) { albumName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(albumName, cx, cy, 0, radius, duration, 300); } else { albumName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(albumName, cx, cy, radius, 0, duration, 0); } } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }
From source file:com.fastbootmobile.encore.app.ArtistActivity.java
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist); mHandler = new Handler(); FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (ArtistFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstanceState == null) { mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = getIntent().getExtras(); } else {/*from ww w . jav a 2 s . c om*/ mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = savedInstanceState.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new ArtistFragment(); fm.beginTransaction().add(R.id.container, mActiveFragment, TAG_FRAGMENT).commit(); } mActiveFragment.setArguments(mHero, mInitialIntent); // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View fab = mActiveFragment.findViewById(R.id.fabPlay); fab.setVisibility(View.VISIBLE); // get the center for the clipping circle int cx = fab.getMeasuredWidth() / 2; int cy = fab.getMeasuredHeight() / 2; // get the final radius for the clipping circle final int finalRadius = fab.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim; if (mIsEntering) { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, 0, finalRadius); } else { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, finalRadius, 0); } anim.setInterpolator(new DecelerateInterpolator()); anim.start(); fab.setTranslationX(-fab.getMeasuredWidth() / 4.0f); fab.setTranslationY(-fab.getMeasuredHeight() / 4.0f); fab.animate().translationX(0.0f).translationY(0.0f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setInterpolator(new DecelerateInterpolator()).start(); final View artistName = mActiveFragment.findViewById(R.id.tvArtist); if (artistName != null) { cx = artistName.getMeasuredWidth() / 4; cy = artistName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(artistName, cx, cy); if (mIsEntering) { artistName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(artistName, cx, cy, 0, radius, duration, 300); } else { artistName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(artistName, cx, cy, radius, 0, duration, 0); } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }
From source file:com.fastbootmobile.encore.app.AlbumActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/* ww w . j a v a 2 s . co m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist); mHandler = new Handler(); // Load or restore the fragment FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (AlbumViewFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstanceState == null) { mHero = Utils.dequeueBitmap(BITMAP_ALBUM_HERO); mInitialIntent = getIntent().getExtras(); } else { mHero = Utils.dequeueBitmap(BITMAP_ALBUM_HERO); mInitialIntent = savedInstanceState.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new AlbumViewFragment(); fm.beginTransaction().add(R.id.container, mActiveFragment, TAG_FRAGMENT).commit(); } mActiveFragment.setArguments(mHero, mInitialIntent); // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View imageHeader = mActiveFragment.getHeroImageView(); if (imageHeader != null) { sharedElements.put("itemImage", imageHeader); } View albumName = mActiveFragment.findViewById(R.id.tvAlbumName); if (albumName != null) { final int cx = albumName.getMeasuredWidth() / 4; final int cy = albumName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(albumName, cx, cy); try { if (mIsEntering) { albumName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(albumName, cx, cy, 0, radius, duration, 300); } else { albumName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(albumName, cx, cy, radius, 0, duration, 0); } } catch (IllegalStateException ignore) { // Animation was cancelled before animation mapping } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }
From source file:com.oceansky.yellow.app.ArtistActivity.java
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist); mHandler = new Handler(); FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (ArtistFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstanceState == null) { mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = getIntent().getExtras(); } else {/* w w w .j a v a 2 s. c o m*/ mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = savedInstanceState.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new ArtistFragment(); fm.beginTransaction().add(R.id.container, mActiveFragment, TAG_FRAGMENT).commit(); } try { mActiveFragment.setArguments(mHero, mInitialIntent); } catch (IllegalStateException e) { Log.e(TAG, "Invalid artist!", e); } // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View fab = mActiveFragment.findViewById(R.id.fabPlay); fab.setVisibility(View.VISIBLE); // get the center for the clipping circle int cx = fab.getMeasuredWidth() / 2; int cy = fab.getMeasuredHeight() / 2; // get the final radius for the clipping circle final int finalRadius = fab.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim; if (mIsEntering) { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, 0, finalRadius); } else { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, finalRadius, 0); } anim.setInterpolator(new DecelerateInterpolator()); anim.start(); fab.setTranslationX(-fab.getMeasuredWidth() / 4.0f); fab.setTranslationY(-fab.getMeasuredHeight() / 4.0f); fab.animate().translationX(0.0f).translationY(0.0f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setInterpolator(new DecelerateInterpolator()).start(); final View artistName = mActiveFragment.findViewById(R.id.tvArtist); if (artistName != null) { cx = artistName.getMeasuredWidth() / 4; cy = artistName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(artistName, cx, cy); if (mIsEntering) { artistName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(artistName, cx, cy, 0, radius, duration, 300); } else { artistName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(artistName, cx, cy, radius, 0, duration, 0); } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }
From source file:com.afollestad.polar.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); final boolean useNavDrawer = Config.get().navDrawerModeEnabled(); if (useNavDrawer) setContentView(R.layout.activity_main_drawer); else// ww w. j a v a 2 s .c o m setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(mToolbar); setupPages(); setupPager(); if (useNavDrawer) setupNavDrawer(); else setupTabs(); // Restore last selected page, tab/nav-drawer-item if (Config.get().persistSelectedPage()) { int lastPage = PreferenceManager.getDefaultSharedPreferences(MainActivity.this) .getInt("last_selected_page", 0); if (lastPage > mPager.getAdapter().getCount() - 1) lastPage = 0; mPager.setCurrentItem(lastPage); if (mNavView != null) invalidateNavViewSelection(lastPage); } dispatchFragmentUpdateTitle(!useNavDrawer); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setExitSharedElementCallback(new SharedElementCallback() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { if (isReentering) { WallpapersFragment frag = (WallpapersFragment) getFragmentManager() .findFragmentByTag("page:" + mPager.getCurrentItem()); final RecyclerView recyclerView = frag.getRecyclerView(); View item = recyclerView.findViewWithTag("view_" + reenterPos); View image = item.findViewById(R.id.image); names.clear(); names.add(image.getTransitionName()); sharedElements.clear(); sharedElements.put(image.getTransitionName(), image); isReentering = false; } } }); } processIntent(getIntent()); }
From source file:io.plaidapp.ui.DesignerNewsStory.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_designer_news_story); ButterKnife.bind(this); story = getIntent().getParcelableExtra(EXTRA_STORY); fab.setOnClickListener(fabClick);// ww w. j a v a 2 s .co m chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this); markdown = new Bypass(this, new Bypass.Options() .setBlockQuoteLineColor(ContextCompat.getColor(this, R.color.designer_news_quote_line)) .setBlockQuoteLineWidth(2) // dps .setBlockQuoteLineIndent(8) // dps .setPreImageLinebreakHeight(4) //dps .setBlockQuoteIndentSize(TypedValue.COMPLEX_UNIT_DIP, 2f) .setBlockQuoteTextColor(ContextCompat.getColor(this, R.color.designer_news_quote))); circleTransform = new CircleTransform(this); designerNewsPrefs = DesignerNewsPrefs.get(this); layoutManager = new LinearLayoutManager(this); commentsList.setLayoutManager(layoutManager); commentsList.setItemAnimator( new CommentAnimator(getResources().getInteger(R.integer.comment_expand_collapse_duration))); header = getLayoutInflater().inflate(R.layout.designer_news_story_description, commentsList, false); bindDescription(); // setup title/toolbar if (collapsingToolbar != null) { // narrow device: collapsing toolbar collapsingToolbar.addOnLayoutChangeListener(titlebarLayout); collapsingToolbar.setTitle(story.title); final Toolbar toolbar = (Toolbar) findViewById(R.id.story_toolbar); toolbar.setNavigationOnClickListener(backClick); commentsList.addOnScrollListener(headerScrollListener); setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { ReflowText.setupReflow(getIntent(), collapsingToolbar); } @Override public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { ReflowText.setupReflow(collapsingToolbar); } }); } else { // w600dp configuration: content card scrolls over title bar final TextView title = (TextView) findViewById(R.id.story_title); title.setText(story.title); findViewById(R.id.back).setOnClickListener(backClick); } final View enterCommentView = setupCommentField(); if (story.comment_count > 0) { // flatten the comments from a nested structure {@see Comment#comments} to a // list appropriate for our adapter (using the depth attribute). List<Comment> flattened = new ArrayList<>(story.comment_count); unnestComments(story.comments, flattened); commentsAdapter = new DesignerNewsCommentsAdapter(header, flattened, enterCommentView); commentsList.setAdapter(commentsAdapter); } else { commentsAdapter = new DesignerNewsCommentsAdapter(header, new ArrayList<Comment>(0), enterCommentView); commentsList.setAdapter(commentsAdapter); } customTab = new CustomTabActivityHelper(); customTab.setConnectionCallback(customTabConnect); }
From source file:io.plaidapp.designernews.ui.story.StoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_designer_news_story); DesignerNewsViewModelFactory factory = InjectionKt.provideViewModelFactory(this); viewModel = ViewModelProviders.of(this, factory).get(StoryViewModel.class); commentsUseCase = Injection.provideCommentsUseCase(this); bindResources();//from w w w. ja va 2s . c om story = getIntent().getParcelableExtra(Activities.DesignerNews.Story.EXTRA_STORY); commentsUseCase.getComments(story.getLinks().getComments(), result -> { if (result instanceof Result.Success) { Result.Success<List<Comment>> success = (Result.Success<List<Comment>>) result; List<Comment> data = success.getData(); setupComments(data); } return Unit.INSTANCE; }); fab.setOnClickListener(fabClick); chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this); markdown = new Bypass(getResources().getDisplayMetrics(), new Bypass.Options() .setBlockQuoteLineColor(ContextCompat.getColor(this, io.plaidapp.R.color.designer_news_quote_line)) .setBlockQuoteLineWidth(2) // dps .setBlockQuoteLineIndent(8) // dps .setPreImageLinebreakHeight(4) //dps .setBlockQuoteIndentSize(TypedValue.COMPLEX_UNIT_DIP, 2f) .setBlockQuoteTextColor(ContextCompat.getColor(this, io.plaidapp.R.color.designer_news_quote))); designerNewsPrefs = DesignerNewsPrefs.get(this); layoutManager = new LinearLayoutManager(this); commentsList.setLayoutManager(layoutManager); commentsList.setItemAnimator(new CommentAnimator( getResources().getInteger(io.plaidapp.R.integer.comment_expand_collapse_duration))); header = getLayoutInflater().inflate(R.layout.designer_news_story_description, commentsList, false); bindDescription(); // setup title/toolbar if (collapsingToolbar != null) { // narrow device: collapsing toolbar collapsingToolbar.addOnLayoutChangeListener(titlebarLayout); collapsingToolbar.setTitle(story.getTitle()); final Toolbar toolbar = findViewById(R.id.story_toolbar); toolbar.setNavigationOnClickListener(backClick); commentsList.addOnScrollListener(headerScrollListener); setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { ReflowText.setupReflow(getIntent(), collapsingToolbar); } @Override public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { ReflowText.setupReflow(collapsingToolbar); } }); } else { // w600dp configuration: content card scrolls over title bar final TextView title = findViewById(R.id.story_title); title.setText(story.getTitle()); findViewById(R.id.back).setOnClickListener(backClick); } enterCommentView = setupCommentField(); commentsAdapter = new DesignerNewsCommentsAdapter(header, new ArrayList<>(0), enterCommentView); commentsList.setAdapter(commentsAdapter); customTab = new CustomTabActivityHelper(); customTab.setConnectionCallback(customTabConnect); }
From source file:io.plaidapp.ui.FeedAdapter.java
@NonNull private DesignerNewsStoryHolder createDesignerNewsStoryHolder(ViewGroup parent) { final DesignerNewsStoryHolder holder = new DesignerNewsStoryHolder( layoutInflater.inflate(R.layout.designer_news_story_item, parent, false), pocketIsInstalled); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override// w w w . j av a 2 s.c o m public void onClick(View v) { final Story story = (Story) getItem(holder.getAdapterPosition()); CustomTabActivityHelper.openCustomTab(host, DesignerNewsStory.getCustomTabIntent(host, story, null).build(), Uri.parse(story.url)); } }); holder.comments.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View commentsView) { final Intent intent = new Intent(); intent.setClass(host, DesignerNewsStory.class); intent.putExtra(DesignerNewsStory.EXTRA_STORY, (Story) getItem(holder.getAdapterPosition())); ReflowText.addExtras(intent, new ReflowText.ReflowableTextView(holder.title)); setGridItemContentTransitions(holder.itemView); // on return, fade the pocket & comments buttons in host.setExitSharedElementCallback(new SharedElementCallback() { @Override public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { host.setExitSharedElementCallback(null); notifyItemChanged(holder.getAdapterPosition(), HomeGridItemAnimator.STORY_COMMENTS_RETURN); } }); final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, Pair.create((View) holder.title, host.getString(R.string.transition_story_title)), Pair.create(holder.itemView, host.getString(R.string.transition_story_title_background)), Pair.create(holder.itemView, host.getString(R.string.transition_story_background))); host.startActivity(intent, options.toBundle()); } }); if (pocketIsInstalled) { holder.pocket.setImageAlpha(178); // grumble... no xml setter, grumble... holder.pocket.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { PocketUtils.addToPocket(host, ((Story) getItem(holder.getAdapterPosition())).url); // notify changed with a payload asking RV to run the anim notifyItemChanged(holder.getAdapterPosition(), HomeGridItemAnimator.ADD_TO_POCKET); } }); } return holder; }
From source file:io.plaidapp.core.ui.FeedAdapter.java
private void openDesignerNewsStory(StoryViewHolder.TransitionData data) { final Intent intent = ActivityHelper.intentTo(Activities.DesignerNews.Story.INSTANCE); intent.putExtra(Activities.DesignerNews.Story.EXTRA_STORY, data.getStory()); ReflowText.addExtras(intent, new ReflowText.ReflowableTextView(data.getTitle())); setGridItemContentTransitions(data.getItemView()); // on return, fade the pocket & comments buttons in host.setExitSharedElementCallback(new SharedElementCallback() { @Override// w w w .j a v a2 s.c o m public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) { host.setExitSharedElementCallback(null); notifyItemChanged(data.getPosition(), HomeGridItemAnimator.STORY_COMMENTS_RETURN); } }); final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, data.getSharedElements()); host.startActivity(intent, options.toBundle()); }
From source file:io.plaidapp.core.ui.FeedAdapter.java
public static SharedElementCallback createSharedElementReenterCallback(@NonNull Context context) { final String shotTransitionName = context.getString(R.string.transition_shot); final String shotBackgroundTransitionName = context.getString(R.string.transition_shot_background); return new SharedElementCallback() { /**/*from w w w .ja v a 2s. c o m*/ * We're performing a slightly unusual shared element transition i.e. from one view * (image in the grid) to two views (the image & also the background of the details * view, to produce the expand effect). After changing orientation, the transition * system seems unable to map both shared elements (only seems to map the shot, not * the background) so in this situation we manually map the background to the * same view. */ @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { if (sharedElements.size() != names.size()) { // couldn't map all shared elements final View sharedShot = sharedElements.get(shotTransitionName); if (sharedShot != null) { // has shot so add shot background, mapped to same view sharedElements.put(shotBackgroundTransitionName, sharedShot); } } } }; }