Example usage for android.support.v4.app FragmentManager popBackStack

List of usage examples for android.support.v4.app FragmentManager popBackStack

Introduction

In this page you can find the example usage for android.support.v4.app FragmentManager popBackStack.

Prototype

public abstract void popBackStack();

Source Link

Document

Pop the top state off the back stack.

Usage

From source file:com.commonsware.android.feedfrags.FeedsNavActivity.java

private void removeFragments(FragmentManager fragMgr, FragmentTransaction xaction) {
    ItemsFragment items = (ItemsFragment) fragMgr.findFragmentById(R.id.second_pane);

    if (items != null) {
        xaction.remove(items);/*from   w ww. j ava2s.c  o m*/

        ContentFragment content = (ContentFragment) fragMgr.findFragmentById(R.id.third_pane);

        if (content != null && !content.isRemoving()) {
            xaction.remove(content);
            fragMgr.popBackStack();
        }
    }
}

From source file:org.mklab.mikity.android.editor.AbstractObjectEditor.java

private void createButtonComposite(final View view) {
    final Button backButton = (Button) view.findViewById(R.id.backButton);
    backButton.setOnClickListener(new OnClickListener() {

        /**/* w  w  w  . j ava  2  s .c o m*/
         * {@inheritDoc}
         */
        public void onClick(View v) {
            final FragmentManager manager = getActivity().getSupportFragmentManager();
            manager.popBackStack();
        }
    });

    this.saveButton = (Button) view.findViewById(R.id.saveButton);
    this.saveButton.setOnClickListener(new OnClickListener() {

        /**
         * {@inheritDoc}
         */
        public void onClick(View v) {
            saveParameters();
        }
    });

    this.saveButton.setEnabled(false);
}

From source file:org.mklab.mikity.android.FileSelectionFragment.java

/**
 * {@inheritDoc}//  w w w . ja  v  a  2  s. c o m
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    final View mainView = inflater.inflate(R.layout.fragment_file_selection, container, false);

    final Button backButton = (Button) mainView.findViewById(R.id.settingsBackButton);
    backButton.setOnClickListener(new OnClickListener() {

        /**
         * {@inheritDoc}
         */
        public void onClick(View v) {
            final FragmentManager manager = FileSelectionFragment.this.mainActivity.getSupportFragmentManager();
            manager.popBackStack();
        }
    });

    createModelComponent(mainView);
    createSourceComponent(mainView);

    return mainView;
}

From source file:edu.upenn.tempmaniac.AccountActivityNew.java

private void onPlacePickerDone(PlacePickerFragment fragment) {
    FragmentManager fm = getSupportFragmentManager();
    fm.popBackStack();

    String result = "";

    GraphPlace selection = fragment.getSelection();
    if (selection != null) {
        currentPlace = selection.getName();
        result = selection.getName();/*from  w w  w  .j  a v a2s.c  om*/
    } else {

        result = getString(R.string.no_place_selected);
    }

    showAlert(getString(R.string.you_picked), result);
}

From source file:com.twolinessoftware.activities.BaseActivity.java

@Override
public void onBackPressed() {

    FragmentManager fm = getSupportFragmentManager();
    if (fm.getBackStackEntryCount() > 0) {

        boolean consume = false;
        if (getCurrentFragment() != null) {
            consume = getCurrentFragment().onBackPressed();
        }/*from w  ww . j  a  v a 2  s.  co  m*/

        if (!consume) {
            fm.popBackStack();
        }
    } else {
        super.onBackPressed();
    }
}

From source file:org.mklab.mikity.android.SettingsFragment.java

/**
 * {@inheritDoc}/*  w w  w.  j av  a  2  s.  c om*/
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    this.view = inflater.inflate(R.layout.fragment_settings, container, false);

    final Button backButton = (Button) this.view.findViewById(R.id.settingsBackButton);
    backButton.setOnClickListener(new OnClickListener() {

        /**
         * {@inheritDoc}
         */
        public void onClick(View v) {
            final FragmentManager manager = getActivity().getSupportFragmentManager();
            manager.popBackStack();
        }
    });

    return this.view;
}

From source file:com.androzic.route.RouteDetails.java

@Override
public boolean onMenuItemSelected(MenuBuilder builder, MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_view:
        route.show = true;/*  w  w  w  . j  av  a 2s . c  o m*/
        waypointActionsCallback.onWaypointView(route.getWaypoint(selectedKey));
        //TODO Sometimes we have to close it manually, sometimes not. Should investigate it.
        FragmentManager fm = getFragmentManager();
        if (fm != null)
            fm.popBackStack();
        return true;
    case R.id.action_navigate:
        if (navigation) {
            if (application.navigationService.navDirection == NavigationService.DIRECTION_REVERSE)
                selectedKey = route.length() - selectedKey - 1;
            application.navigationService.setRouteWaypoint(selectedKey);
            adapter.notifyDataSetChanged();
        }
        return true;
    case R.id.action_edit:
        routeActionsCallback.onRouteWaypointEdit(route, route.getWaypoint(selectedKey));
        return true;
    }
    return false;
}

From source file:com.robwilliamson.healthyesther.fragment.edit.EditScoreEventGroupFragment.java

public void clearScoreFragments() {
    FragmentManager manager = getFragmentManager();
    FragmentTransaction fragmentTransaction = manager.beginTransaction();
    for (Fragment fragment : getEditScoreEventFragments()) {
        fragmentTransaction.remove(fragment);
    }/*w ww  .j av  a  2s  .  c  o m*/
    fragmentTransaction.remove(getAddValueFragment());
    fragmentTransaction.commit();
    manager.popBackStack();
}

From source file:nu.firetech.android.pactrack.frontend.MainActivity.java

@Override
public void onCurrentParcelRemoved() {
    FragmentManager manager = getSupportFragmentManager();

    if (manager.findFragmentById(R.id.details_frag) != null) {
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.remove(manager.findFragmentById(R.id.details_frag));
        transaction.commit();/*from w w w. ja  v a 2  s .  c om*/
    } else if (manager.getBackStackEntryCount() > 0) {
        manager.popBackStack();
    }

    if (manager.findFragmentById(R.id.list_frag) != null) {
        ParcelListFragment list = (ParcelListFragment) getSupportFragmentManager()
                .findFragmentById(R.id.list_frag);
        list.selectRowItem(null);
        list.refreshDone();
    }
}

From source file:prince.app.sphotos.FBMainActivity.java

private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (mResumed) {
        FragmentManager manager = getSupportFragmentManager();
        int backStackSize = manager.getBackStackEntryCount();
        for (int i = 0; i < backStackSize; i++) {
            manager.popBackStack();
        }/*from w w  w  . j  a v  a 2 s  .  c o  m*/
        // check for the OPENED state instead of session.isOpened() since for the
        // OPENED_TOKEN_UPDATED state, the selection fragment should already be showing.
        if (state.equals(SessionState.OPENED)) {
            showFragment(MAIN, false);

            // obtain album for the new user
            fetchAlbums();

        } else if (state.isClosed()) {
            mLogOutWasVisible = false; // we no longer need to show the logOut screen
            showFragment(LOGIN, false);
        }
    }
}