Example usage for android.app FragmentTransaction TRANSIT_NONE

List of usage examples for android.app FragmentTransaction TRANSIT_NONE

Introduction

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

Prototype

int TRANSIT_NONE

To view the source code for android.app FragmentTransaction TRANSIT_NONE.

Click Source Link

Document

No animation for transition.

Usage

From source file:com.skubit.dialog.ProgressActivity.java

public void replaceFragment(Fragment fragment, String tag) {
    mUIState = tag;/* w  w  w  .  j av a  2s  . c o m*/
    getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_NONE)
            .replace(R.id.container, fragment, tag).commitAllowingStateLoss();
}

From source file:com.skubit.comics.activities.MainActivity.java

private void showFragment(Fragment targetFragment, String tag, int position) {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction transaction = fm.beginTransaction().setTransition(FragmentTransaction.TRANSIT_NONE);
    hidesFragments(position, transaction);

    Fragment f = fragments[position];/*from  w  w w. j  a v a  2  s. c  o  m*/

    if (f == null) {
        addFragmentToCache(targetFragment, tag, position);
        if (isFragmentInCache(tag)) {
            transaction.show(fragments[position]);
        } else {
            transaction.add(R.id.container, fragments[position], tag);
        }
    } else {
        transaction.show(fragments[position]);
    }

    transaction.commitAllowingStateLoss();
}

From source file:com.skubit.comics.activities.MainActivity.java

private void showFragment(Fragment newFragment, String tag) {
    Fragment oldFragment = getFragmentManager().findFragmentByTag(tag);

    if (oldFragment != null) {
        getFragmentManager().beginTransaction().replace(R.id.container, oldFragment, tag).commit();
    } else {/*from ww  w  . j  a  v a  2  s  .  co m*/
        getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_NONE)
                .replace(R.id.container, newFragment, tag).commitAllowingStateLoss();
    }
}

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

/**
 * Shows the search fragment//  w  ww.  j av  a  2s.c  om
 */
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);
    }
}

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

/**
 * Shows the search fragment//w w  w.j  a  v  a 2s  . c  om
 */
private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
    if (mStateSaved || getChildFragmentManager().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;
    }
    mDialpadFragment.showSearchView();

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

    final FragmentTransaction transaction = getChildFragmentManager().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) getChildFragmentManager().findFragmentByTag(tag);
    if (animate) {
        transaction.setCustomAnimations(android.R.animator.fade_in, 0);
    } else {
        transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
    }
    if (fragment == null) {

        Log.e(TAG, " --- enterSearchUi --- null");
        if (smartDialSearch) {
            fragment = new SmartDialSearchFragment();
            transaction.add(R.id.dialtacts_frame, fragment, tag);
        } else {
            fragment = new RegularSearchFragment();
            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.
                    showFabInSearchUi();
                    return false;
                }
            });
        }

    } else {
        transaction.show(fragment);

    }
    // DialtactsFragment will provide the options menu
    fragment.setHasOptionsMenu(false);
    fragment.setShowEmptyListForNullQuery(true);
    fragment.setQueryString(query, false /* delaySelection */);
    transaction.commitAllowingStateLoss();
    //        transaction.commit();

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