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


Java BackStackEntry类代码示例

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


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

示例1: getCurrentFragment

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
public Fragment getCurrentFragment()
{
	final int backStackEntryCount = getSupportFragmentManager().getBackStackEntryCount();
    if (backStackEntryCount > 0)
    {
		try
        {
            final BackStackEntry backStackEntryAt = getSupportFragmentManager().getBackStackEntryAt(backStackEntryCount - 1);
            String fragmentTag = backStackEntryAt.getName();
            Fragment currentFragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
            return currentFragment;
        }
        catch (Exception e)
        {
            // fix possible race condition:
            // when called in background thread - back stack could be different between call of
            // getBackStackEntryCount() and getBackStackEntryAt()
            e.printStackTrace();
        }
	}
	
	return getSupportFragmentManager().findFragmentByTag(AppConstants.PAGE_TITLE_MAIN);
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:24,代码来源:RMBTMainActivity.java

示例2: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackStackChanged() {
    if (getFragmentManager() == null) {
        Log.w(TAG, "getFragmentManager() is null, stack:", new Exception());
        return;
    }
    int count = getFragmentManager().getBackStackEntryCount();
    // if backstack is growing and last pushed entry is "headers" backstack,
    // remember the index of the entry.
    if (count > mLastEntryCount) {
        BackStackEntry entry = getFragmentManager().getBackStackEntryAt(count - 1);
        if (mWithHeadersBackStackName.equals(entry.getName())) {
            mIndexOfHeadersBackStack = count - 1;
        }
    } else if (count < mLastEntryCount) {
        // if popped "headers" backstack, initiate the show header transition if needed
        if (mIndexOfHeadersBackStack >= count) {
            mIndexOfHeadersBackStack = -1;
            if (!mShowingHeaders) {
                startHeadersTransitionInternal(true);
            }
        }
    }
    mLastEntryCount = count;
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:26,代码来源:BrowseSupportFragment.java

示例3: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onBackStackChanged() {

    int count = mFragmentManager.getBackStackEntryCount();
    if (count > 0) {
        BackStackEntry fragment = mFragmentManager
                .getBackStackEntryAt(count - 1);
        mPath = fragment.getName();
    } else {
        mPath = EXTERNAL_BASE_PATH;
    }

    setTitle(mPath);
    if (HAS_ACTIONBAR)
        invalidateOptionsMenu();
}
 
开发者ID:qiniudemo,项目名称:qiniu-lab-android,代码行数:18,代码来源:FileChooserActivity.java

示例4: onClick

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onClick(View v) {
    if (v.getTag() instanceof BackStackEntry) {
        BackStackEntry bse = (BackStackEntry) v.getTag();
        if (bse == mParentEntry) {
            if (mParentClickListener != null) {
                mParentClickListener.onClick(v);
            }
        } else {
            if (mOnBreadCrumbClickListener != null) {
                if (mOnBreadCrumbClickListener.onBreadCrumbClick(
                        bse == mTopEntry ? null : bse, 0)) {
                    return;
                }
            }
            if (bse == mTopEntry) {
                mActivity.getSupportFragmentManager().popBackStack();
            } else {
                mActivity.getSupportFragmentManager().popBackStack(
                        bse.getId(), 0);
            }
        }
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:25,代码来源:FragmentBreadCrumbs.java

示例5: getTopFragment

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
/**
 * Get latest attached fragment from {@link FragmentManager}
 * @return Latest attached Fragment
 */
public Fragment getTopFragment() {
    FragmentManager fragMgr = getSupportFragmentManager();
    if (fragMgr.getBackStackEntryCount() == 0) {
        return null;
    }
    FragmentManager.BackStackEntry backEntry = fragMgr.getBackStackEntryAt(fragMgr.getBackStackEntryCount() - 1);
    String backEntryName = backEntry.getName();
    return fragMgr.findFragmentByTag(backEntryName);
}
 
开发者ID:vinexs,项目名称:extend-enhance-base,代码行数:14,代码来源:BaseActivity.java

示例6: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackStackChanged() {

    int count = mFragmentManager.getBackStackEntryCount();
    if (count > 0) {
        BackStackEntry fragment = mFragmentManager.getBackStackEntryAt(count - 1);
        mPath = fragment.getName();
    } else {
        mPath = EXTERNAL_BASE_PATH;
    }

    setTitle(mPath);
    if (HAS_ACTIONBAR)
        invalidateOptionsMenu();
}
 
开发者ID:dc914337,项目名称:PSD-Android-App,代码行数:16,代码来源:FileChooserActivity.java

示例7: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
public void onBackStackChanged() {
    path = EXTERNAL_BASE_PATH;
    int count = fragmentManager.getBackStackEntryCount();
    if (count > 0) {
        BackStackEntry fragment = fragmentManager.getBackStackEntryAt(count - 1);
        path = fragment.getName();
    }
    setTitle(path);
}
 
开发者ID:4thline,项目名称:feeds,代码行数:10,代码来源:FileChooserActivity.java

示例8: startHeadersTransitionInternal

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
private void startHeadersTransitionInternal(final boolean withHeaders) {
    if (getFragmentManager().isDestroyed()) {
        return;
    }
    mShowingHeaders = withHeaders;
    mRowsSupportFragment.onExpandTransitionStart(!withHeaders, new Runnable() {
        @Override
        public void run() {
            mHeadersSupportFragment.onTransitionStart();
            createHeadersTransition();
            if (mBrowseTransitionListener != null) {
                mBrowseTransitionListener.onHeadersTransitionStart(withHeaders);
            }
            sTransitionHelper.runTransition(withHeaders ? mSceneWithHeaders : mSceneWithoutHeaders,
                    mHeadersTransition);
            if (mHeadersBackStackEnabled) {
                if (!withHeaders) {
                    getFragmentManager().beginTransaction()
                            .addToBackStack(mWithHeadersBackStackName).commit();
                } else {
                    int index = mBackStackChangedListener.mIndexOfHeadersBackStack;
                    if (index >= 0) {
                        BackStackEntry entry = getFragmentManager().getBackStackEntryAt(index);
                        getFragmentManager().popBackStackImmediate(entry.getId(),
                                FragmentManager.POP_BACK_STACK_INCLUSIVE);
                    }
                }
            }
        }
    });
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:32,代码来源:BrowseSupportFragment.java

示例9: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackStackChanged() {

	int count = mFragmentManager.getBackStackEntryCount();
	if (count > 0) {
		BackStackEntry fragment = mFragmentManager
				.getBackStackEntryAt(count - 1);
		mPath = fragment.getName();
	} else {
		mPath = EXTERNAL_BASE_PATH;
	}

	setTitle(mPath);
	supportInvalidateOptionsMenu();
}
 
开发者ID:vishalvijay,项目名称:vtu-life-android,代码行数:16,代码来源:FileChooserActivity.java

示例10: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackStackChanged() {

    int count = mFragmentManager.getBackStackEntryCount();
    if (count > 0) {
        BackStackEntry fragment = mFragmentManager.getBackStackEntryAt(count - 1);
        mPath = fragment.getName();
    } else {
        mPath = EXTERNAL_BASE_PATH;
    }

    setTitle(mPath);
    if (HAS_ACTIONBAR)
        supportInvalidateOptionsMenu();
}
 
开发者ID:SecrecySupportTeam,项目名称:Secrecy_fDroid_DEPRECIATED,代码行数:16,代码来源:FileChooserActivity.java

示例11: createBackStackEntry

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
private BackStackEntry createBackStackEntry(final CharSequence title,
                                            final CharSequence shortTitle) {
    if (title == null) {
        return null;
    }
    return new BackStackEntry() {
        @Override
        public CharSequence getBreadCrumbShortTitle() {
            return shortTitle;
        }

        @Override
        public int getBreadCrumbShortTitleRes() {
            return 0;
        }

        @Override
        public CharSequence getBreadCrumbTitle() {
            return title;
        }

        @Override
        public int getBreadCrumbTitleRes() {
            return 0;
        }

        @Override
        public int getId() {
            return 2837452;
        }

        @Override
        public String getName() {
            return "backstackentry";
        }
    };
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:38,代码来源:FragmentBreadCrumbs.java

示例12: getPreEntry

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
private BackStackEntry getPreEntry(int index) {
    if (mParentEntry != null) {
        return index == 0 ? mParentEntry : mTopEntry;
    } else {
        return mTopEntry;
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:8,代码来源:FragmentBreadCrumbs.java

示例13: onBackPressed

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackPressed() {
	FragmentManager mgr = getSupportFragmentManager();
	 int idxLast = mgr.getBackStackEntryCount() - 2;
	 if(idxLast < 0) {
		 this.setResult(RESULT_OK); 
	     finish();
	 } else {
		 BackStackEntry entry = mgr.getBackStackEntryAt(idxLast);
		 swapToFragmentView(ScreenList.valueOf(entry.getName()));
	 }
}
 
开发者ID:jackvt93,项目名称:Open-Battery-Saver,代码行数:13,代码来源:MainActivity.java

示例14: createBackStackEntry

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
private BackStackEntry createBackStackEntry(final CharSequence title,
        final CharSequence shortTitle) {
    if (title == null) {
        return null;
    }
    return new BackStackEntry() {
        @Override
        public CharSequence getBreadCrumbShortTitle() {
            return shortTitle;
        }

        @Override
        public int getBreadCrumbShortTitleRes() {
            return 0;
        }

        @Override
        public CharSequence getBreadCrumbTitle() {
            return title;
        }

        @Override
        public int getBreadCrumbTitleRes() {
            return 0;
        }

        @Override
        public int getId() {
            return 2837452;
        }

        @Override
        public String getName() {
            return "backstackentry";
        }
    };
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:38,代码来源:FragmentBreadCrumbs.java

示例15: onBackStackChanged

import android.support.v4.app.FragmentManager.BackStackEntry; //导入依赖的package包/类
@Override
public void onBackStackChanged() {
	mPath = EXTERNAL_BASE_PATH;
	
	int count = mFragmentManager.getBackStackEntryCount();
	if (count > 0) {
		BackStackEntry fragment = mFragmentManager
				.getBackStackEntryAt(count - 1);
		mPath = fragment.getName();
	}
	
	setTitle(mPath);
}
 
开发者ID:jcuenod,项目名称:brainrot,代码行数:14,代码来源:FileChooserActivity.java


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