當前位置: 首頁>>代碼示例>>Java>>正文


Java Fragment.setExitTransition方法代碼示例

本文整理匯總了Java中android.support.v4.app.Fragment.setExitTransition方法的典型用法代碼示例。如果您正苦於以下問題:Java Fragment.setExitTransition方法的具體用法?Java Fragment.setExitTransition怎麽用?Java Fragment.setExitTransition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.setExitTransition方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

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

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

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

示例7: setupFragmentTransition

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupFragmentTransition(Fragment fragment) {
    final Transition move = TransitionInflater.from(this).inflateTransition(android.R.transition.move);
    fragment.setSharedElementEnterTransition(move);
    fragment.setExitTransition(new Slide(Gravity.END));
}
 
開發者ID:roshakorost,項目名稱:Phial,代碼行數:7,代碼來源:HomeActivity.java


注:本文中的android.support.v4.app.Fragment.setExitTransition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。