Java Code Examples for android.support.v4.util.ArrayMap#retainAll()

The following examples show how to use android.support.v4.util.ArrayMap#retainAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BackStackRecord.java    From letv with Apache License 2.0 6 votes vote down vote up
private ArrayMap<String, View> remapSharedElements(TransitionState state, Fragment outFragment, boolean isBack) {
    ArrayMap namedViews = new ArrayMap();
    if (this.mSharedElementSourceNames != null) {
        FragmentTransitionCompat21.findNamedViews(namedViews, outFragment.getView());
        if (isBack) {
            namedViews.retainAll(this.mSharedElementTargetNames);
        } else {
            namedViews = remapNames(this.mSharedElementSourceNames, this.mSharedElementTargetNames, namedViews);
        }
    }
    if (isBack) {
        if (outFragment.mEnterTransitionCallback != null) {
            outFragment.mEnterTransitionCallback.onMapSharedElements(this.mSharedElementTargetNames, namedViews);
        }
        setBackNameOverrides(state, namedViews, false);
    } else {
        if (outFragment.mExitTransitionCallback != null) {
            outFragment.mExitTransitionCallback.onMapSharedElements(this.mSharedElementTargetNames, namedViews);
        }
        setNameOverrides(state, namedViews, false);
    }
    return namedViews;
}
 
Example 2
Source File: BackStackRecord.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
/**
 * Maps shared elements to views in the entering fragment.
 *
 * @param state The transition State as returned from {@link #beginTransition(
 * android.util.SparseArray, android.util.SparseArray, boolean)}.
 * @param inFragment The last fragment to be added.
 * @param isBack true if this is popping the back stack or false if this is a
 *               forward operation.
 */
private ArrayMap<String, View> mapEnteringSharedElements(TransitionState state,
        Fragment inFragment, boolean isBack) {
    ArrayMap<String, View> namedViews = new ArrayMap<String, View>();
    View root = inFragment.getView();
    if (root != null) {
        if (mSharedElementSourceNames != null) {
            FragmentTransitionCompat21.findNamedViews(namedViews, root);
            if (isBack) {
                namedViews = remapNames(mSharedElementSourceNames,
                        mSharedElementTargetNames, namedViews);
            } else {
                namedViews.retainAll(mSharedElementTargetNames);
            }
        }
    }
    return namedViews;
}
 
Example 3
Source File: BackStackRecord.java    From letv with Apache License 2.0 5 votes vote down vote up
private ArrayMap<String, View> mapEnteringSharedElements(TransitionState state, Fragment inFragment, boolean isBack) {
    ArrayMap<String, View> namedViews = new ArrayMap();
    View root = inFragment.getView();
    if (root == null || this.mSharedElementSourceNames == null) {
        return namedViews;
    }
    FragmentTransitionCompat21.findNamedViews(namedViews, root);
    if (isBack) {
        return remapNames(this.mSharedElementSourceNames, this.mSharedElementTargetNames, namedViews);
    }
    namedViews.retainAll(this.mSharedElementTargetNames);
    return namedViews;
}
 
Example 4
Source File: BackStackRecord.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private ArrayMap<String, View> remapSharedElements(TransitionState state, Fragment outFragment,
        boolean isBack) {
    ArrayMap<String, View> namedViews = new ArrayMap<String, View>();
    if (mSharedElementSourceNames != null) {
        FragmentTransitionCompat21.findNamedViews(namedViews, outFragment.getView());
        if (isBack) {
            namedViews.retainAll(mSharedElementTargetNames);
        } else {
            namedViews = remapNames(mSharedElementSourceNames, mSharedElementTargetNames,
                    namedViews);
        }
    }

    if (isBack) {
        if (outFragment.mEnterTransitionCallback != null) {
            outFragment.mEnterTransitionCallback.onMapSharedElements(
                    mSharedElementTargetNames, namedViews);
        }
        setBackNameOverrides(state, namedViews, false);
    } else {
        if (outFragment.mExitTransitionCallback != null) {
            outFragment.mExitTransitionCallback.onMapSharedElements(
                    mSharedElementTargetNames, namedViews);
        }
        setNameOverrides(state, namedViews, false);
    }

    return namedViews;
}