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


Java FragmentManager.popBackStackImmediate方法代碼示例

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


在下文中一共展示了FragmentManager.popBackStackImmediate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: popMultipleBackStack

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 一次彈出多個Fragment
 *
 * @param tag
 * @param popFlag 0 彈出不包括tag所指的Fragment;1 表示彈出包括當前tag的fragment
 * @param bundle  回退棧 傳輸參數
 */
public void popMultipleBackStack(String tag, int popFlag, Bundle bundle) {
    if (bundle != null) {
        setSupportBackStackArguments(bundle);
    }
    //維護後退棧內容,保持同步
    if (mFragmentBackDeque.contains(tag)) {
        String peekElement = mFragmentBackDeque.peek();
        while (!tag.equals(peekElement)) {
            if (mFragmentBackDeque.isEmpty()) {
                break;
            }
            mFragmentBackDeque.pop();
            peekElement = mFragmentBackDeque.peek();
        }

        if (popFlag == 1) {
            if (!mFragmentBackDeque.isEmpty()) {
                mFragmentBackDeque.pop();
            }
        }
    }

    FragmentManager manager = getSupportFragmentManager();
    manager.popBackStackImmediate(tag, popFlag);
}
 
開發者ID:Sugarya,項目名稱:FragmentCapsulation,代碼行數:33,代碼來源:BasicActivity.java

