本文整理汇总了Java中android.support.v4.app.FragmentManager.getBackStackEntryCount方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentManager.getBackStackEntryCount方法的具体用法?Java FragmentManager.getBackStackEntryCount怎么用?Java FragmentManager.getBackStackEntryCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.FragmentManager
的用法示例。
在下文中一共展示了FragmentManager.getBackStackEntryCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostExecute
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
mSharedPreferences.edit().putBoolean(ValueHelper.TREES_TO_BE_DOWNLOADED_FIRST, false).commit();
updateData();
if (progressDialog != null) {
progressDialog.dismiss();
}
FragmentManager fm = getActivity().getSupportFragmentManager();
for(int entry = 0; entry < fm.getBackStackEntryCount(); entry++){
Log.d("CheckFragmentBackStack", "Found fragment: " + fm.getBackStackEntryAt(entry).getName());
}
if (fm.getBackStackEntryCount() > 1) {
fm.popBackStack();
}
}
示例2: getRxFacebookAuthFragment
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
* Get instance of RxSmartLockPasswordsFragment
*
* @return a RxSmartLockPasswordsFragment
*/
private RxSmartLockPasswordsFragment getRxFacebookAuthFragment(Builder builder) {
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
// prevent fragment manager already executing transaction
int stackCount = fragmentManager.getBackStackEntryCount();
if( fragmentManager.getFragments() != null )
fragmentManager = fragmentManager.getFragments().get( stackCount > 0 ? stackCount-1 : stackCount ).getChildFragmentManager();
RxSmartLockPasswordsFragment rxSmartLockPasswordsFragment = (RxSmartLockPasswordsFragment)
fragmentManager.findFragmentByTag(RxSmartLockPasswordsFragment.TAG);
if (rxSmartLockPasswordsFragment == null) {
rxSmartLockPasswordsFragment = RxSmartLockPasswordsFragment.newInstance(builder);
fragmentManager
.beginTransaction()
.add(rxSmartLockPasswordsFragment, RxSmartLockPasswordsFragment.TAG)
.commit();
fragmentManager.executePendingTransactions();
}
return rxSmartLockPasswordsFragment;
}
示例3: onNavigationItemSelected
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public boolean onNavigationItemSelected(final MenuItem item) {
final FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack(
fragmentManager.getBackStackEntryAt(0).getId(),
FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
for (int i = 0; i < pageIds.length; i++) {
if (pageIds[i] == item.getItemId()) {
container.setCurrentItem(i);
return true;
}
}
return false;
}
示例4: getRxFacebookAuthFragment
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
* Get instance of RxFacebookAuthFragment
*
* @return a RxFacebookAuthFragment
*/
private RxFacebookAuthFragment getRxFacebookAuthFragment(Builder builder) {
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
// prevent fragment manager already executing transaction
int stackCount = fragmentManager.getBackStackEntryCount();
if( fragmentManager.getFragments() != null )
fragmentManager = fragmentManager.getFragments().get( stackCount > 0 ? stackCount-1 : stackCount ).getChildFragmentManager();
RxFacebookAuthFragment rxFacebookAuthFragment = (RxFacebookAuthFragment)
fragmentManager.findFragmentByTag(RxFacebookAuthFragment.TAG);
if (rxFacebookAuthFragment == null) {
rxFacebookAuthFragment = RxFacebookAuthFragment.newInstance(builder);
fragmentManager
.beginTransaction()
.add(rxFacebookAuthFragment, RxFacebookAuthFragment.TAG)
.commit();
fragmentManager.executePendingTransactions();
}
return rxFacebookAuthFragment;
}
示例5: onBackPressed
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
final FragmentManager lFragmentManager = getSupportFragmentManager();
if (lFragmentManager.getBackStackEntryCount() > 0) {
mSharedViewModel.safeTrigger(Events.backPressed);
lFragmentManager.popBackStack();
} else {
super.onBackPressed();
}
}
示例6: back
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
void back(FragmentManager fm) {
fm = checkFragmentManager(fm, null);
if (fm == null) return;
int count = fm.getBackStackEntryCount();
if (count > 0) {
executeDebouncePop(fm);
}
}
示例7: onOptionsItemSelected
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case android.R.id.home:
FragmentManager fm = getSupportFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
} else {
fragmentLoader(setContainerId(), setFragment());
}
return true;
case R.id.system_eq:
Intent intent = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
if (intent.getAction() != null && Helper.isActivityPresent(MainActivity.this, intent)){
intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, musicXService.audioSession());
startActivityForResult(intent, EQ);
}else {
Toast.makeText(this, "No app found to handle equalizer", Toast.LENGTH_SHORT).show();
}
break;
case R.id.play_save_queue:
multiQueuePlay();
break;
}
return super.onOptionsItemSelected(item);
}
示例8: 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();
}
}
示例9: resolveToolbarNavigationIcon
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private void resolveToolbarNavigationIcon() {
if (isNull(mToolbar)) return;
FragmentManager manager = getSupportFragmentManager();
if (manager.getBackStackEntryCount() > 1) {
Drawable backIcon = getFrontFragement() instanceof PhotoPagerFragment ||
getFrontFragement() instanceof GifPagerFragment ?
ContextCompat.getDrawable(this, R.drawable.arrow_left) :
CurrentTheme.getDrawableFromAttribute(this, R.attr.toolbarBackIcon);
mToolbar.setNavigationIcon(backIcon);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
} else {
mToolbar.setNavigationIcon(CurrentTheme.getDrawableFromAttribute(this, R.attr.toolbarDrawerIcon));
mToolbar.setNavigationOnClickListener(v -> {
if (mDrawerLayout.getDrawerLockMode(GravityCompat.START) == DrawerLayout.LOCK_MODE_UNLOCKED) {
NavigationFragment navigationFragment = getNavigationFragment();
if (navigationFragment.isDrawerOpen()) {
navigationFragment.closeDrawer();
} else {
navigationFragment.openDrawer();
}
}
});
}
}
示例10: popAllFragments
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
* Stack all the fragments
*
* @param fragmentManager fragment manager
*/
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();
}
}
示例11: getActiveFragment
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private Fragment getActiveFragment(){
FragmentManager fragmentManager = this.getSupportFragmentManager();
if(fragmentManager.getBackStackEntryCount() > 0){
return fragmentManager
.findFragmentByTag(
fragmentManager.getBackStackEntryAt(fragmentManager.getBackStackEntryCount() - 1)
.getName());
}
return null;
}
示例12: onBackPressed
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
@SuppressWarnings("StatementWithEmptyBody")
public void onBackPressed() {
FragmentManager fragMgr = getSupportFragmentManager();
BaseFragment top = getCurrentVisibleFragment();
if (top != null) {
if (!top.onBackPressed()) {
if (fragMgr.getBackStackEntryCount() == 1) {
// Back action was not handled by fragment, handle in activity
} else if (fragMgr.getBackStackEntryCount() > 0) {
// Back action was to go one fragment back
fragMgr.popBackStack();
return;
}
} else {
// Was handled by child fragment
return;
}
}
if (_toolbarTitleEdit.hasFocus()) {
_toolbarTitleEdit.clearFocus();
return;
}
// Handle in this activity
finish();
}
示例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();
}
}
示例14: popFragments
import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
* 出栈同级别fragment
*
* @param fragmentManager fragment管理器
*/
public static void popFragments(@NonNull final FragmentManager fragmentManager) {
while (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStackImmediate();
}
}
示例15: 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();
}
}