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


Java Fragment.setEnterTransition方法代码示例

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


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

示例1: openSinglePlayerOptions

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Swaps in the Single Player Options Fragment
 */
@Override
public void openSinglePlayerOptions() {
    // Swap in single player menu fragment
    Fragment fragment = MainMenuSinglePlayerFragment.newInstance();

    // Set transitions
    fragment.setEnterTransition(mNewEnterTransition);
    fragment.setExitTransition(mNewExitTransition);

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.menu_frame, fragment);
    transaction.addToBackStack(null);
    transaction.commit();
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:19,代码来源:MainMenuFragment.java

示例2: openMultiplayerOptions

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Swaps in the Single Player Options Fragment
 */
@Override
public void openMultiplayerOptions() {

    // Swap in multiplayer menu fragment
    Fragment fragment = MainMenuMultiplayerFragment.newInstance();

    // Set transitions
    fragment.setEnterTransition(mNewEnterTransition);
    fragment.setExitTransition(mNewExitTransition);

    // Swap in the Multiplayer Menu Fragment
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.menu_frame, fragment);
    transaction.addToBackStack(null);
    transaction.commit();
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:21,代码来源:MainMenuFragment.java

示例3: openTaskDetail

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public void openTaskDetail(){
    Task clickedTask = adapter.getTask(mTaskViewPager.getCurrentItem());

    Fragment taskDetailFragment = new TaskDetailFragment();
    ((TaskDetailFragment)taskDetailFragment).setDisplayedTask(clickedTask);

    if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
        Explode explode = new Explode();
        explode.setDuration(300);
        Fade fade = new Fade();
        fade.setDuration(400);
        taskDetailFragment.setEnterTransition(fade);
        setExitTransition(explode);
        setReenterTransition(explode);
    }

    getActivity().getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.content_frame, taskDetailFragment)
            .addToBackStack(null)
            .commit();

}
 
开发者ID:gincos,项目名称:BeHealthy,代码行数:24,代码来源:MainFragment.java

示例4: addSharedElement

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private Fragment addSharedElement(Fragment fragment) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        fragment.setSharedElementEnterTransition(new DetailTransition());
        fragment.setEnterTransition(new Fade());
        fragment.setSharedElementReturnTransition(new DetailTransition());
    }
    return fragment;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Demo0Fragment.java

示例5: performTransition

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void performTransition()
{
    if (isDestroyed())
    {
        return;
    }
    Fragment previousFragment = mFragmentManager.findFragmentById(R.id.fragment_container);
    Fragment nextFragment = Fragment2.newInstance();

    FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();

    // 1. Exit for Previous Fragment
    Fade exitFade = new Fade();
    exitFade.setDuration(FADE_DEFAULT_TIME);
    previousFragment.setExitTransition(exitFade);

    // 2. Shared Elements Transition
    TransitionSet enterTransitionSet = new TransitionSet();
    enterTransitionSet.addTransition(TransitionInflater.from(this).inflateTransition(android.R.transition.move));
    enterTransitionSet.setDuration(MOVE_DEFAULT_TIME);
    enterTransitionSet.setStartDelay(FADE_DEFAULT_TIME);
    nextFragment.setSharedElementEnterTransition(enterTransitionSet);

    // 3. Enter Transition for New Fragment
    Fade enterFade = new Fade();
    enterFade.setStartDelay(MOVE_DEFAULT_TIME + FADE_DEFAULT_TIME);
    enterFade.setDuration(FADE_DEFAULT_TIME);
    nextFragment.setEnterTransition(enterFade);

    View logo = ButterKnife.findById(this, R.id.fragment1_logo);
    fragmentTransaction.addSharedElement(logo, logo.getTransitionName());
    fragmentTransaction.replace(R.id.fragment_container, nextFragment);
    fragmentTransaction.commitAllowingStateLoss();
}
 
开发者ID:Bynder,项目名称:FragmentTransitionExample,代码行数:35,代码来源:MainActivity.java

示例6: showNewCounter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void showNewCounter(int count) {
    Fragment fragment = CountingFragment.newInstance(count);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        fragment.setEnterTransition(new Slide(Gravity.END));
    }

    getChildFragmentManager().beginTransaction()
            .addToBackStack(null)
            .setReorderingAllowed(true)
            .replace(R.id.holderFrame, fragment)
            .commitAllowingStateLoss();
}
 
开发者ID:okaybroda,项目名称:FragmentStateManager,代码行数:14,代码来源:HolderFragment.java

示例7: setFragmentTransition

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Fragment Transition
 *
 * @param activity
 * @param firstFragment
 * @param secondFragment
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setFragmentTransition(MainActivity activity, Fragment firstFragment, Fragment secondFragment, View view, String name, String tag) {
    if (activity == null) {
        return;
    }

    FragmentManager fragmentManager = activity.getSupportFragmentManager();

    boolean fragmentPopped = fragmentManager.popBackStackImmediate(tag, 0);

    if (fragmentPopped) {
        // fragment is pop from backStack
    } else {
        Transition transitionFade = TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform);
        Transition transitionImage = TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform);

        firstFragment.setSharedElementReturnTransition(transitionImage);
        firstFragment.setEnterTransition(transitionFade);
        firstFragment.setExitTransition(transitionFade);

        secondFragment.setSharedElementEnterTransition(transitionImage);
        secondFragment.setEnterTransition(transitionFade);
        secondFragment.setExitTransition(transitionFade);

        fragmentManager.beginTransaction()
                .replace(R.id.container, secondFragment)
                .addSharedElement(view, name)
                .addToBackStack(tag)
                .commit();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:39,代码来源:Helper.java

示例8: applyBeforeFragmentTransactionExecuted

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void applyBeforeFragmentTransactionExecuted(FragmentTransaction transaction, Fragment enteringFragment, Fragment exitingFragment) {
	enteringFragment.setEnterTransition(mEnterTransition);
	exitingFragment.setExitTransition(mExitTransition);
	enteringFragment.setSharedElementEnterTransition(mSharedElementTransition);
	enteringFragment.setAllowEnterTransitionOverlap(mAllowEnterTransitionOverlap);
	if (mSharedElements != null) {
		for (Pair<View, String> sharedElement : mSharedElements) {
			transaction.addSharedElement(sharedElement.first, sharedElement.second);
		}
	}
}
 
开发者ID:aartikov,项目名称:Alligator,代码行数:13,代码来源:LollipopTransitionAnimation.java

示例9: applyAfterFragmentTransactionExecuted

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void applyAfterFragmentTransactionExecuted(Fragment enteringFragment, Fragment exitingFragment) {
	enteringFragment.setEnterTransition(null);
	exitingFragment.setExitTransition(null);
	enteringFragment.setSharedElementEnterTransition(null);
	enteringFragment.setAllowEnterTransitionOverlap(true);
}
 
开发者ID:aartikov,项目名称:Alligator,代码行数:8,代码来源:LollipopTransitionAnimation.java

示例10: 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

示例11: 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.setEnterTransition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。