Java Code Examples for android.app.ActivityOptions#makeSceneTransitionAnimation()

The following examples show how to use android.app.ActivityOptions#makeSceneTransitionAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientList.java    From faveo-helpdesk-android-app with Open Software License 3.0 6 votes vote down vote up
/**
 * Here we are handling the click event .
 * @param v is the view.
 */
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.client4:
            Intent intent = new Intent(getActivity(), ClientDetailActivity.class);
            View sharedView = v.findViewById(R.id.imageView_default_profile);
            String transitionName = getString(R.string.blue_name);

            ActivityOptions transitionActivityOptions = null;
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(getActivity(), sharedView, transitionName);
                startActivity(intent, transitionActivityOptions.toBundle());
            } else startActivity(intent);

            break;
    }
}
 
Example 2
Source File: NavigationUtils.java    From Muzesto with GNU General Public License v3.0 6 votes vote down vote up
@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID, String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);

    if (TimberUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(), transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivity(intent, options.toBundle());
    } else {
        context.startActivity(intent);
    }
}
 
Example 3
Source File: MainActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
@Override
public void openProfileActivity(String userId, View view) {
    Intent intent = new Intent(MainActivity.this, ProfileActivity.class);
    intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

        View authorImageView = view.findViewById(R.id.authorImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(MainActivity.this,
                        new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name)));
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST);
    }
}
 
Example 4
Source File: SearchPostsFragment.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
private void openPostDetailsActivity(Post post, View v) {
    Intent intent = new Intent(getActivity(), PostDetailsActivity.class);
    intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());
    intent.putExtra(PostDetailsActivity.AUTHOR_ANIMATION_NEEDED_EXTRA_KEY, true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        View imageView = v.findViewById(R.id.postImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(getActivity(),
                        new Pair<>(imageView, getString(R.string.post_image_transition_name))
                );
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
    }
}
 
Example 5
Source File: UsersListActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
private void openProfileActivity(String userId, View view) {
    Intent intent = new Intent(UsersListActivity.this, ProfileActivity.class);
    intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

        ImageView imageView = view.findViewById(R.id.photoImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(UsersListActivity.this,
                        new android.util.Pair<>(imageView, getString(R.string.post_author_image_transition_name)));
        startActivityForResult(intent, UPDATE_FOLLOWING_STATE_REQ, options.toBundle());
    } else {
        startActivityForResult(intent, UPDATE_FOLLOWING_STATE_REQ);
    }
}
 
Example 6
Source File: FollowingPostsActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
@Override
public void openProfileActivity(String userId, View view) {
    Intent intent = new Intent(FollowingPostsActivity.this, ProfileActivity.class);
    intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

        View authorImageView = view.findViewById(R.id.authorImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(FollowingPostsActivity.this,
                        new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name)));
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST);
    }
}
 
Example 7
Source File: UsersListActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
private void openProfileActivity(String userId, View view) {
    Intent intent = new Intent(UsersListActivity.this, ProfileActivity.class);
    intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

        ImageView imageView = view.findViewById(R.id.photoImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(UsersListActivity.this,
                        new android.util.Pair<>(imageView, getString(R.string.post_author_image_transition_name)));
        startActivityForResult(intent, UPDATE_FOLLOWING_STATE_REQ, options.toBundle());
    } else {
        startActivityForResult(intent, UPDATE_FOLLOWING_STATE_REQ);
    }
}
 
Example 8
Source File: MainPagerFragment.java    From Awesome-WanAndroid with Apache License 2.0 6 votes vote down vote up
private void startArticleDetailPager(View view, int position) {
    if (mAdapter.getData().size() <= 0 || mAdapter.getData().size() < position) {
        return;
    }
    //记录点击的文章位置,便于在文章内点击收藏返回到此界面时能展示正确的收藏状态
    articlePosition = position;
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(_mActivity, view, getString(R.string.share_view));
    JudgeUtils.startArticleDetailActivity(_mActivity,
            options,
            mAdapter.getData().get(position).getId(),
            mAdapter.getData().get(position).getTitle(),
            mAdapter.getData().get(position).getLink(),
            mAdapter.getData().get(position).isCollect(),
            false,
            false);
}
 
