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


Java Transition类代码示例

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


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

示例1: removeTargets

import android.transition.Transition; //导入依赖的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

示例2: addTargets

import android.transition.Transition; //导入依赖的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

示例3: onCreate

import android.transition.Transition; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= 21)
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        setContentView(R.layout.activity_window_transitions_second);

        Transition transition = TransitionInflater
                .from(this)
//                .inflateTransition(R.transition.explode); /* 爆炸效果 */
//                .inflateTransition(R.transition.fade);  /* 淡化效果 */
                .inflateTransition(R.transition.slide); /* 滑动效果 */

        /* 退出时使用 */
        getWindow().setExitTransition(transition);
        /* 第一次进入时使用 */
        getWindow().setEnterTransition(transition);
    }
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:19,代码来源:WindowTransitionsSecondActivity.java

示例4: onCreate

import android.transition.Transition; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= 21)
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
        setContentView(R.layout.activity_window_transitions);

        Transition transition = TransitionInflater
                .from(this)
                .inflateTransition(R.transition.explode); /* 爆炸效果 */
//                .inflateTransition(R.transition.fade);  /* 淡化效果 */
//                .inflateTransition(R.transition.slide); /* 滑动效果 */

        /* 退出时使用 */
        getWindow().setExitTransition(transition);
        /* 再次进入时使用 */
        getWindow().setReenterTransition(transition);
        /* 第一次进入时使用 */
        getWindow().setEnterTransition(transition);
    }
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:21,代码来源:WindowTransitionsActivity.java

示例5: applyTransitionToWindow

import android.transition.Transition; //导入依赖的package包/类
static void applyTransitionToWindow(@NonNull final Window window,
                                    @NonNull final Transition transition,
                                    boolean enter, boolean retun,
                                    boolean reenter, boolean exit,
                                    boolean overlap) {
    window.setAllowEnterTransitionOverlap(overlap);
    window.setAllowReturnTransitionOverlap(overlap);
    if (enter) {
        window.setEnterTransition(transition);
    }
    if (reenter) {
        window.setReenterTransition(transition);
    }
    if (exit) {
        window.setExitTransition(transition);
    }
    if (retun) {
        window.setReturnTransition(transition);
    }
}
 
开发者ID:lekaha,项目名称:TwitterizedPhotoView,代码行数:21,代码来源:TwitterizedImageShowingActivity.java

示例6: navigateToArtist

import android.transition.Transition; //导入依赖的package包/类
@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, Pair<View, String> transitionViews) {

    FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
    Fragment fragment;

    if (TimberUtils.isLollipop() && transitionViews != null && PreferencesUtility.getInstance(context).getAnimations()) {
        Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
        transaction.addSharedElement(transitionViews.first, transitionViews.second);
        fragment = ArtistDetailFragment.newInstance(artistID, true, transitionViews.second);
        fragment.setSharedElementEnterTransition(changeImage);
    } else {
        transaction.setCustomAnimations(R.anim.activity_fade_in,
                R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
        fragment = ArtistDetailFragment.newInstance(artistID, false, null);
    }
    transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
    transaction.add(R.id.fragment_container, fragment);
    transaction.addToBackStack(null).commit();

}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:22,代码来源:NavigationUtils.java

示例7: constructTransitions

import android.transition.Transition; //导入依赖的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

示例8: createSlideAnimation

import android.transition.Transition; //导入依赖的package包/类
@SuppressLint("RtlHardcoded")
private TransitionAnimation createSlideAnimation(boolean forward, AnimationData animationData) {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		Transition enterTransition = forward ? new Slide(Gravity.RIGHT) : new Slide(Gravity.LEFT);
		Transition exitTransition = forward ? new Slide(Gravity.LEFT) : new Slide(Gravity.RIGHT);
		LollipopTransitionAnimation animation = new LollipopTransitionAnimation(enterTransition, exitTransition);
		animation.setAllowEnterTransitionOverlap(false);

		Fragment currentFragment = mActivity.getSupportFragmentManager().findFragmentById(R.id.fragment_container);
		if (currentFragment instanceof SharedElementProvider) {
			SharedElementProvider sharedElementProvider = (SharedElementProvider) currentFragment;
			View sharedElement = sharedElementProvider.getSharedElement(animationData);
			String shareElementName = sharedElementProvider.getSharedElementName(animationData);
			animation.addSharedElement(sharedElement, shareElementName);
			Transition moveTransition = TransitionInflater.from(mActivity).inflateTransition(android.R.transition.move);
			moveTransition.setDuration(600);
			animation.setSharedElementTransition(moveTransition);
		}
		return animation;
	} else {
		int enterAnimRes = forward ? R.anim.slide_in_right : R.anim.slide_in_left;
		int exitAnimRes = forward ? R.anim.slide_out_left : R.anim.slide_out_right;
		return new SimpleTransitionAnimation(enterAnimRes, exitAnimRes);
	}
}
 
开发者ID:aartikov,项目名称:Alligator,代码行数:26,代码来源:SampleTransitionAnimationProvider.java

