private void inTransaction(@NonNull TransactionBody body) { inTransaction(body, FragmentTransaction::commitNow); }
private void inAsyncTransaction(@NonNull TransactionBody body) { inTransaction(body, FragmentTransaction::commit); }
private void hide(FragmentProvider currentFragment) { final Fragment visibleFragment = fragmentManager.findFragmentByTag(currentFragment.getTag()); if (visibleFragment != null) { inTransaction(transaction -> { showHideHandler.hide(transaction, visibleFragment); return new ArrayList<>(); }); } }
/** * Restore the state of the {@link TabController}. This will show the last visible fragment * before saving the state. * <br> * Make sure you call {@link #save(Bundle)} when saving your instance * state. * * @param savedInstanceState The saved instance state Bundle where the TabController state * wil be obtained from. */ public void restore(@Nullable Bundle savedInstanceState) { if (savedInstanceState != null) { final Bundle controllerState = savedInstanceState.getBundle(BUNDLE_KEY); if (controllerState == null) { throw new IllegalStateException("TabController's bundle not found in savedInstanceState. Did you call TabController::save in onSaveInstanceState(outState)?"); } final List<Fragment> fragments = getFMFragments(); inTransaction(transaction -> { for (Fragment fragment : fragments) { showHideHandler.restore(controllerState, transaction, fragment); } return new ArrayList<>(); }); } }
inTransaction(transaction -> {