Example usage for android.support.v4.app Fragment equals

List of usage examples for android.support.v4.app Fragment equals

Introduction

In this page you can find the example usage for android.support.v4.app Fragment equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:net.reichholf.dreamdroid.fragment.helper.DreamDroidHttpFragmentHelper.java

public void bindToFragment(Fragment fragment) {
    if (!(fragment instanceof HttpBaseFragment) && !(fragment instanceof ScreenShotFragment))
        throw new IllegalStateException(
                getClass().getSimpleName() + " must be attached to a HttpBaseFragment.");
    if (!fragment.equals(mFragment)) {
        mFragment = fragment;/*from   w w  w .  j  a va  2s.c o  m*/
    }
    mSwipeRefreshLayout = null;
}

From source file:com.binomed.test.custom.CustomViewActivity.java

/**
 * Method which change the fragment to show according to checkboxs
 *///from w w  w .  j av a  2 s  . c om
private void display() {
    Fragment fragmentRecycle = getSupportFragmentManager().findFragmentById(R.id.root_container);
    Fragment fragment = getFragment();
    // This checkbox has only senses if the cacheColorCheck is checked
    transparentColorCheck.setEnabled(cacheColorCheck.isChecked());

    // We replace the correct framgent
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    if (fragmentRecycle == null) {
        transaction.add(R.id.root_container, fragment);
    } else if ((fragment != null) && !fragmentRecycle.equals(fragment)) {
        transaction.replace(R.id.root_container, fragment);
    }
    transaction.commit();

}

From source file:net.reichholf.dreamdroid.activities.MainActivity.java

@Override
public void onFragmentResume(Fragment fragment) {
    if (!fragment.equals(mNavigationFragment) && !fragment.equals(mDetailFragment)) {
        mDetailFragment = fragment;/*from   w ww.j av  a2 s  .c o  m*/
        showDetails(fragment);
    }
}

From source file:com.ruesga.rview.MainActivity.java

@Override
@SuppressWarnings("unchecked")
public <T> void onRefreshEnd(Fragment from, T result) {
    super.onRefreshEnd(from, result);
    if (result == null) {
        return;//w  w w  .j av a  2  s. c om
    }

    if (mIsTwoPane && result instanceof List) {
        Fragment current = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_LIST);
        if (current instanceof PageableFragment) {
            current = ((PageableFragment) current).getCurrentFragment();
            if (current != null && !current.equals(from)) {
                // This is not the visible fragment. ignore its results
                return;
            }
        } else {
            if (!current.equals(from)) {
                // This is not the visible fragment. ignore its results
                return;
            }
        }

        List<ChangeInfo> changes = (List<ChangeInfo>) result;
        if (!changes.isEmpty() && mModel.selectedChangeId == INVALID_ITEM) {
            onChangeItemPressed(changes.get(0));
        }
    } else if (result instanceof ChangeInfo) {
        mModel.selectedChangeId = ((ChangeInfo) result).legacyChangeId;
    }
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

private void showLogFrag(OpenFragment frag, boolean toggle) {
    View frag_log = findViewById(R.id.frag_log);
    ViewUtils.setViewsVisible(this, true, R.id.title_log);
    if (frag_log == null)
        ((Poppable) frag).getPopup().showLikePopDownMenu();
    else {/*from  w ww .j  av  a2  s . c om*/
        boolean isVis = frag_log.getVisibility() == View.VISIBLE;
        boolean isFragged = false;
        Fragment fl = fragmentManager.findFragmentById(R.id.frag_log);
        if (fl != null && fl.equals(frag))
            isFragged = true;
        if (isFragged) {
            if (toggle) {
                Logger.LogDebug("OpenExplorer.showLogFrag : Toggling " + frag.getTitle());
                ViewUtils.setViewsVisible(frag_log, !isVis);
            }
        } else if (isVis) {
            Logger.LogDebug("OpenExplorer.showLogFrag : Adding " + frag.getTitle());
            fragmentManager.beginTransaction().replace(R.id.frag_log, frag).disallowAddToBackStack()
                    .commitAllowingStateLoss();
            ViewUtils.setViewsVisible(frag_log, true);
        } else {
            Logger.LogDebug("OpenExplorer.showLogFrag : Showing " + frag.getTitle());
            ViewUtils.setViewsVisible(frag_log, true);
        }
    }
}