Example usage for android.app ActivityOptions makeSceneTransitionAnimation

List of usage examples for android.app ActivityOptions makeSceneTransitionAnimation

Introduction

In this page you can find the example usage for android.app ActivityOptions makeSceneTransitionAnimation.

Prototype

public static ActivityOptions makeSceneTransitionAnimation(Activity activity, View sharedElement,
        String sharedElementName) 

Source Link

Document

Create an ActivityOptions to transition between Activities using cross-Activity scene animations.

Usage

From source file:net.mm2d.dmsexplorer.CdsListActivity.java

private void onCdsItemClick(final View v, final View accent, int position, CdsObject object) {
    if (object.isContainer()) {
        browse(position, object.getObjectId(), object.getTitle(), true);
        return;//from w  ww . j  av  a2 s  .c  o m
    }
    if (mTwoPane) {
        if (mSelectedObject != null && mSelectedObject.equals(object)) {
            return;
        }
        mCdsDetailFragment = CdsDetailFragment.newInstance(mServer.getUdn(), object);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mCdsDetailFragment.setEnterTransition(new Slide(Gravity.START));
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.cds_detail_container, mCdsDetailFragment)
                .commit();
    } else {
        final Intent intent = CdsDetailActivity.makeIntent(v.getContext(), mServer.getUdn(), object);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            startActivity(intent, ActivityOptions
                    .makeSceneTransitionAnimation(CdsListActivity.this, accent, "share").toBundle());
        } else {
            startActivity(intent);
        }
    }
    mSelectedObject = object;
    mCdsListAdapter.setSelection(position);
}

From source file:com.fbartnitzek.tasteemall.location.ShowReviewMapFragment.java

@Nullable
@Override//from ww w.  j  a va  2 s.  c  o  m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    Log.v(LOG_TAG, "onCreateView, hashCode=" + this.hashCode() + ", " + "inflater = [" + inflater
            + "], container = [" + container + "], savedInstanceState = [" + savedInstanceState + "]");
    super.onCreateView(inflater, container, savedInstanceState);

    // TODO: srollable below map... - done...?

    Bundle args = getArguments();
    if (args == null) {
        Log.w(LOG_TAG, "onCreateView without args...");
    } else {
        Log.v(LOG_TAG, "onCreateView with args: " + args);

        if (args.containsKey(REVIEW_URI)) {
            mBaseUri = args.getParcelable(REVIEW_URI);
            getLoaderManager().restartLoader(REVIEW_LOCATIONS_LOADER_ID, null, this);
        }
    }

    mReviewLocationAdapter = new ReviewLocationAdapter(getActivity(),
            new ReviewLocationAdapter.ReviewLocationAdapterClickHandler() {
                @Override
                public void onClick(String reviewLocationId, ReviewLocationAdapter.ViewHolder viewHolder,
                        LatLng latLng, String formatted, String description) {
                    addReviewLocationMarker(reviewLocationId, latLng, formatted, description);
                }
            });
    mHeadingLocations = (TextView) mRootView.findViewById(R.id.heading_map_locations);
    mHeadingLocations.setText(R.string.label_list_map_locations_preview);
    RecyclerView locationRecyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerview_map_locations);
    locationRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    locationRecyclerView.setAdapter(mReviewLocationAdapter);

    mHeadingReviewsOfLocation = (TextView) mRootView.findViewById(R.id.heading_map_sub_list);
    mHeadingReviewsOfLocation.setText(R.string.label_list_map_reviews_of_location_preview);
    mReviewOfLocationAdapter = new ReviewOfLocationAdapter(
            new ReviewOfLocationAdapter.ReviewAdapterClickHandler() {
                @Override
                public void onClick(Uri contentUri, ReviewOfLocationAdapter.ViewHolder vh) {
                    Bundle bundle = null;
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                        bundle = ActivityOptions.makeSceneTransitionAnimation(getActivity(),
                                new Pair<View, String>(vh.drinkNameView, vh.drinkNameView.getTransitionName()),
                                new Pair<View, String>(vh.producerNameView,
                                        vh.producerNameView.getTransitionName()))
                                .toBundle();
                    }

                    startActivity(new Intent(getActivity(), ShowReviewActivity.class).setData(contentUri),
                            bundle);
                }
            }, getActivity());
    RecyclerView reviewsRecyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerview_map_sub_list);
    reviewsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    reviewsRecyclerView.setAdapter(mReviewOfLocationAdapter);

    //        Log.v(LOG_TAG, "onCreateView before MapFragment, hashCode=" + this.hashCode() + ", " + "inflater = [" + inflater + "], container = [" + container + "], savedInstanceState = [" + savedInstanceState + "]");

    return mRootView;
}

