Example usage for android.app FragmentTransaction replace

List of usage examples for android.app FragmentTransaction replace

Introduction

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

Prototype

public abstract FragmentTransaction replace(@IdRes int containerViewId, Fragment fragment, String tag);

Source Link

Document

Replace an existing fragment that was added to a container.

Usage

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showNdtCheck() {
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.fragment_content, RMBTCheckFragment.newInstance(CheckType.NDT),
            AppConstants.PAGE_TITLE_NDT_CHECK);
    ft.addToBackStack(AppConstants.PAGE_TITLE_NDT_CHECK);
    ft.commit();//  w  ww  .j  ava 2s  . c om
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showTermsCheck() {
    popBackStackFull();//from w w  w .  j  a v a 2  s  .  c o m

    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.fragment_content, RMBTTermsCheckFragment.getInstance(null),
            AppConstants.PAGE_TITLE_TERMS_CHECK);
    ft.commit();
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

/**
 * information commissioner check//from w  w w .  j  a  va  2 s  .  c  om
 */
public void showIcCheck() {
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.fragment_content, RMBTCheckFragment.newInstance(CheckType.INFORMATION_COMMISSIONER),
            AppConstants.PAGE_TITLE_CHECK_INFORMATION_COMMISSIONER);
    ft.addToBackStack(AppConstants.PAGE_TITLE_CHECK_INFORMATION_COMMISSIONER);
    ft.commit();
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showAbout() {
    popBackStackFull();/*from w w  w .  j av a 2  s .c  o m*/

    FragmentTransaction ft;
    ft = fm.beginTransaction();

    ft.replace(R.id.fragment_content, new RMBTAboutFragment(), AppConstants.PAGE_TITLE_ABOUT);
    ft.addToBackStack(AppConstants.PAGE_TITLE_ABOUT);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

    ft.commit();
    refreshActionBar(AppConstants.PAGE_TITLE_ABOUT);
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

/**
 * /*from   w w  w.jav  a  2  s  .c  o m*/
 * @param popStack
 */
public void showHistory(final boolean popStack) {
    popBackStackFull();

    FragmentTransaction ft;
    ft = fm.beginTransaction();

    ft.replace(R.id.fragment_content, new RMBTHistoryFragment(), AppConstants.PAGE_TITLE_HISTORY);
    ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    if (popStack) {
        fm.popBackStack();
    }

    ft.commit();

    refreshActionBar(AppConstants.PAGE_TITLE_HISTORY);
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

/**
 * /*from ww w .  j  a va2 s  .com*/
 * @param itemList
 * @param pos
 */
public void showHistoryPager(final int pos) {
    if (historyStorageList != null) {
        //            final RMBTHistoryPagerFragment fragment = new RMBTHistoryPagerFragment();

        final Bundle args = new Bundle();

        final RMBTResultPagerFragment fragment = new RMBTResultPagerFragment();
        String testUuid = historyStorageList.get(pos).get("test_uuid");
        //testUuid = "842356d7-a863-48f9-8220-678125fb3a76";
        //testUuid = "0d765559-ab16-4fa1-b776-4040e18bf134";
        //testUuid = "dbf47f08-711f-4cfa-9fd9-78f06a7a7df3";
        args.putString(RMBTResultPagerFragment.ARG_TEST_UUID, testUuid);
        fragment.setArguments(args);

        final FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_PAGER);
        ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_PAGER);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        ft.commit();

        refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_PAGER);
    }
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showResultsAfterTest(String testUuid) {
    popBackStackFull();//www  .  ja  v a2s . co m

    final RMBTResultPagerFragment fragment = new RMBTResultPagerFragment();
    final Bundle args = new Bundle();
    args.putString(RMBTResultPagerFragment.ARG_TEST_UUID, testUuid);
    fragment.setArguments(args);

    final FragmentManager fm = getFragmentManager();
    final FragmentTransaction ft;
    ft = fm.beginTransaction();
    ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_PAGER);
    ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_PAGER);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.commit();

    refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_PAGER);
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void initApp(boolean duringCreate) {
    //check log directory and send log files to control server if available
    checkLogs(getApplicationContext(), new OnCompleteListener() {

        @Override//w  w w.j  a  v a 2 s . com
        public void onComplete(int flag, Object object) {
            //after log check: redirect system output to file if option is set
            redirectSystemOutput(ConfigHelper.isSystemOutputRedirectedToFile(RMBTMainActivity.this));
        }
    });

    popBackStackFull();

    FragmentTransaction ft;
    ft = fm.beginTransaction();
    ft.replace(R.id.fragment_content, new RMBTMainMenuFragment(), AppConstants.PAGE_TITLE_MAIN);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.commit();

    checkNews(getApplicationContext());
    checkSettings(false, null);
    //checkIp();
    waitForSettings(true, false, false);
    fetchMapOptions();
    historyResultLimit = Config.HISTORY_RESULTLIMIT_DEFAULT;

    if (!duringCreate && geoLocation != null)
        geoLocation.start();
}

From source file:com.samsung.msca.samsungvr.sampleapp.LoggedInFragment.java

private void selectItem(int position) {
    if (null == mUser || position == mCurrentSelection) {
        return;/* w  w w.jav a 2  s .  co m*/
    }
    mCurrentSelection = position;
    mDrawerList.setItemChecked(position, true);
    mDrawerLayout.closeDrawer(mDrawerList);

    Bundle args = null;
    FragmentTransaction ft = mFragmentManager.beginTransaction();
    Fragment fragment = null;
    String tag = null;

    switch (position) {
    case 1: /* Create live event */

        tag = CreateLiveEventFragment.TAG;
        fragment = mFragmentManager.findFragmentByTag(tag);
        if (null == fragment) {
            fragment = CreateLiveEventFragment.newFragment();
        }
        args = new Bundle();
        args.putString(PARAM_USER, mUser.getUserId());
        break;

    case 2: /* List live events */

        tag = ListLiveEventsFragment.TAG;
        fragment = mFragmentManager.findFragmentByTag(tag);
        if (null == fragment) {
            fragment = ListLiveEventsFragment.newFragment();
        }
        args = new Bundle();
        args.putString(PARAM_USER, mUser.getUserId());
        break;

    case 3: /* Upload video */

        tag = UploadVideoFragment.TAG;
        fragment = mFragmentManager.findFragmentByTag(tag);
        if (null == fragment) {
            fragment = UploadVideoFragment.newFragment();
        }
        args = new Bundle();
        args.putString(PARAM_USER, mUser.getUserId());
        break;

    case 4: /* Get user by session id */

        tag = GetUserBySessionInfoFragment.TAG;
        fragment = mFragmentManager.findFragmentByTag(tag);
        if (null == fragment) {
            fragment = GetUserBySessionInfoFragment.newFragment();
        }
        break;

    }
    if (null != fragment && !fragment.isVisible()) {
        if (null != args) {
            fragment.setArguments(args);
        }
        ft.replace(R.id.content_frame, fragment, tag);
        ft.commitAllowingStateLoss();
    }
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void showLogFragment() {
    FragmentTransaction ft;
    ft = fm.beginTransaction();// w  ww  .j  a  v  a  2s .c  o m

    final Fragment fragment = new LogFragment();
    ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_LOG);
    ft.addToBackStack(AppConstants.PAGE_TITLE_LOG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

    ft.commit();
    refreshActionBar(AppConstants.PAGE_TITLE_LOG);
}