当前位置: 首页>>代码示例>>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;未经允许,请勿转载。