From source file:com.example.admin.news.mvp.ui.activities.PhotoActivity.java

private void startActivity(View view, Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, view,
                Constants.TRANSITION_ANIMATION_NEWS_PHOTOS);
        startActivity(intent, options.toBundle());
    } else {// w ww  . j  ava2  s. com
        ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getWidth() / 2,
                view.getHeight() / 2, 0, 0);
        ActivityCompat.startActivity(mActivity, intent, options.toBundle());
    }
}

From source file:io.plaidapp.ui.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    ButterKnife.bind(this);

    drawer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

    //toolbar.inflateMenu(R.menu.main);
    setActionBar(toolbar);/*from w w w .  j a  v  a  2s . co m*/
    if (savedInstanceState == null) {
        animateToolbar();
    }

    dribbblePrefs = DribbblePrefs.get(this);
    designerNewsPrefs = DesignerNewsPrefs.get(this);
    filtersAdapter = new FilterAdapter(this, SourceManager.getSources(this),
            new FilterAdapter.FilterAuthoriser() {
                @Override
                public void requestDribbbleAuthorisation(View sharedElemeent, Source forSource) {
                    Intent login = new Intent(HomeActivity.this, DribbbleLogin.class);
                    login.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_COLOR,
                            ContextCompat.getColor(HomeActivity.this, R.color.background_dark));
                    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(HomeActivity.this,
                            sharedElemeent, getString(R.string.transition_dribbble_login));
                    startActivityForResult(login, getAuthSourceRequestCode(forSource), options.toBundle());
                }
            });
    dataManager = new DataManager(this, filtersAdapter) {
        @Override
        public void onDataLoaded(List<? extends PlaidItem> data) {
            adapter.addAndResort(data);
            checkEmptyState();
        }
    };
    adapter = new FeedAdapter(this, dataManager, columns, PocketUtils.isPocketInstalled(this));
    grid.setAdapter(adapter);
    layoutManager = new GridLayoutManager(this, columns);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return adapter.getItemColumnSpan(position);
        }
    });
    grid.setLayoutManager(layoutManager);
    grid.addOnScrollListener(gridScroll);
    grid.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) {
        @Override
        public void onLoadMore() {
            dataManager.loadAllDataSources();
        }
    });
    grid.setHasFixedSize(true);
    grid.addItemDecoration(new GridItemDividerDecoration(adapter.getDividedViewHolderClasses(), this,
            R.dimen.divider_height, R.color.divider));
    grid.setItemAnimator(new HomeGridItemAnimator());

    // drawer layout treats fitsSystemWindows specially so we have to handle insets ourselves
    drawer.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
            // inset the toolbar down by the status bar height
            ViewGroup.MarginLayoutParams lpToolbar = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
            lpToolbar.topMargin += insets.getSystemWindowInsetTop();
            lpToolbar.rightMargin += insets.getSystemWindowInsetRight();
            toolbar.setLayoutParams(lpToolbar);

            // inset the grid top by statusbar+toolbar & the bottom by the navbar (don't clip)
            grid.setPadding(grid.getPaddingLeft(),
                    insets.getSystemWindowInsetTop() + ViewUtils.getActionBarSize(HomeActivity.this),
                    grid.getPaddingRight() + insets.getSystemWindowInsetRight(), // landscape
                    grid.getPaddingBottom());

            // inset the fab for the navbar
            ViewGroup.MarginLayoutParams lpFab = (ViewGroup.MarginLayoutParams) fab.getLayoutParams();
            lpFab.bottomMargin += insets.getSystemWindowInsetBottom(); // portrait
            lpFab.rightMargin += insets.getSystemWindowInsetRight(); // landscape
            fab.setLayoutParams(lpFab);

            // we place a background behind the status bar to combine with it's semi-transparent
            // color to get the desired appearance.  Set it's height to the status bar height
            View statusBarBackground = findViewById(R.id.status_bar_background);
            FrameLayout.LayoutParams lpStatus = (FrameLayout.LayoutParams) statusBarBackground
                    .getLayoutParams();
            lpStatus.height = insets.getSystemWindowInsetTop();
            statusBarBackground.setLayoutParams(lpStatus);

            // inset the filters list for the status bar / navbar
            // need to set the padding end for landscape case
            final boolean ltr = filtersList.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
            filtersList.setPaddingRelative(filtersList.getPaddingStart(),
                    filtersList.getPaddingTop() + insets.getSystemWindowInsetTop(),
                    filtersList.getPaddingEnd() + (ltr ? insets.getSystemWindowInsetRight() : 0),
                    filtersList.getPaddingBottom() + insets.getSystemWindowInsetBottom());

            // clear this listener so insets aren't re-applied
            drawer.setOnApplyWindowInsetsListener(null);

            return insets.consumeSystemWindowInsets();
        }
    });
    setupTaskDescription();

    filtersList.setAdapter(filtersAdapter);
    filtersAdapter.addFilterChangedListener(filtersChangedListener);
    filtersAdapter.addFilterChangedListener(dataManager);
    dataManager.loadAllDataSources();
    ItemTouchHelper.Callback callback = new FilterTouchHelperCallback(filtersAdapter);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
    itemTouchHelper.attachToRecyclerView(filtersList);
    checkEmptyState();
    checkConnectivity();
}

