Example usage for android.app FragmentTransaction remove

List of usage examples for android.app FragmentTransaction remove

Introduction

In this page you can find the example usage for android.app FragmentTransaction remove.

Prototype

public abstract FragmentTransaction remove(Fragment fragment);

Source Link

Document

Remove an existing fragment.

Usage

From source file:it.angrydroids.epub3reader.MainActivity.java

public void removePanel(SplitPanel p) {
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    fragmentTransaction.remove(p);
    fragmentTransaction.commit();/*from  w w  w .  j  a  v a  2s  .  c  o  m*/

    panelCount--;
    if (panelCount <= 0)
        finish();
}

From source file:no.digipost.android.gui.MainContentActivity.java

private void showCreateEditDialog(int content, boolean editFolder) {

    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(EditFolderFragment.fragmentName);
    if (prev != null) {
        ft.remove(prev);
    }//from w  ww. ja v a 2  s.  c o m
    ft.addToBackStack(null);
    DialogFragment editFolderFragment = EditFolderFragment.newInstance(content,
            account.getValidationRules().getFolderName(), editFolder);
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    editFolderFragment.show(ft, EditFolderFragment.fragmentName);
}

From source file:com.hit.jj.mapshow.RoutingActivity.java

@Override
public void onDialogRouteClicked(Point p1, Point p2) {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.remove(fm.findFragmentByTag("Dialog")).commit();

    pathfind(p1, p2);/*from   ww w. j a  v a 2 s.com*/

}

From source file:com.hit.jj.mapshow.RoutingActivity.java

@Override
public void onDialogRouteClicked(Point p) {
    //        Point s1 = new Point(26.0734997,119.3150024);
    Point s1 = new Point(26.1023006, 119.2789993);
    Point s2 = new Point(mLocation.getY(), mLocation.getX());
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.remove(fm.findFragmentByTag("SpeakDialog")).commit();
    pathfind(s2, p);//
    //pathfind(s1, p);//
}

From source file:com.hit.jj.mapshow.RoutingActivity.java

@Override
public void onSegmentSelected(String id) {

    if (id == null)
        return;/*w w w . ja va2s . c  om*/
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.remove(fm.findFragmentByTag("Nav Drawer")).commit();
    clearAll();
    // Look for the graphic that corresponds to this direction
    removeRoad(mPaths, id);
    new Handler().post(new Runnable() {
        @Override
        public void run() {
            updateUI();
        }
    });
}

From source file:com.hit.jj.mapshow.RoutingActivity.java

/**
 * Clear the graphics and empty the directions list
 *//* w  w  w . j  a  v a  2 s  .co m*/
public void clearAll() {
    mFeatureLayer.removeAll();
    //Removing the graphics from the layer
    routeLayer.removeAll();
    hiddenSegmentsLayer.removeAll();

    curDirections = new ArrayList<String>();
    mResults = null;
    curRoute = null;

    //Setting to default text
    directionsLabel.setText(getString(R.string.route_label));

    //Locking the Drawer
    mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

    //Removing the cancel icon
    img_cancel.setVisibility(View.GONE);

    //Removing the RoutingListFragment if present
    FragmentManager fm = getFragmentManager();
    if (fm.findFragmentByTag("Nav Drawer") != null) {
        FragmentTransaction ft = fm.beginTransaction();
        ft.remove(fm.findFragmentByTag("Nav Drawer"));
        ft.commit();
    }

}

From source file:com.google.cloud.solutions.cloudadventure.GameActivity.java

/**
 * This method is called when the Activity receives a message via {@link BroadcastRecevier} that
 * the game has started./*w w w  .  ja v a2  s.  c o m*/
 */
private void onGameStart() {
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.remove(mPreGameFragment);
    fragmentTransaction.commit();
    progressDialog.dismiss();

    // Set the starting point for fragments
    mNavFragment.setNewDirectionMapper(Cardinal.valueOf(mPlayer.getOrientation()));
    mNavFragment.setCurrentTile(mPlayer.getCurrentTile());
}

From source file:org.akvo.caddisfly.ui.activity.MainActivity.java

public void onAbout() {
    AboutFragment aboutFragment = AboutFragment.newInstance();
    final FragmentTransaction ft = getFragmentManager().beginTransaction();

    Fragment prev = getFragmentManager().findFragmentByTag("aboutDialog");
    if (prev != null) {
        ft.remove(prev);
    }//from ww w.  ja va 2 s.  com
    aboutFragment.show(ft, "aboutDialog");

}

From source file:org.akvo.caddisfly.sensor.colorimetry.liquid.ColorimetryLiquidActivity.java

/**
 * In diagnostic mode show the diagnostic results dialog.
 *
 * @param testFailed    if test has failed then dialog knows to show the retry button
 * @param result        the result shown to the user
 * @param color         the color that was used to get above result
 * @param isCalibration is it in calibration mode, then show only colors, no results
 *//*from   www .ja  v  a 2 s . c o  m*/
private void showDiagnosticResultDialog(boolean testFailed, String result, int color, boolean isCalibration) {
    mResultFragment = DiagnosticResultDialog.newInstance(mResults, testFailed, result, color, isCalibration);
    final FragmentTransaction ft = getFragmentManager().beginTransaction();

    Fragment prev = getFragmentManager().findFragmentByTag("gridDialog");
    if (prev != null) {
        ft.remove(prev);
    }
    mResultFragment.setCancelable(false);
    mResultFragment.show(ft, "gridDialog");
}

From source file:com.android.mail.browse.ConversationPagerAdapter.java

/**
 * Part of an inelegant dance to clean up restored fragments after realizing
 * we don't want the ViewPager around after all in 2-pane. See docs for
 * {@link ConversationPagerController#killRestoredFragments()} and
 * {@link TwoPaneController#restoreConversation}.
 *//* w w w.j  a v  a2s . c  o m*/
public void killRestoredFragments() {
    if (mRestoredState == null) {
        return;
    }

    FragmentTransaction ft = null;
    for (String key : mRestoredState.keySet()) {
        // WARNING: this code assumes implementation details in
        // FragmentStatePagerAdapter2#restoreState
        if (!key.startsWith(BUNDLE_FRAGMENT_PREFIX)) {
            continue;
        }
        final Fragment f = mFragmentManager.getFragment(mRestoredState, key);
        if (f != null) {
            if (ft == null) {
                ft = mFragmentManager.beginTransaction();
            }
            ft.remove(f);
        }
    }
    if (ft != null) {
        ft.commitAllowingStateLoss();
        mFragmentManager.executePendingTransactions();
    }
    mRestoredState = null;
}