Java Code Examples for android.support.v4.app.FragmentTransaction#disallowAddToBackStack()

The following examples show how to use android.support.v4.app.FragmentTransaction#disallowAddToBackStack() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChallengeActivity.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Loads the current challenge into its fragment depending on the challenge-type
 */
private void loadChallenge() {
    //Bundle to transfer the ChallengeId to the fragments
    Bundle fragmentArguments = new Bundle();
    fragmentArguments.putLong(KEY_CHALLENGE_ID, mCurrentChallenge.getId());

    //Start a transaction on the fragments
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.disallowAddToBackStack();

    mQuestionText.setText(mCurrentChallenge.getQuestion());

    AnswerFragment fragment = mAnswerFragmentFactory.createFragmentForType(mCurrentChallenge.getChallengeType());
    fragment.setArguments(fragmentArguments);
    transaction.replace(R.id.challenge_fragment, fragment, "" + mCurrentChallenge.getChallengeType());

    //Commit the changes
    transaction.commit();
    getSupportFragmentManager().executePendingTransactions();

    // Load new meta data
    initializeMetaData();
}
 
Example 2
Source File: FragmentNavigationActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void initializeNavigationViewFragment(@Nullable Bundle savedInstanceState) {
  FragmentManager fragmentManager = getSupportFragmentManager();
  if (savedInstanceState == null) {
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.disallowAddToBackStack();
    transaction.add(R.id.navigation_fragment_frame, new NavigationFragment()).commit();
  }
}
 
Example 3
Source File: FragmentNavigationActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void replaceFragment(Fragment newFragment) {
  String tag = String.valueOf(newFragment.getId());
  FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
  transaction.disallowAddToBackStack();
  transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
  int fadeInAnimId = android.support.v7.appcompat.R.anim.abc_fade_in;
  int fadeOutAnimId = android.support.v7.appcompat.R.anim.abc_fade_out;
  transaction.setCustomAnimations(fadeInAnimId, fadeOutAnimId, fadeInAnimId, fadeOutAnimId);
  transaction.replace(R.id.navigation_fragment_frame, newFragment, tag);
  transaction.commit();
}
 
Example 4
Source File: ContractLoaderFragment.java    From tron-wallet-android with Apache License 2.0 4 votes vote down vote up
private void loadContractFragment(@NonNull Protocol.Transaction.Contract contract) {
    final FragmentTransaction transaction = getFragmentManager().beginTransaction();
    ContractFragment fragment = null;

    switch (contract.getType()) {
        case AccountCreateContract:
            break;
        case TransferContract:
            fragment = TransferContractFragment.newInstance();
            break;
        case TransferAssetContract:
            fragment = TransferAssetContractFragment.newInstance();
            break;
        case VoteAssetContract:
            break;
        case VoteWitnessContract:
            fragment = VoteWitnessContractFragment.newInstance();
            break;
        case WitnessCreateContract:
            break;
        case AssetIssueContract:
            fragment = AssetIssueContractFragment.newInstance();
            break;
        case WitnessUpdateContract:
            break;
        case ParticipateAssetIssueContract:
            fragment = ParticipateAssetIssueContractFragment.newInstance();
            break;
        case AccountUpdateContract:
            fragment = AccountUpdateContractFragment.newInstance();
            break;
        case FreezeBalanceContract:
            fragment = FreezeContractFragment.newInstance();
            break;
        case UnfreezeBalanceContract:
            break;
        case WithdrawBalanceContract:
            break;
        case UnfreezeAssetContract:
            break;
        case UpdateAssetContract:
            break;
        case CustomContract:
            break;
        case UNRECOGNIZED:
            break;
    }
    if(fragment != null) {
        fragment.setContract(contract);
        transaction.replace(R.id.Contract_frameLayout, fragment);
        transaction.disallowAddToBackStack();
        transaction.commit();
    }
}