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


Java TransitionSet类代码示例

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


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

示例1: initTransitions

import android.transition.TransitionSet; //导入依赖的package包/类
@TargetApi(21) private void initTransitions() {

    Window window = getActivity().getWindow();
    window.setEnterTransition(
        new ExplodeFadeEnterTransition(senderNameView, senderMailView, separatorLine));
    window.setExitTransition(new ExcludedExplodeTransition());
    window.setReenterTransition(new ExcludedExplodeTransition());
    window.setReturnTransition(new ExcludedExplodeTransition());

    TransitionSet textSizeSet = new TransitionSet();
    textSizeSet.addTransition(
        TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));
    TextSizeTransition textSizeTransition = new TextSizeTransition();
    textSizeTransition.addTarget(R.id.subject);
    textSizeTransition.addTarget(getString(R.string.shared_mail_subject));

    textSizeSet.addTransition(textSizeTransition);
    textSizeSet.setOrdering(TransitionSet.ORDERING_TOGETHER);

    window.setSharedElementEnterTransition(textSizeSet);
    getActivity().setEnterSharedElementCallback(
        new TextSizeEnterSharedElementCallback(getActivity()));
  }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DetailsFragment.java

示例2: onClick

import android.transition.TransitionSet; //导入依赖的package包/类
@OnClick(R.id.square2)
public void onClick() {

    FragmentSharedElementTransitionTarget targetFragment = new FragmentSharedElementTransitionTarget();
    // FIXME: 08/02/2017 the shared element transitions to the next fragment below other views while it should be on top as in Activity transitions
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionSet transitionSet = new TransitionSet();
        transitionSet.addTransition(new ChangeBounds());
        transitionSet.setPathMotion(new ArcMotion());
        targetFragment.setSharedElementEnterTransition(transitionSet);
        targetFragment.setSharedElementReturnTransition(transitionSet);
        targetFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_bottom));
        targetFragment.setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_top_and_fade));
        setExitTransition(new Explode());
        setReenterTransition(new Explode());
        setAllowReturnTransitionOverlap(false);
    }
    getActivity().getSupportFragmentManager()
            .beginTransaction()
            .addSharedElement(square2, getString(R.string.custom_element_transition_name))
            .replace(R.id.fragmentContainer, targetFragment)
            .addToBackStack(null)
            .commit();
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:25,代码来源:FragmentSharedElementTransitionSource.java

示例3: constructTransitions

import android.transition.TransitionSet; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
	int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};

	Transition slideTransition = new Slide(Gravity.BOTTOM);
	Transition fadeTransition = new Fade();

	for (int slideTarget : slideTargets) {
		slideTransition.addTarget(slideTarget);
		fadeTransition.excludeTarget(slideTarget, true);
	}

	TransitionSet set = new TransitionSet();
	set.addTransition(slideTransition);
	set.addTransition(fadeTransition);
	return set;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:18,代码来源:LiveStreamActivity.java

示例4: removeTargets