示例9: windowTransition

import android.transition.Transition; //导入依赖的package包/类
private void windowTransition() {

    getWindow().getEnterTransition().addListener(new TransitionAdapter(){

      @Override
      public void onTransitionEnd(Transition transition) {
        mAddButton.animate().alpha(1.0f);
        getWindow().getEnterTransition().removeListener(this);
      }
    });

  }
 
开发者ID:anwarcse12028,项目名称:Traveler-List,代码行数:13,代码来源:DetailActivity.java

示例10: setupTransitions

import android.transition.Transition; //导入依赖的package包/类
public void setupTransitions() {
    // Add shared element transition animation if on Lollipop or later
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Enter transitions
        TransitionSet setEnter = new TransitionSet();

        Transition slideDown = new Explode();
        slideDown.addTarget(headerView);
        slideDown.excludeTarget(scrollView, true);
        slideDown.setDuration(500);
        setEnter.addTransition(slideDown);

        Transition fadeOut = new Slide(Gravity.BOTTOM);
        fadeOut.addTarget(scrollView);
        fadeOut.setDuration(500);
        setEnter.addTransition(fadeOut);

        // Exit transitions
        TransitionSet setExit = new TransitionSet();

        Transition slideDown2 = new Explode();
        slideDown2.addTarget(headerView);
        slideDown2.setDuration(570);
        setExit.addTransition(slideDown2);

        Transition fadeOut2 = new Slide(Gravity.BOTTOM);
        fadeOut2.addTarget(scrollView);
        fadeOut2.setDuration(280);
        setExit.addTransition(fadeOut2);

        getWindow().setEnterTransition(setEnter);
        getWindow().setReturnTransition(setExit);
    }
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:35,代码来源:ViewActivity.java

示例11: updateLinkText

import android.transition.Transition; //导入依赖的package包/类
void updateLinkText(String link) {
    linkTextView.setText(link);

    Transition transition = new AutoTransition()
            .setDuration(500)
            .setStartDelay(300)
            .setInterpolator(new AccelerateDecelerateInterpolator());
    TransitionManager.beginDelayedTransition(rootView, transition);

    linkTextView.setVisibility(View.VISIBLE);
}
 
开发者ID:rumaan,项目名称:file.io-app,代码行数:12,代码来源:MainActivity.java

示例12: setSceneTransitionAnimation

import android.transition.Transition; //导入依赖的package包/类
public void setSceneTransitionAnimation() {
	if (Build.VERSION.SDK_INT < 21) return;
	Transition slide = new Slide(Gravity.RIGHT);
	slide.excludeTarget(android.R.id.statusBarBackground, true);
	slide.excludeTarget(android.R.id.navigationBarBackground, true);
	Window window = getWindow();
	window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
	window.setExitTransition(slide);
	window.setEnterTransition(slide);
	window.setTransitionBackgroundFadeDuration(getResources()
			.getInteger(android.R.integer.config_longAnimTime));
	window.setBackgroundDrawableResource(android.R.color.transparent);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:14,代码来源:BriarActivity.java

示例13: onTransitionStart

import android.transition.Transition; //导入依赖的package包/类
@Override
public void onTransitionStart(@NonNull Transition transition) {
    //hide toolbar & statusbar
    float toolbar_translationY = -(toolbar.getHeight());
    float bottomBar_translationY = ((View) bottomBar.getParent()).getHeight();
    toolbar.setTranslationY(toolbar_translationY);
    ((View) bottomBar.getParent()).setTranslationY(bottomBar_translationY);
    super.onTransitionStart(transition);
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:10,代码来源:ItemActivity.java

示例14: setEnter

import android.transition.Transition; //导入依赖的package包/类
private void setEnter()
{
	enterTransitionListener = new Transition.TransitionListener() 
	{
		@Override
		public void onTransitionStart(Transition transition)
		{ }

		@Override
		public void onTransitionEnd(Transition transition)
		{
			loadWallpaper(image);
		}

		@Override
		public void onTransitionCancel(Transition transition)
		{ }

		@Override
		public void onTransitionPause(Transition transition)
		{ }

		@Override
		public void onTransitionResume(Transition transition)
		{ }
	};
	getWindow().getEnterTransition().addListener(enterTransitionListener);
}
 
开发者ID:MSay2,项目名称:Mire,代码行数:29,代码来源:ActivitySetWallpapers.java

示例15: changeToConfirmScene

import android.transition.Transition; //导入依赖的package包/类
/**
 * 共享元素
 */
private void changeToConfirmScene() {
    final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();

    final Scene scene = new Scene(binding.content,
            ((ViewGroup) confBinding.getRoot()));

    scene.setEnterAction(onEnterConfirmScene(confBinding));

    final Transition transition = TransitionInflater.from(getContext())
            .inflateTransition(R.transition.transition_confirmation_view);

    TransitionManager.go(scene, transition);
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:17,代码来源:OrderDialogFragment.java


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