Example 9
Source File: SearchPostsFragment.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("RestrictedApi")
private void openPostDetailsActivity(Post post, View v) {
    Intent intent = new Intent(getActivity(), PostDetailsActivity.class);
    intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());
    intent.putExtra(PostDetailsActivity.AUTHOR_ANIMATION_NEEDED_EXTRA_KEY, true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        View imageView = v.findViewById(R.id.postImageView);

        ActivityOptions options = ActivityOptions.
                makeSceneTransitionAnimation(getActivity(),
                        new Pair<>(imageView, getString(R.string.post_image_transition_name))
                );
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
    } else {
        startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
    }
}
 
Example 10
Source File: KnowledgeHierarchyFragment.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void startDetailPager(View view, int position) {
    if (mAdapter.getData().size() <= 0 || mAdapter.getData().size() <= position) {
        return;
    }
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(_mActivity, view, getString(R.string.share_view));
    Intent intent = new Intent(_mActivity, KnowledgeHierarchyDetailActivity.class);
    intent.putExtra(Constants.ARG_PARAM1, mAdapter.getData().get(position));
    if (modelFiltering()) {
        startActivity(intent, options.toBundle());
    } else {
        startActivity(intent);
    }
}
 
Example 11
Source File: UsageDialogFragment.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void startUsefulSitePager(View view, int position1) {
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(), view, getString(R.string.share_view));
    JudgeUtils.startArticleDetailActivity(getActivity(),
            options,
            mUsefulSiteDataList.get(position1).getId(),
            mUsefulSiteDataList.get(position1).getName().trim(),
            mUsefulSiteDataList.get(position1).getLink().trim(),
            false,
            false,
            true);
}
 
Example 12
Source File: KnowledgeHierarchyListFragment.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void startArticleDetailPager(View view, int position) {
    if (mAdapter.getData().size() <= 0 || mAdapter.getData().size() <= position) {
        return;
    }
    articlePosition = position;
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(_mActivity, view, getString(R.string.share_view));
    JudgeUtils.startArticleDetailActivity(_mActivity,
            options,
            mAdapter.getData().get(position).getId(),
            mAdapter.getData().get(position).getTitle().trim(),
            mAdapter.getData().get(position).getLink().trim(),
            mAdapter.getData().get(position).isCollect(),
            false,
            false);
}
 
Example 13
Source File: MainActivity.java    From AndroidUI with MIT License 5 votes vote down vote up
@Override
public void onItemClick(View view, int position) {
    Intent intent = new Intent(this, SecondActivity.class);
    intent.putExtra("image",images[position]);
    if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.LOLLIPOP){
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(this, view.findViewById(R.id.imageview), "imageview");

        startActivity(intent, options.toBundle());
    }else{
        startActivity(intent);
    }
}
 
Example 14
Source File: MainActivity.java    From BeMusic with Apache License 2.0 5 votes vote down vote up
private void showPlayDetail () {
    Intent it = new Intent(this, PlayDetailActivity.class);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Pair<View, String> thumb = new Pair<View, String>(mMiniThumbIv, getString(R.string.translation_thumb));
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(this, thumb);
        startActivity(it, options.toBundle());
    } else {
        startActivity(it);
    }
    overridePendingTransition(R.anim.anim_bottom_in, 0);
}
 
Example 15
Source File: SportsAdapter.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    Sport currentSport = mSportsData.get(getAdapterPosition());
    Intent detailIntent = new Intent(mContext, DetailActivity.class);
    detailIntent.putExtra("title", currentSport.getTitle());
    detailIntent.putExtra("image_resource", currentSport.getImageResource());
    detailIntent.putExtra("details", currentSport.getDetails());
    ActivityOptions options = ActivityOptions
            .makeSceneTransitionAnimation((Activity) mContext, mSportsImage, "sportImageSharedTransition");
    mContext.startActivity(detailIntent, options.toBundle());
}
 
Example 16
Source File: ContentActivity.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static void startActivityWithOptions(Activity current, Intent intent, View avatar, View title) {
    ActivityOptions transitionActivity =
            ActivityOptions.makeSceneTransitionAnimation(current,
                    Pair.create(avatar, current.getString(R.string.transition_shared_avatar)),
                    Pair.create(title, current.getString(R.string.transition_shared_title)));
    current.startActivity(intent, transitionActivity.toBundle());
}
 