import android.transition.TransitionSet; //导入依赖的package包/类
public static void removeTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    int i;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (i = 0; i < numTransitions; i++) {
            removeTargets(set.getTransitionAt(i), views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == views.size() && targets.containsAll(views)) {
            for (i = views.size() - 1; i >= 0; i--) {
                transition.removeTarget((View) views.get(i));
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:FragmentTransitionCompat21.java

示例5: addTargets

import android.transition.TransitionSet; //导入依赖的package包/类
public static void addTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    int i;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (i = 0; i < numTransitions; i++) {
            addTargets(set.getTransitionAt(i), views);
        }
    } else if (!hasSimpleTarget(transition) && isNullOrEmpty(transition.getTargets())) {
        int numViews = views.size();
        for (i = 0; i < numViews; i++) {
            transition.addTarget((View) views.get(i));
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:FragmentTransitionCompat21.java

示例6: onCreate

import android.transition.TransitionSet; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_detail);

    postponeEnterTransition();

    TransitionSet transitions = new TransitionSet();
    Slide slide = new Slide(Gravity.BOTTOM);
    slide.setInterpolator(AnimationUtils.loadInterpolator(this,
            android.R.interpolator.linear_out_slow_in));
    slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
    transitions.addTransition(slide);
    transitions.addTransition(new Fade());
    getWindow().setEnterTransition(transitions);

    Intent intent = getIntent();
    sharedElementCallback = new DetailSharedElementEnterCallback(intent);
    setEnterSharedElementCallback(sharedElementCallback);
    initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
    setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(navigationOnClickListener);

    super.onCreate(savedInstanceState);
}
 
开发者ID:googlesamples,项目名称:android-unsplash,代码行数:27,代码来源:DetailActivity.java

示例7: m219a

import android.transition.TransitionSet; //导入依赖的package包/类
public static void m219a(Object obj, ArrayList arrayList) {
    Transition transition = (Transition) obj;
    int transitionCount;
    if (transition instanceof TransitionSet) {
        TransitionSet transitionSet = (TransitionSet) transition;
        transitionCount = transitionSet.getTransitionCount();
        for (int i = 0; i < transitionCount; i++) {
            ar.m219a(transitionSet.getTransitionAt(i), arrayList);
        }
    } else if (!ar.m223a(transition)) {
        List targets = transition.getTargets();
        if (targets != null && targets.size() == arrayList.size() && targets.containsAll(arrayList)) {
            for (transitionCount = arrayList.size() - 1; transitionCount >= 0; transitionCount--) {
                transition.removeTarget((View) arrayList.get(transitionCount));
            }
        }
    }
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:19,代码来源:ar.java

示例8: m228b

import android.transition.TransitionSet; //导入依赖的package包/类
public static void m228b(Object obj, ArrayList arrayList) {
    int i = 0;
    Transition transition = (Transition) obj;
    int transitionCount;
    if (transition instanceof TransitionSet) {
        TransitionSet transitionSet = (TransitionSet) transition;
        transitionCount = transitionSet.getTransitionCount();
        while (i < transitionCount) {
            ar.m228b(transitionSet.getTransitionAt(i), arrayList);
            i++;
        }
    } else if (!ar.m223a(transition) && ar.m224a(transition.getTargets())) {
        int size = arrayList.size();
        for (transitionCount = 0; transitionCount < size; transitionCount++) {
            transition.addTarget((View) arrayList.get(transitionCount));
        }
    }
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:19,代码来源:ar.java

示例9: setSharedElementTargets

import android.transition.TransitionSet; //导入依赖的package包/类
/**
 * Finds all children of the shared elements and sets the wrapping TransitionSet
 * targets to point to those. It also limits transitions that have no targets to the
 * specific shared elements. This allows developers to target child views of the
 * shared elements specifically, but this doesn't happen by default.
 */
public static void setSharedElementTargets(Object transitionObj,
        View nonExistentView, Map<String, View> namedViews,
        ArrayList<View> sharedElementTargets) {
    TransitionSet transition = (TransitionSet) transitionObj;
    sharedElementTargets.clear();
    sharedElementTargets.addAll(namedViews.values());

    final List<View> views = transition.getTargets();
    views.clear();
    final int count = sharedElementTargets.size();
    for (int i = 0; i < count; i++) {
        final View view = sharedElementTargets.get(i);
        bfsAddViewChildren(views, view);
    }
    sharedElementTargets.add(nonExistentView);
    addTargets(transition, sharedElementTargets);
}
 
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:24,代码来源:FragmentTransitionCompat21.java

示例10: 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

示例11: 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

示例12: startTransition

import android.transition.TransitionSet; //导入依赖的package包/类
private void startTransition(){
    lifeGridFragment = LifeGridFragment.newInstance();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if(Build.VERSION.SDK_INT >= 21) {
        TransitionSet gridTransition = new TransitionSet();
        gridTransition.setDuration(600);
        gridTransition.addTransition(new ChangeBounds());
        gridTransition.addTransition((new ChangeTransform()));
        lifeGridFragment.setSharedElementEnterTransition(gridTransition);
    }


    fragmentTransaction.addSharedElement(findViewById(R.id.intro_card_view), getString(R.string.card_view_transition_name));
    fragmentTransaction.replace(R.id.container, lifeGridFragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
    appBarLayout.setExpanded(false, true);
}
 
开发者ID:lewismcgeary,项目名称:AndroidGameofLife,代码行数:20,代码来源:MainActivity.java

示例13: GalleryFragment

import android.transition.TransitionSet; //导入依赖的package包/类
public GalleryFragment() {

        final Fade fade = new Fade();
        fade.addTarget(R.id.appbar);

        Explode explode = new Explode();
        explode.excludeTarget(R.id.appbar, true);

        Elevation elevation = new Elevation();
        elevation.addTarget(R.id.gallery_card);
        elevation.setStartDelay(250); // arbitrarily chosen delay

        TransitionSet exit = new TransitionSet();
        exit.addTransition(fade);
        exit.addTransition(explode);
        exit.addTransition(elevation);

        setExitTransition(exit);
    }
 
开发者ID:googlesamples,项目名称:android-OurStreets,代码行数:20,代码来源:GalleryFragment.java

示例14: startToolbarAnimation

import android.transition.TransitionSet; //导入依赖的package包/类
public static void startToolbarAnimation(
    Context context,
    ViewGroup v
) {
    if (new UpdaterOptions(context).disableAnimations()) {
        return;
    }

    if (Build.VERSION.SDK_INT >= 21) {
        TransitionManager.beginDelayedTransition(v, new TransitionSet()
            .addTransition(new Fade(Fade.IN))
            .addTransition(new Slide(Gravity.LEFT))
            .addTransition(new ChangeBounds())
        );

    } else if (Build.VERSION.SDK_INT >= 14){
        android.support.transition.TransitionManager.beginDelayedTransition(v, new AutoTransition().setDuration(250));
    } {
        // No animation
    }
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:22,代码来源:AnimationUtil.java

示例15: createTransition

import android.transition.TransitionSet; //导入依赖的package包/类
@NonNull
@Override
protected Transition createTransition(@NonNull ViewGroup container, @NonNull View entering, @Nullable View leaving, boolean push) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    return new TransitionSet()
        .setOrdering(ORDERING_TOGETHER)
        .addTransition(new Fade(Fade.OUT))
        .addTransition(new Fade(Fade.IN));
  }
  final TransitionSet transition = new TransitionSet()
      .addTransition(new ChangeBounds())
      .addTransition(new ChangeClipBounds())
      .addTransition(new ChangeTransform());

  transition.setPathMotion(new ArcMotion());

  return transition;
}
 
开发者ID:SiimKinks,项目名称:unicorn,代码行数:19,代码来源:ArcMoveTransitionHandler.java


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