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


Java FragmentManager.popBackStack方法代码示例

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


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

示例1: executeDebouncePop

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private void executeDebouncePop(FragmentManager fm) {
    Fragment popF = fm.findFragmentByTag(fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName());
    if (popF instanceof ISupportFragment) {
        ISupportFragment supportF = (ISupportFragment) popF;
        if (supportF.getSupportDelegate().mIsSharedElement) {
            long now = System.currentTimeMillis();
            if (now < mShareElementDebounceTime) {
                mShareElementDebounceTime = System.currentTimeMillis() + supportF.getSupportDelegate().mAnimHelper.exitAnim.getDuration();
                return;
            }
        }
        mShareElementDebounceTime = System.currentTimeMillis() + supportF.getSupportDelegate().mAnimHelper.exitAnim.getDuration();
    }

    fm.popBackStack();
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:17,代码来源:TransactionDelegate.java

示例2: switchToMainFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void switchToMainFragment(RxResponse<AppData> response){
    if(response.status == RxStatus.SUCCESS) {
        MainFragment mainFragment = new MainFragment();

        if(getActivity() == null){
            Log.wtf(CLASS_TAG, "Unable to get Activity");
            return;
        }

        FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
        fragmentManager.popBackStack();
        fragmentManager.beginTransaction()
                .setCustomAnimations(R.anim.fragment_fade_in, R.anim.fragment_fade_out)
                .addToBackStack(null)
                .replace(R.id.fragmentLayout, mainFragment)
                .commit();
    }
    else {
        Log.wtf(CLASS_TAG, "Unable to get repo data, fallback to login");
        switchToLoginFragment();
    }
}
 
开发者ID:jakdor,项目名称:LabDayApp,代码行数:23,代码来源:SplashFragment.java

示例3: switchToLoginFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void switchToLoginFragment(){
    LoginFragment loginFragment = new LoginFragment();

    if(getActivity() == null){
        Log.wtf(CLASS_TAG, "Unable to get Activity");
        return;
    }

    FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
    fragmentManager.popBackStack();
    fragmentManager.beginTransaction()
            .setCustomAnimations(R.anim.fragment_fade_in, R.anim.fragment_fade_out)
            .addToBackStack(null)
            .replace(R.id.fragmentLayout, loginFragment)
            .commit();
}
 
开发者ID:jakdor,项目名称:LabDayApp,代码行数:17,代码来源:SplashFragment.java

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

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

示例6: clearBackStack

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
protected void clearBackStack() {
    FragmentManager fm = getSupportFragmentManager();
    final int backStackEntryCount = fm.getBackStackEntryCount();
    for (int i = 0; i < backStackEntryCount; ++i) {
        fm.popBackStack();
    }
}
 
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:8,代码来源:BaseFragmentActivity.java

示例7: switchToFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private void switchToFragment(int itemIid, Fragment fragment, String tag) {
    currentItem = itemIid;
    setSelectDateButtonVisible(fragment instanceof ProgramsTabsFragment);
    FragmentManager fm = getSupportFragmentManager();
    fm.popBackStack();
    fm.beginTransaction().replace(R.id.frame_container, fragment, tag).commit();
}
 
开发者ID:graviton57,项目名称:TVGuide,代码行数:8,代码来源:MainActivity.java

示例8: clearBackStack

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
private void clearBackStack() {
    FragmentManager manager = getSupportFragmentManager();
    /*if (manager.getBackStackEntryCount() > 0) {
        FragmentManager.BackStackEntry first = manager.getBackStackEntryAt(0);
        manager.popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }*/

    manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);

    // TODO: 13.12.2017 Exception java.lang.IllegalStateException:Can not perform this action after onSaveInstanceState
    Logger.d(TAG, "Back stack was cleared");
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:13,代码来源:MainActivity.java

示例9: onSupportNavigateUp

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public boolean onSupportNavigateUp() {
  FragmentManager fragmentManager = getSupportFragmentManager();
  if (fragmentManager.getBackStackEntryCount() > 0) {
    fragmentManager.popBackStack();
  } else {
    Intent intent = new Intent(this, ConversationListActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);
    finish();
  }
  return true;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:14,代码来源:ApplicationPreferencesActivity.java

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

示例11: popBackStackToTopWithFragment

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public Fragment popBackStackToTopWithFragment() {
    final FragmentManager fm = getSupportFragmentManager();
    fm.popBackStack();
    List<Fragment> fragments = fm.getFragments();
    if (fragments == null
            || fragments.size() == 0
            || fm.getBackStackEntryCount() == 0) {
        return null;
    }
    return fragments.get(fm.getBackStackEntryCount() - 1);
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:12,代码来源:BaseFragmentActivity.java

示例12: skjulMenu

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
public void vælgMenu(FragmentActivity akt, int position) {
  //new Exception().printStackTrace();
  MenuElement e = elem.get(position);
  skjulMenu();
  if (e.runnable != null) {
    e.runnable.run();
    sætListemarkering(-1); // Ingen listemarkering
    return;
  }

  sætListemarkering(position);

  try {
    FragmentManager fm = akt.getSupportFragmentManager();
    // Fjern backstak - så vi starter forfra i 'roden'
    fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    Log.d("Venstremenu viser " + e.fragKlasse);
    Basisfragment f = e.fragKlasse.newInstance();
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.indhold_frag, f);
    ft.addToBackStack("Venstremenu");
    ft.commit();
    Sidevisning.vist(f.getClass());
  } catch (Exception e1) {
    Log.rapporterFejl(e1);
  }
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:28,代码来源:Venstremenu_frag.java

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

示例14: onCreateView

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  Log.d("onCreateView " + this);

  View rod = inflater.inflate(R.layout.udsendelser_vandret_skift_frag, container, false);

  kanal = App.grunddata.kanalFraKode.get(getArguments().getString(P_KANALKODE));
  startudsendelse = App.data.udsendelseFraSlug.get(getArguments().getString(P_UDSENDELSE));
  if (startudsendelse == null) { // Fix for https://www.bugsense.com/dashboard/project/cd78aa05/errors/805598045
    if (!App.PRODUKTION) { // https://www.bugsense.com/dashboard/project/cd78aa05/errors/822628124
      App.langToast("startudsendelse==null for " + kanal);
    }
    Log.e(new IllegalStateException("startudsendelse==null"));
    // Fjern backstak og hop ud
    FragmentManager fm = getActivity().getSupportFragmentManager();
    fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.indhold_frag, new Kanaler_frag());
    ft.addToBackStack(null);
    ft.commit();
    return rod;
  }
  Log.d("onCreateView " + this + " viser " + " / " + startudsendelse);


  viewPager = (ViewPager) rod.findViewById(R.id.pager);
  //noinspection ResourceType
  viewPager.setId(123); // TODO hvorfor? fjern eller forklar hvorfor R.id.pager ikke er god nok
  pager_title_strip = rod.findViewById(R.id.pager_title_strip);
  // Da ViewPager er indlejret i et fragment skal adapteren virke på den indlejrede (child)
  // fragmentmanageren - ikke på aktivitens (getFragmentManager)
  adapter = new UdsendelserAdapter(getChildFragmentManager());
  Datoformater.opdateriDagIMorgenIGårDatoStr(App.serverCurrentTimeMillis());

  udsendelser = new ArrayList<Udsendelse>();
  udsendelser.add(startudsendelse);
  adapter.setListe(udsendelser);
  viewPager.setAdapter(adapter);
  hentUdsendelser(0);

  vispager_title_strip();
  viewPager.setOnPageChangeListener(this);
  // Nødvendigt fordi underfragmenter har optionsmenu
  // - ellers nulstilles optionsmenuen ikke når man hopper ud igen!
  setHasOptionsMenu(true);
  return rod;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:48,代码来源:Udsendelser_vandret_skift_frag.java

示例15: clear

import android.support.v4.app.FragmentManager; //导入方法依赖的package包/类
/**
 * Return to original state.
 * Removes all fragments except for the last one, displaying books.
 */
public static void clear(FragmentManager fragmentManager) {
    /* Clear the back stack. */
    fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:9,代码来源:DisplayManager.java


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