Example 17
Source File: ShareAnimationActivityA.java    From PlayerBase with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.album_layout, R.id.tv_title})
public void onViewClicked(View view) {
    ShareAnimationPlayer.get().setReceiverGroup(mReceiverGroup);
    switch (view.getId()) {
        case R.id.album_layout:
            playIcon.setVisibility(View.GONE);
            ShareAnimationPlayer.get().play(mLayoutContainer, mData);
            break;
        case R.id.tv_title:
            toNext = true;
            Intent intent = new Intent(this, ShareAnimationActivityB.class);
            intent.putExtra(ShareAnimationActivityB.KEY_DATA, mData);
            if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
                ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
                        this, mLayoutContainer, "videoShare");
                ActivityCompat.startActivity(this, intent, options.toBundle());
            }else{
                startActivity(intent);
            }
            break;
    }
}
 
Example 18
Source File: LiquorActivity.java    From Drinks with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void onDrinkClick(int position, Drink drink) {
    Intent intent = new Intent(this, DrinkActivity.class);
    //TODO add drink id to intent
    if (TRANSITIONS_AVAILABLE) {
        TileViewHolder holder = (TileViewHolder) recyclerView.findViewHolderForAdapterPosition(position);
        String transition = getString(R.string.transition_drink);
        ActivityOptions options = ActivityOptions
                .makeSceneTransitionAnimation(this, holder.getImageView(), transition);
        startActivity(intent, options.toBundle());
    } else {
        startActivity(intent);
    }
}
 
Example 19
Source File: ProjectFragment.java    From Yuan-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void toSearchActivity(){
    Intent intent = new Intent(mActivity,SearchActivity.class);

    //适配5.0以下的机型
    if (Build.VERSION.SDK_INT >= 21) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity,
                Pair.create(mSearchTv, getString(R.string.share_edit)),
                Pair.create(mSearchIv, getString(R.string.share_image))
        );
        startActivity(intent, options.toBundle());
    }else{
        startActivity(intent);
    }
}
 
Example 20
Source File: MainActivity.java    From google-io-2014 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
public void showPhoto(View view) {
    Intent intent = new Intent();
    intent.setClass(this, DetailActivity.class);

    switch (view.getId()) {
        case R.id.show_photo_1:
            intent.putExtra("lat", 37.6329946);
            intent.putExtra("lng", -122.4938344);
            intent.putExtra("zoom", 14.0f);
            intent.putExtra("title", "Pacifica Pier");
            intent.putExtra("description", getResources().getText(R.string.lorem));
            intent.putExtra("photo", R.drawable.photo1);
            break;
        case R.id.show_photo_2:
            intent.putExtra("lat", 37.73284);
            intent.putExtra("lng", -122.503065);
            intent.putExtra("zoom", 15.0f);
            intent.putExtra("title", "Pink Flamingo");
            intent.putExtra("description", getResources().getText(R.string.lorem));
            intent.putExtra("photo", R.drawable.photo2);
            break;
        case R.id.show_photo_3:
            intent.putExtra("lat", 36.861897);
            intent.putExtra("lng", -111.374438);
            intent.putExtra("zoom", 11.0f);
            intent.putExtra("title", "Antelope Canyon");
            intent.putExtra("description", getResources().getText(R.string.lorem));
            intent.putExtra("photo", R.drawable.photo3);
            break;
        case R.id.show_photo_4:
            intent.putExtra("lat", 36.596125);
            intent.putExtra("lng", -118.1604282);
            intent.putExtra("zoom", 9.0f);
            intent.putExtra("title", "Lone Pine");
            intent.putExtra("description", getResources().getText(R.string.lorem));
            intent.putExtra("photo", R.drawable.photo4);
            break;
    }

    ImageView hero = (ImageView) ((View) view.getParent()).findViewById(R.id.photo);

    sPhotoCache.put(intent.getIntExtra("photo", -1),
            ((BitmapDrawable) hero.getDrawable()).getBitmap());

    ActivityOptions options =
            ActivityOptions.makeSceneTransitionAnimation(this, hero, "photo_hero");
    startActivity(intent, options.toBundle());
}