From source file:io.plaidapp.ui.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    ButterKnife.bind(this);

    drawer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

    setActionBar(toolbar);//from  w  ww  .j a v a  2 s . c  om
    if (savedInstanceState == null) {
        animateToolbar();
    }
    setExitSharedElementCallback(FeedAdapter.createSharedElementReenterCallback(this));

    dribbblePrefs = DribbblePrefs.get(this);
    designerNewsPrefs = DesignerNewsPrefs.get(this);
    filtersAdapter = new FilterAdapter(this, SourceManager.getSources(this),
            new FilterAdapter.FilterAuthoriser() {
                @Override
                public void requestDribbbleAuthorisation(View sharedElement, Source forSource) {
                    Intent login = new Intent(HomeActivity.this, DribbbleLogin.class);
                    MorphTransform.addExtras(login,
                            ContextCompat.getColor(HomeActivity.this, R.color.background_dark),
                            sharedElement.getHeight() / 2);
                    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(HomeActivity.this,
                            sharedElement, getString(R.string.transition_dribbble_login));
                    startActivityForResult(login, getAuthSourceRequestCode(forSource), options.toBundle());
                }
            });
    dataManager = new DataManager(this, filtersAdapter) {
        @Override
        public void onDataLoaded(List<? extends PlaidItem> data) {
            adapter.addAndResort(data);
            checkEmptyState();
        }
    };
    adapter = new FeedAdapter(this, dataManager, columns, PocketUtils.isPocketInstalled(this));

    grid.setAdapter(adapter);
    layoutManager = new GridLayoutManager(this, columns);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return adapter.getItemColumnSpan(position);
        }
    });
    grid.setLayoutManager(layoutManager);
    grid.addOnScrollListener(toolbarElevation);
    grid.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) {
        @Override
        public void onLoadMore() {
            dataManager.loadAllDataSources();
        }
    });
    grid.setHasFixedSize(true);
    grid.addItemDecoration(new GridItemDividerDecoration(adapter.getDividedViewHolderClasses(), this,
            R.dimen.divider_height, R.color.divider));
    grid.setItemAnimator(new HomeGridItemAnimator());

    // drawer layout treats fitsSystemWindows specially so we have to handle insets ourselves
    drawer.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
            // inset the toolbar down by the status bar height
            ViewGroup.MarginLayoutParams lpToolbar = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
            lpToolbar.topMargin += insets.getSystemWindowInsetTop();
            lpToolbar.leftMargin += insets.getSystemWindowInsetLeft();
            lpToolbar.rightMargin += insets.getSystemWindowInsetRight();
            toolbar.setLayoutParams(lpToolbar);

            // inset the grid top by statusbar+toolbar & the bottom by the navbar (don't clip)
            grid.setPadding(grid.getPaddingLeft() + insets.getSystemWindowInsetLeft(), // landscape
                    insets.getSystemWindowInsetTop() + ViewUtils.getActionBarSize(HomeActivity.this),
                    grid.getPaddingRight() + insets.getSystemWindowInsetRight(), // landscape
                    grid.getPaddingBottom() + insets.getSystemWindowInsetBottom());

            // inset the fab for the navbar
            ViewGroup.MarginLayoutParams lpFab = (ViewGroup.MarginLayoutParams) fab.getLayoutParams();
            lpFab.bottomMargin += insets.getSystemWindowInsetBottom(); // portrait
            lpFab.rightMargin += insets.getSystemWindowInsetRight(); // landscape
            fab.setLayoutParams(lpFab);

            View postingStub = findViewById(R.id.stub_posting_progress);
            ViewGroup.MarginLayoutParams lpPosting = (ViewGroup.MarginLayoutParams) postingStub
                    .getLayoutParams();
            lpPosting.bottomMargin += insets.getSystemWindowInsetBottom(); // portrait
            lpPosting.rightMargin += insets.getSystemWindowInsetRight(); // landscape
            postingStub.setLayoutParams(lpPosting);

            // we place a background behind the status bar to combine with it's semi-transparent
            // color to get the desired appearance.  Set it's height to the status bar height
            View statusBarBackground = findViewById(R.id.status_bar_background);
            FrameLayout.LayoutParams lpStatus = (FrameLayout.LayoutParams) statusBarBackground
                    .getLayoutParams();
            lpStatus.height = insets.getSystemWindowInsetTop();
            statusBarBackground.setLayoutParams(lpStatus);

            // inset the filters list for the status bar / navbar
            // need to set the padding end for landscape case
            final boolean ltr = filtersList.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
            filtersList.setPaddingRelative(filtersList.getPaddingStart(),
                    filtersList.getPaddingTop() + insets.getSystemWindowInsetTop(),
                    filtersList.getPaddingEnd() + (ltr ? insets.getSystemWindowInsetRight() : 0),
                    filtersList.getPaddingBottom() + insets.getSystemWindowInsetBottom());

            // clear this listener so insets aren't re-applied
            drawer.setOnApplyWindowInsetsListener(null);

            return insets.consumeSystemWindowInsets();
        }
    });
    setupTaskDescription();

    filtersList.setAdapter(filtersAdapter);
    filtersList.setItemAnimator(new FilterAdapter.FilterAnimator());
    filtersAdapter.registerFilterChangedCallback(filtersChangedCallbacks);
    dataManager.loadAllDataSources();
    ItemTouchHelper.Callback callback = new FilterTouchHelperCallback(filtersAdapter);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
    itemTouchHelper.attachToRecyclerView(filtersList);
    checkEmptyState();
}

