当前位置: 首页>>代码示例>>Java>>正文


Java TransitionSet.getTransitionAt方法代码示例

本文整理汇总了Java中android.transition.TransitionSet.getTransitionAt方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionSet.getTransitionAt方法的具体用法?Java TransitionSet.getTransitionAt怎么用?Java TransitionSet.getTransitionAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.transition.TransitionSet的用法示例。


在下文中一共展示了TransitionSet.getTransitionAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeTargets

import android.transition.TransitionSet; //导入方法依赖的package包/类
/**
 * This method removes the views from transitions that target ONLY those views.
 * The views list should match those added in addTargets and should contain
 * one view that is not in the view hierarchy (state.nonExistentView).
 */
public static void removeTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            removeTargets(child, views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == views.size() &&
                targets.containsAll(views)) {
            // We have an exact match. We must have added these earlier in addTargets
            for (int i = views.size() - 1; i >= 0; i--) {
                transition.removeTarget(views.get(i));
            }
        }
    }
}
 
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:26,代码来源:FragmentTransitionCompat21.java

示例2: addTargets

import android.transition.TransitionSet; //导入方法依赖的package包/类
/**
 * This method adds views as targets to the transition, but only if the transition
 * doesn't already have a target. It is best for views to contain one View object
 * that does not exist in the view hierarchy (state.nonExistentView) so that
 * when they are removed later, a list match will suffice to remove the targets.
 * Otherwise, if you happened to have targeted the exact views for the transition,
 * the removeTargets call will remove them unexpectedly.
 */
public static void addTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            addTargets(child, views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (isNullOrEmpty(targets)) {
            // We can just add the target views
            int numViews = views.size();
            for (int i = 0; i < numViews; i++) {
                transition.addTarget(views.get(i));
            }
        }
    }
}
 
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:29,代码来源:FragmentTransitionCompat21.java

示例3: findTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static
@Nullable
Transition findTransition(
        @NonNull TransitionSet set, @NonNull Class<? extends Transition> clazz) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            return transition;
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz);
            if (child != null) return child;
        }
    }
    return null;
}
 
开发者ID:ykrank,项目名称:S1-Next,代码行数:18,代码来源:TransitionUtils.java

示例4: findTransition

import android.transition.TransitionSet; //导入方法依赖的package包/类
public static @Nullable Transition findTransition(
        @NonNull TransitionSet set,
        @NonNull Class<? extends Transition> clazz,
        @IdRes int targetId) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            if (transition.getTargetIds().contains(targetId)) {
                return transition;
            }
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz, targetId);
            if (child != null) return child;
        }
    }
    return null;
}
 
开发者ID:yongjhih,项目名称:android-proguards,代码行数:19,代码来源:TransitionUtils.java


注:本文中的android.transition.TransitionSet.getTransitionAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。