Example usage for android.app FragmentTransaction setTransition

List of usage examples for android.app FragmentTransaction setTransition

Introduction

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

Prototype

public abstract FragmentTransaction setTransition(@Transit int transit);

Source Link

Document

Select a standard transition animation for this transaction.

Usage

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

public void showResultsAfterTest(String testUuid) {
    popBackStackFull();/* ww w. j  av a2 s .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

/**
 * /* www.j  av  a2 s  .co  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  w  ww .j av a 2  s . co m
 * @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 showLogFragment() {
    FragmentTransaction ft;
    ft = fm.beginTransaction();//from  w  w w .  j a v  a 2  s  .c  om

    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);
}

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

/**
 * /*from  ww w  . ja v a  2 s  .  co m*/
 */
public void showSync() {
    FragmentTransaction ft;
    ft = fm.beginTransaction();

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

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

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

public void showNetstatFragment() {
    FragmentTransaction ft;
    ft = fm.beginTransaction();//from   w  w  w . j  a  va2  s  . c  om

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

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

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

public void showFilter() {
    final FragmentManager fm = getFragmentManager();
    FragmentTransaction ft;

    final Fragment fragment = new RMBTFilterFragment();

    ft = fm.beginTransaction();/* ww w  .j  av  a  2 s .  com*/
    ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_FILTER);
    ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_FILTER);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.commit();

    refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_FILTER);
}

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

/**
 * //from   w w w  . j a v a  2s . c o m
 * @param popStack
 */
public void startTest(final boolean popStack) {
    if (networkInfoCollector != null) {
        if (!networkInfoCollector.hasConnectionFromAndroidApi()) {
            showNoNetworkConnectionToast();
            return;
        }
    }

    final boolean loopMode = ConfigHelper.isLoopMode(this);
    if (loopMode) {
        startService(new Intent(this, RMBTLoopService.class));
    } else {
        FragmentTransaction ft;
        ft = fm.beginTransaction();
        final RMBTTestFragment rmbtTestFragment = new RMBTTestFragment();
        ft.replace(R.id.fragment_content, rmbtTestFragment, AppConstants.PAGE_TITLE_TEST);
        ft.addToBackStack(AppConstants.PAGE_TITLE_TEST);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        if (popStack)
            fm.popBackStack();
        ft.commit();

        final Intent service = new Intent(RMBTService.ACTION_START_TEST, null, this, RMBTService.class);
        startService(service);
    }
}

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

public void showHelp(final String url, boolean popBackStack, String titleId) {
    if (popBackStack) {
        popBackStackFull();/*from  ww  w .  j  av  a  2 s .  co  m*/
    }

    FragmentTransaction ft;

    ft = fm.beginTransaction();

    final Fragment fragment = new RMBTHelpFragment();
    final Bundle args = new Bundle();

    args.putString(RMBTHelpFragment.ARG_URL, url);
    fragment.setArguments(args);
    ft.replace(R.id.fragment_content, fragment, titleId);
    ft.addToBackStack(titleId);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

    ft.commit();
    refreshActionBar(titleId);
}

From source file:com.android.dialer.DialtactsActivity.java

/**
 * Shows the search fragment//from   w w w  .  j  ava  2s .  c  o  m
 */
private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
    if (mStateSaved || getFragmentManager().isDestroyed()) {
        // Weird race condition where fragment is doing work after the activity is destroyed
        // due to talkback being on (b/10209937). Just return since we can't do any
        // constructive here.
        return;
    }

    if (DEBUG) {
        Log.d(TAG, "Entering search UI - smart dial " + smartDialSearch);
    }

    final FragmentTransaction transaction = getFragmentManager().beginTransaction();
    if (mInDialpadSearch && mSmartDialSearchFragment != null) {
        transaction.remove(mSmartDialSearchFragment);
    } else if (mInRegularSearch && mRegularSearchFragment != null) {
        transaction.remove(mRegularSearchFragment);
    }

    final String tag;
    if (smartDialSearch) {
        tag = TAG_SMARTDIAL_SEARCH_FRAGMENT;
    } else {
        tag = TAG_REGULAR_SEARCH_FRAGMENT;
    }
    mInDialpadSearch = smartDialSearch;
    mInRegularSearch = !smartDialSearch;

    mFloatingActionButtonController.scaleOut();

    SearchFragment fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag);
    if (animate) {
        transaction.setCustomAnimations(android.R.animator.fade_in, 0);
    } else {
        transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
    }
    if (fragment == null) {
        if (smartDialSearch) {
            fragment = new SmartDialSearchFragment();
        } else {
            fragment = ObjectFactory.newRegularSearchFragment();
            fragment.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    // Show the FAB when the user touches the lists fragment and the soft
                    // keyboard is hidden.
                    hideDialpadFragment(true, false);
                    showFabInSearchUi();
                    return false;
                }
            });
        }
        transaction.add(R.id.dialtacts_frame, fragment, tag);
    } else {
        transaction.show(fragment);
    }
    // DialtactsActivity will provide the options menu
    fragment.setHasOptionsMenu(false);
    fragment.setShowEmptyListForNullQuery(true);
    if (!smartDialSearch) {
        fragment.setQueryString(query, false /* delaySelection */);
    }
    transaction.commit();

    if (animate) {
        mListsFragment.getView().animate().alpha(0).withLayer();
    }
    mListsFragment.setUserVisibleHint(false);

    if (smartDialSearch) {
        Logger.logScreenView(ScreenEvent.SMART_DIAL_SEARCH, this);
    } else {
        Logger.logScreenView(ScreenEvent.REGULAR_SEARCH, this);
    }
}