From source file:us.phyxsi.gameshelf.ui.FeedAdapter.java

@NonNull
private BoardgameHolder createBoardgameHolder(ViewGroup parent) {
    final BoardgameHolder holder = new BoardgameHolder(
            layoutInflater.inflate(R.layout.boardgame_item, parent, false));
    holder.image.setOnClickListener(new View.OnClickListener() {
        @Override/*  w  w w .j  a  v  a 2 s .  c o m*/
        public void onClick(View view) {
            holder.itemView
                    .setTransitionName(holder.itemView.getResources().getString(R.string.transition_game));
            holder.itemView.setBackgroundColor(ContextCompat.getColor(host, R.color.background_light));
            Intent intent = new Intent();
            intent.setClass(host, BoardgameDetails.class);
            intent.putExtra(BoardgameDetails.EXTRA_BOARDGAME, (Boardgame) getItem(holder.getAdapterPosition()));
            setGridItemContentTransitions(holder.itemView);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host,
                    Pair.create(view, host.getString(R.string.transition_game)),
                    Pair.create(view, host.getString(R.string.transition_game_background)));
            host.startActivity(intent, options.toBundle());
        }
    });

    // show deletion confirmation
    holder.image.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            new AlertDialog.Builder(context).setTitle(host.getString(R.string.remove_game_title))
                    .setMessage(host.getString(R.string.remove_game_message))
                    .setPositiveButton(host.getString(R.string.dialog_remove),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    BoardgameDbHelper bgHelper = new BoardgameDbHelper(context);
                                    bgHelper.delete((Boardgame) getItem(holder.getAdapterPosition()));

                                    items.remove(getItem(holder.getAdapterPosition()));

                                    notifyDataSetChanged();
                                }
                            })
                    .setNegativeButton(host.getString(R.string.dialog_cancel), null).show();

            return false;
        }
    });

    return holder;
}

