當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。