本文整理汇总了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));
}
}
}
}
示例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));
}
}
}
}
示例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;
}
示例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;
}