From source file:com.hannesdorfmann.FeedAdapter.java

private void bindDesignerNewsStory(final Story story, final DesignerNewsStoryHolder holder) {
    holder.title.setText(story.title);/*from ww w. ja  v a 2  s .  com*/
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            CustomTabActivityHelper.openCustomTab(host,
                    DesignerNewsStory.getCustomTabIntent(host, story, null).build(), Uri.parse(story.url));
        }
    });
    holder.comments.setText(String.valueOf(story.comment_count));
    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);
            final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host,
                    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) {
                final ImageButton pocketButton = (ImageButton) view;
                // actually add to pocket
                PocketUtils.addToPocket(host, story.url);

                // setup for anim
                holder.itemView.setHasTransientState(true);
                ((ViewGroup) pocketButton.getParent().getParent()).setClipChildren(false);
                final int initialLeft = pocketButton.getLeft();
                final int initialTop = pocketButton.getTop();
                final int translatedLeft = (holder.itemView.getWidth() - pocketButton.getWidth()) / 2;
                final int translatedTop = initialTop
                        - ((holder.itemView.getHeight() - pocketButton.getHeight()) / 2);
                final ArcMotion arc = new ArcMotion();

                // animate the title & pocket icon up, scale the pocket icon up
                PropertyValuesHolder pvhTitleUp = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y,
                        -(holder.itemView.getHeight() / 5));
                PropertyValuesHolder pvhTitleFade = PropertyValuesHolder.ofFloat(View.ALPHA, 0.54f);
                Animator titleMoveFadeOut = ObjectAnimator.ofPropertyValuesHolder(holder.title, pvhTitleUp,
                        pvhTitleFade);

                Animator pocketMoveUp = ObjectAnimator.ofFloat(pocketButton, View.TRANSLATION_X,
                        View.TRANSLATION_Y,
                        arc.getPath(initialLeft, initialTop, translatedLeft, translatedTop));
                PropertyValuesHolder pvhPocketScaleUpX = PropertyValuesHolder.ofFloat(View.SCALE_X, 3f);
                PropertyValuesHolder pvhPocketScaleUpY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 3f);
                Animator pocketScaleUp = ObjectAnimator.ofPropertyValuesHolder(pocketButton, pvhPocketScaleUpX,
                        pvhPocketScaleUpY);
                ObjectAnimator pocketFadeUp = ObjectAnimator.ofInt(pocketButton, ViewUtils.IMAGE_ALPHA, 255);

                AnimatorSet up = new AnimatorSet();
                up.playTogether(titleMoveFadeOut, pocketMoveUp, pocketScaleUp, pocketFadeUp);
                up.setDuration(300);
                up.setInterpolator(
                        AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in));

                // animate everything back into place
                PropertyValuesHolder pvhTitleMoveUp = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0f);
                PropertyValuesHolder pvhTitleFadeUp = PropertyValuesHolder.ofFloat(View.ALPHA, 1f);
                Animator titleMoveFadeIn = ObjectAnimator.ofPropertyValuesHolder(holder.title, pvhTitleMoveUp,
                        pvhTitleFadeUp);
                Animator pocketMoveDown = ObjectAnimator.ofFloat(pocketButton, View.TRANSLATION_X,
                        View.TRANSLATION_Y, arc.getPath(translatedLeft, translatedTop, 0, 0));
                PropertyValuesHolder pvhPocketScaleDownX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f);
                PropertyValuesHolder pvhPocketScaleDownY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f);
                Animator pvhPocketScaleDown = ObjectAnimator.ofPropertyValuesHolder(pocketButton,
                        pvhPocketScaleDownX, pvhPocketScaleDownY);
                ObjectAnimator pocketFadeDown = ObjectAnimator.ofInt(pocketButton, ViewUtils.IMAGE_ALPHA, 138);

                AnimatorSet down = new AnimatorSet();
                down.playTogether(titleMoveFadeIn, pocketMoveDown, pvhPocketScaleDown, pocketFadeDown);
                down.setDuration(300);
                down.setInterpolator(
                        AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in));
                down.setStartDelay(500);

                // play it
                AnimatorSet upDown = new AnimatorSet();
                upDown.playSequentially(up, down);

                // clean up
                upDown.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        ((ViewGroup) pocketButton.getParent().getParent()).setClipChildren(true);
                        holder.itemView.setHasTransientState(false);
                    }
                });
                upDown.start();
            }
        });
    }
}