示例2: replaceCurrentFragment

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
public void replaceCurrentFragment(int container, Fragment targetFragment,
                                   String tag, boolean addToBackStack, boolean animate) {
    if (!isFinishing()) {
        FragmentManager manager = getSupportFragmentManager();
        boolean fragmentPopped = manager.popBackStackImmediate(tag, 0);

        if (!fragmentPopped && manager.findFragmentByTag(tag) == null) {
            FragmentTransaction ft = manager.beginTransaction();
            if (animate)
                ft.setCustomAnimations(R.anim.slide_out_right,
                        R.anim.slide_in_left, R.anim.slide_out_left,
                        R.anim.slide_in_right);
            ft.replace(container, targetFragment, tag);
            if (addToBackStack) {
                ft.addToBackStack(tag);
            }
            ft.commit();
        }
    }
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:21,代碼來源:MainActivity.java

示例3: popAllFragments

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧所有fragment
 *
 * @param fragmentManager fragment管理器
 */
public static void popAllFragments(@NonNull final FragmentManager fragmentManager) {
    List<Fragment> fragments = getFragments(fragmentManager);
    if (fragments.isEmpty()) return;
    for (int i = fragments.size() - 1; i >= 0; --i) {
        Fragment fragment = fragments.get(i);
        if (fragment != null) popAllFragments(fragment.getChildFragmentManager());
    }
    while (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();
    }
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:17,代碼來源:FragmentUtils.java

示例4: clearBackStackFragmets

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
public void clearBackStackFragmets(final String tag)
    {
        // in my case I get the support fragment manager, it should work with the native one too
        FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
        // this will clear the back stack and displays no animation on the screen
        fragmentManager.popBackStackImmediate(tag, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        // fragmentManager.popBackStackImmediate(SplashFragment.class.getCanonicalName(),FragmentManager.POP_BACK_STACK_INCLUSIVE);

//        Methods.hideKeyboard();
    }
 
開發者ID:QuixomTech,項目名稱:DeviceInfo,代碼行數:11,代碼來源:FragmentUtil.java

示例5: onBackPressed

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
	if (dispatchBackPressToCurrentFragment()) {
		return;
	}
	final FragmentManager fragmentManager = getSupportFragmentManager();
	if (fragmentManager.getBackStackEntryCount() > 0 && fragmentManager.popBackStackImmediate()) {
		return;
	}
	super.onBackPressed();
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:12,代碼來源:MainActivity.java

示例6: debouncePop

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
private void debouncePop(SupportFragment from, FragmentManager fragmentManager) {
    // Debounce
    if (from == null) {
        from = getTopFragment(fragmentManager);
    }
    long now = System.currentTimeMillis();
    if (now < mShareElementDebounceTime) return;
    mShareElementDebounceTime = System.currentTimeMillis() + from.getExitAnimDuration();

    fragmentManager.popBackStackImmediate();
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:12,代碼來源:FragmentationDelegate.java

示例7: navigateBack

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
public void navigateBack() {
    activity.hideKeyboard();
    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    if (fragmentManager.getBackStackEntryCount() > 0) {
        Log.i(TAG, "Popping back stack");
        int fragmentPosition = fragmentManager.getBackStackEntryCount() - 1;
        FragmentManager.BackStackEntry backEntry = fragmentManager.getBackStackEntryAt(fragmentPosition);
        String fragmentName = backEntry.getName();
        fragmentManager.popBackStackImmediate(fragmentName, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        navigationManager.removeFragmentsFromStack(fragmentPosition);
    } else {
        Log.i(TAG, "Nothing on back stack");
        if (activity.isTaskRoot()) {
            if (doublePressToExit) {
                activity.finish();
                return;
            }
            doublePressToExit = true;
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    doublePressToExit = false;
                }
            }, TIME_INTERVAL);
        } else {
            activity.finish();
        }
    }
}
 
開發者ID:steelkiwi,項目名稱:NavigationTools,代碼行數:30,代碼來源:NavigationBackManager.java

示例8: popMultipleBackStack

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 一次彈出多個Fragment
 *
 * @param tag
 * @param bundle 回退棧 傳輸參數
 */
private void popMultipleBackStack(String tag, Bundle bundle) {
    if (bundle != null) {
        setSupportBackStackArguments(bundle);
    }
    synchronizeFragmentBackDequeWhenSingleLaunchMode(tag);

    FragmentManager manager = getSupportFragmentManager();
    manager.popBackStackImmediate(tag, 0);

    reorderAvailIndicesToFixBug();
}
 
開發者ID:Sugarya,項目名稱:Closet,代碼行數:18,代碼來源:BasicActivity.java

示例9: popAllFragments

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧所有fragment
 *
 * @param fragmentManager fragment管理器
 */
public static void popAllFragments(@NonNull FragmentManager fragmentManager) {
    List<Fragment> fragments = getFragments(fragmentManager);
    if (fragments.isEmpty()) return;
    for (int i = fragments.size() - 1; i >= 0; --i) {
        Fragment fragment = fragments.get(i);
        if (fragment != null) popAllFragments(fragment.getChildFragmentManager());
    }
    while (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();
    }
}
 
開發者ID:pan2yong22,項目名稱:AndroidUtilCode-master,代碼行數:17,代碼來源:FragmentUtils.java

示例10: popAllFragments

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧所有fragment
 *
 * @param fragmentManager fragment管理器
 */
public static void popAllFragments(@NonNull FragmentManager fragmentManager) {
    List<Fragment> fragments = getFragments(fragmentManager);
    if (fragments.isEmpty())
        return;
    for (int i = fragments.size() - 1; i >= 0; --i) {
        Fragment fragment = fragments.get(i);
        if (fragment != null)
            popAllFragments(fragment.getChildFragmentManager());
    }
    while (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();
    }
}
 
開發者ID:yangxp108,項目名稱:MVPArms_Fragment-fragment,代碼行數:19,代碼來源:FragmentUtils.java

示例11: clearFragmentBackStack

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
public void clearFragmentBackStack() {
    final FragmentManager fm = getSupportFragmentManager();
    for (int i = 0; i < fm.getBackStackEntryCount(); ++i) {
        fm.popBackStackImmediate();
    }
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:7,代碼來源:BaseFragmentActivity.java

示例12: popFragments

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * Drop the same level fragment
 *
 * @param fragmentManager fragment manager
 */
public static void popFragments(@NonNull FragmentManager fragmentManager) {
    while (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();
    }
}
 
開發者ID:goutham106,項目名稱:GmArchMvvm,代碼行數:11,代碼來源:FragmentUtils.java

示例13: popFragments

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧同級別fragment
 *
 * @param fragmentManager fragment管理器
 */
public static void popFragments(@NonNull FragmentManager fragmentManager) {
    while (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStackImmediate();
    }
}
 
開發者ID:xiaobailong24,項目名稱:MVVMArms,代碼行數:11,代碼來源:FragmentUtils.java

示例14: popToFragment

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧到指定fragment
 *
 * @param fragmentManager fragment管理器
 * @param fragmentClass   Fragment類
 * @param isIncludeSelf   是否包括Fragment類自己
 * @return {@code true}: 出棧成功<br>{@code false}: 出棧失敗
 */
public static boolean popToFragment(@NonNull FragmentManager fragmentManager,
                                    Class<? extends Fragment> fragmentClass,
                                    boolean isIncludeSelf) {
    return fragmentManager.popBackStackImmediate(fragmentClass.getName(), isIncludeSelf ? FragmentManager.POP_BACK_STACK_INCLUSIVE : 0);
}
 
開發者ID:HStanN,項目名稱:TakeRest,代碼行數:14,代碼來源:FragmentUtils.java

示例15: popFragment

import android.support.v4.app.FragmentManager; //導入方法依賴的package包/類
/**
 * 出棧fragment
 *
 * @param fragmentManager fragment管理器
 * @return {@code true}: 出棧成功<br>{@code false}: 出棧失敗
 */
public static boolean popFragment(@NonNull FragmentManager fragmentManager) {
    return fragmentManager.popBackStackImmediate();
}
 
開發者ID:hoangkien0705,項目名稱:Android-UtilCode,代碼行數:10,代碼來源:FragmentUtils.java


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