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


Java FragmentManager.getBackStackEntryCount方法代码示例

本文整理汇总了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();
    }

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

示例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;
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:27,代码来源:RxSmartLockPasswords.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:18,代码来源:BottomTabActivity.java

示例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;
}
 
开发者ID:pchmn,项目名称:RxSocialAuth,代码行数:27,代码来源:RxFacebookAuth.java

示例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();
    }
}
 
开发者ID:RoRoche,项目名称:AndroidModularReloaded,代码行数:11,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:10,代码来源:TransactionDelegate.java

示例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);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:29,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:17,代码来源:FragmentUtils.java

示例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();
                }
            }
        });
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:28,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:19,代码来源:FragmentUtils.java

示例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;
}
 
开发者ID:oragamihawk,项目名称:OpenOrbitCNCAndroidFrontend,代码行数:11,代码来源:BaseActivity.java

示例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();
}
 
开发者ID:gsantner,项目名称:markor,代码行数:29,代码来源:DocumentActivity.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:HStanN,项目名称:TakeRest,代码行数:11,代码来源:FragmentUtils.java

示例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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:FragmentUtils.java

示例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();
    }
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:11,代码来源:FragmentUtils.java


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