From source file:com.yahoo.mobile.client.android.yodel.ui.PostDetailActivity.java

@Override
public void onPostImagesSelected(List<Photo> imagesToShow, View clickedImageView) {
    Intent intent = new Intent(this, ImageGalleryActivity.class);
    // Because Photo objects are not parcelable, we serialize to JSON to pass between activities
    String photoListJson = new Gson().toJson(imagesToShow);
    intent.putExtra(ImageGalleryActivity.EXTRA_PHOTO_LIST, photoListJson);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, clickedImageView,
                "post_image");
        startActivity(intent, options.toBundle());
    } else {/*from   ww w  .  j av  a  2 s .  c  om*/
        startActivity(intent);
    }
}

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/*from   w ww.java2  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()));
            setGridItemContentTransitions(holder.itemView);
            final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host,
                    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.ANIMATE_ADD_POCKET);
            }
        });
    }
    return holder;
}

From source file:us.phyxsi.gameshelf.ui.HomeActivity.java

@OnClick(R.id.fab)
protected void fabClick() {
    Intent intent = new Intent(this, AddNewBoardgame.class);
    intent.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_COLOR,
            ContextCompat.getColor(this, R.color.accent));
    intent.putExtra(NewBoardgameService.EXTRA_BOARDGAME_RESULT, true);
    //        registerPostStoryResultListener();
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, fab,
            getString(R.string.transition_add_new_boardgame));
    startActivityForResult(intent, RC_ADD_NEW_BOARDGAME, options.toBundle());
}