当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.setReturnTransition方法代码示例

本文整理汇总了Java中android.support.v4.app.Fragment.setReturnTransition方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.setReturnTransition方法的具体用法?Java Fragment.setReturnTransition怎么用?Java Fragment.setReturnTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.setReturnTransition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showUserInfo

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void showUserInfo() {
    Fragment fragment = new UserInfoFragment();

    Bundle bundle = new Bundle();
    bundle.putLong(UserInfoFragment.ID_BUNDLE_KEY, CurrentUser.getInstance().getCurrentUserId());
    bundle.putString(UserInfoFragment.EMAIL_BUNDLE_KEY, CurrentUser.getInstance().getCurrentEmail());
    bundle.putString(UserInfoFragment.PHONE_BUNDLE_KEY, CurrentUser.getInstance().getPhone());
    bundle.putString(UserInfoFragment.WEBSITE_BUNDLE_KEY, CurrentUser.getInstance().getWebsite());
    bundle.putString(UserInfoFragment.FULL_NAME_BUNDLE_KEY, CurrentUser.getInstance().getFullName());
    bundle.putParcelable(UserInfoFragment.AVATAR_BUNDLE_KEY, ((BitmapDrawable) drawerAvatar.getDrawable()).getBitmap());
    fragment.setArguments(bundle);


    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionSet sharedElementTransition = (TransitionSet) TransitionInflater
                .from(this)
                .inflateTransition(R.transition.user_shared_element);
        TransitionSet userInfoTransitionIn = (TransitionSet) TransitionInflater
                .from(this)
                .inflateTransition(R.transition.user_info_transition_in);
        TransitionSet userInfoTransitionOut = (TransitionSet) TransitionInflater
                .from(this)
                .inflateTransition(R.transition.user_info_transition_out);
        fragment.setSharedElementEnterTransition(sharedElementTransition);
        fragment.setEnterTransition(userInfoTransitionIn);
        fragment.setReturnTransition(userInfoTransitionOut);
        fragment.setSharedElementReturnTransition(sharedElementTransition);

    }

    getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.main_screen_container, fragment)
            .addSharedElement(drawerAvatar, getString(R.string.transition_user_avatar_name))
            .addSharedElement(drawerLogin, getString(R.string.transition_user_full_name))
            .addToBackStack(null)
            .commit();
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:40,代码来源:MainActivity.java

示例2: showUserInfo

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void showUserInfo(UserModel user) {
    Fragment fragment = new UserInfoFragment();
    ImageView sharedImage = presenter.getAdapter().getClickedUserImage();
    TextView textView = presenter.getAdapter().getClickedTextView();

    Bundle bundle = new Bundle();
    bundle.putLong(UserInfoFragment.ID_BUNDLE_KEY, user.getUserId());
    bundle.putString(UserInfoFragment.EMAIL_BUNDLE_KEY, user.getEmail());
    bundle.putString(UserInfoFragment.PHONE_BUNDLE_KEY, user.getPhone());
    bundle.putString(UserInfoFragment.WEBSITE_BUNDLE_KEY, user.getWebsite());
    bundle.putString(UserInfoFragment.FULL_NAME_BUNDLE_KEY, user.getFullName());
    bundle.putParcelable(UserInfoFragment.AVATAR_BUNDLE_KEY, ((BitmapDrawable) sharedImage.getDrawable()).getBitmap());
    fragment.setArguments(bundle);


    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionSet sharedElementTransition = (TransitionSet) TransitionInflater
                .from(getActivity())
                .inflateTransition(R.transition.user_shared_element);
        TransitionSet userInfoTransitionIn = (TransitionSet) TransitionInflater
                .from(getActivity())
                .inflateTransition(R.transition.user_info_transition_in);
        TransitionSet userInfoTransitionOut = (TransitionSet) TransitionInflater
                .from(getActivity())
                .inflateTransition(R.transition.user_info_transition_out);
        TransitionSet usersTransitionIn = (TransitionSet) TransitionInflater
                .from(getActivity())
                .inflateTransition(R.transition.users_transition_in);
        TransitionSet usersTransitionOut = (TransitionSet) TransitionInflater
                .from(getActivity())
                .inflateTransition(R.transition.users_transition_out);
        fragment.setSharedElementEnterTransition(sharedElementTransition);
        fragment.setEnterTransition(userInfoTransitionIn);
        fragment.setReturnTransition(userInfoTransitionOut);
        fragment.setSharedElementReturnTransition(sharedElementTransition);
        setReenterTransition(usersTransitionIn);
        setExitTransition(usersTransitionOut);
    }

    getActivity().getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.main_screen_container, fragment)
            .addSharedElement(sharedImage, getString(R.string.transition_user_avatar_name))
            .addSharedElement(textView, getString(R.string.transition_user_full_name))
            .addToBackStack(null)
            .commit();
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:49,代码来源:UsersFragment.java


注:本文中的android.support.v4.app.Fragment.setReturnTransition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。