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


Java FragmentManager.BackStackEntry方法代码示例

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


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

示例1: onBackPressed

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    if (backButtonDisabled) {
        Log.w(TAG, "Going back at this step is not possible.");
        return;
    }
    final int backStackEntryCount = getSupportFragmentManager().getBackStackEntryCount();
    if (backStackEntryCount == 0) {
        super.onBackPressed();
    } else {
        FragmentManager.BackStackEntry backEntry = getSupportFragmentManager().getBackStackEntryAt(backStackEntryCount - 1);
        String tag = backEntry.getName();
        if (PaymentMethodSelectionFragment.class.getName().equals(tag) || LoadingScreenFragment.class.getName().equals(tag)) {
            final Intent cancellationIntent = new Intent(Constants.PaymentRequest.PAYMENT_REQUEST_CANCELLED_INTENT);
            LocalBroadcastManager.getInstance(this).sendBroadcast(cancellationIntent);
            finish();
        } else if (backStackEntryCount == 1) {
            finish();
        } else {
            getSupportFragmentManager().popBackStackImmediate();
        }
    }
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:24,代码来源:CheckoutActivity.java

示例2: configureToolbar

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void configureToolbar() {
    super.configureToolbar();
    int stackEntryCount = getChildFragmentManager().getBackStackEntryCount();
    if (stackEntryCount > 0) {
        FragmentManager.BackStackEntry stackEntry = getChildFragmentManager().getBackStackEntryAt(stackEntryCount - 1);
        //Get the name that was supplied to FragmentTransaction.addToBackStack(String) when creating this entry
        String fragmentTab = stackEntry.getName();
        BasicToolbarFragment fragmentByTag = (BasicToolbarFragment) getChildFragmentManager().findFragmentByTag(fragmentTab);
        if (fragmentByTag != null) {
            fragmentByTag.setupToolbar();
        }
    } else {
        setupToolbar();
    }
}
 
开发者ID:Sugarya,项目名称:Closet,代码行数:17,代码来源:BasicToolbarFragment.java

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

示例4: getStackNum

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
     * 获取堆栈淋面的
     *
     * @return
     */
    public void getStackNum() {
        int num = getSupportFragmentManager().getBackStackEntryCount();
        String numString = "++++++++++++++++++++++++++++++++++Fragment回退栈数量:" + num;
        LogUtil.d("Fragment", numString);
        for (int i = 0; i < num; i++) {
            FragmentManager.BackStackEntry backstatck = getSupportFragmentManager().getBackStackEntryAt(i);
//            Log.d("Fragment=name", backstatck.getName());
        }
    }
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:15,代码来源:BActivity.java

示例5: onCreate

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FragmentManager fragmentManager = getFragmentManager();
    if (fragmentManager != null) {
        int backStackEntryCount = fragmentManager.getBackStackEntryCount();
        for (int i = backStackEntryCount - 1; i >= 0; i--) {
            FragmentManager.BackStackEntry entry = fragmentManager.getBackStackEntryAt(i);
            if (getClass().getSimpleName().equals(entry.getName())) {
                mBackStackIndex = i;
                break;
            }
        }
    }
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:16,代码来源:QMUIFragment.java

示例6: onClick

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_exit_yes:

			MainActivity.syncDataFromExitScreen = true;
			
			fragment = new DataFragment();
			bundle = getActivity().getIntent().getExtras();
			fragment.setArguments(bundle);
			
			fragmentTransaction = getActivity().getSupportFragmentManager()
					.beginTransaction();
			fragmentTransaction.replace(R.id.container_fragment, fragment).addToBackStack(ValueHelper.DATA_FRAGMENT).commit();
			
			FragmentManager manager = getActivity().getSupportFragmentManager();
			FragmentManager.BackStackEntry first = manager.getBackStackEntryAt(0);
			manager.popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
			
			break;		
		case R.id.fragment_exit_no:
			getActivity().finish();
			break;					
	}

	
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:31,代码来源:ExitFragment.java


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