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


Java TransitionInflater类代码示例

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


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

示例1: initTransitions

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

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

示例3: onCreate

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

示例4: navigateToAlbum

import android.transition.TransitionInflater; //导入依赖的package包/类
@TargetApi(21)
public static void navigateToAlbum(Activity context, long albumID, 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 = AlbumDetailFragment.newInstance(albumID, 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 = AlbumDetailFragment.newInstance(albumID, 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

示例5: navigateToArtist

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

示例6: onViewCreated

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    orderSelection = new OrderSelection();

    selectedViewTransition = TransitionInflater.from(getContext())
            .inflateTransition(R.transition.transition_selected_view);

    binding.setProduct(getProduct());
    binding.imgProduct.setImageDrawable(createProductImageDrawable(getProduct()));

    binding.btnGo.setBackground(new ColorDrawable(ContextCompat.getColor(
            getContext(), getProduct().color)));

    initOrderStepOneView(binding.layoutStep1);
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:18,代码来源:OrderDialogFragment.java

示例7: onConferenceSelected

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void onConferenceSelected(Conference con) {
	mDisposables.add(mViewModel.getConference(con.getApiID())
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(conference -> {
				EventsFragment eventsFragment = EventsFragment.newInstance(conference.getApiID(),getNumColumns());
				FragmentManager fm = getSupportFragmentManager();
				Fragment oldFragment = fm.findFragmentById(R.id.fragment_container);

				TransitionInflater transitionInflater = TransitionInflater.from(this);
				oldFragment.setExitTransition(
						transitionInflater.inflateTransition(android.R.transition.fade));
				eventsFragment.setEnterTransition(
						transitionInflater.inflateTransition(android.R.transition.slide_right));

				Slide slideTransition = new Slide(Gravity.RIGHT);
				eventsFragment.setEnterTransition(slideTransition);

				FragmentTransaction ft = fm.beginTransaction();
				ft.replace(R.id.fragment_container, eventsFragment);
				ft.setReorderingAllowed(true);
				ft.addToBackStack(null);
				ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
				ft.commit();
			}));
}
 
开发者ID:NiciDieNase,项目名称:chaosflix,代码行数:27,代码来源:BrowseActivity.java

示例8: onViewCreated

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    orderSelection = new OrderSelection();

    selectedViewTransition = TransitionInflater.from(getContext())
        .inflateTransition(R.transition.transition_selected_view);

    binding.setProduct(getProduct());
    binding.imgProduct.setImageDrawable(createProductImageDrawable(getProduct()));

    binding.btnGo.setBackground(new ColorDrawable(ContextCompat.getColor(
        getContext(), getProduct().color)));

    initOrderStepOneView(binding.layoutStep1);
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:18,代码来源:OrderDialogFragment.java

示例9: onClick

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

示例10: createSlideAnimation

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

示例11: showFragment

import android.transition.TransitionInflater; //导入依赖的package包/类
@SuppressLint("NewApi")
public static void showFragment(FragmentActivity activity, Fragment firstFragment, Fragment secondFragment, @Nullable Pair<View, String>... transitionViews) {

    boolean lollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;

    if(lollipop) {
        firstFragment.setSharedElementReturnTransition(TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform));
        secondFragment.setSharedElementEnterTransition(TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform));
    }
    FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, secondFragment)
            .addToBackStack(null);
    if(lollipop && transitionViews != null) {

        for(Pair<View, String> tr : transitionViews) {
            ft.addSharedElement(tr.first, tr.second);
        }
    }
    ft.commit();
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:21,代码来源:NavigationUtils.java

示例12: onClick

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void onClick(View v) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        switch (v.getId()) {
            case R.id.exlpode:
                transition = TransitionInflater.from(this).inflateTransition(R.transition.explode);
                break;
            case R.id.slide:
                transition = TransitionInflater.from(this).inflateTransition(R.transition.slide);
                break;
            default:
                break;
        }
        //退出时使用
        getWindow().setExitTransition(transition);
        //第一次进入时使用
        getWindow().setEnterTransition(transition);
        //再次进入时使用
        getWindow().setReenterTransition(transition);
        Bundle bundle = ActivityOptions.makeSceneTransitionAnimation(this).toBundle();
        Intent intent = new Intent(mContext, TweenedAnimationActivity.class);
        startActivity(intent,bundle);
    }

}
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:27,代码来源:SwitchAnimActivity.java

示例13: displayDetails

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void displayDetails(AnnouncementItem announcementItem) {
    FullAnnouncement announcement = announcementItem.getAnnouncement();

    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();

    AnnouncementDetailsFragment announcementDetailsFragment = AnnouncementDetailsFragment.newInstance(announcement);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        TransitionInflater transitionInflater = null;
        transitionInflater = TransitionInflater.from(getContext());
        Transition details_enter = transitionInflater.inflateTransition(R.transition.details_enter);
        Transition details_exit = transitionInflater.inflateTransition(R.transition.details_exit);
        setSharedElementEnterTransition(details_enter);
        setSharedElementReturnTransition(details_exit);
        setExitTransition(new Fade());
        announcementDetailsFragment.setSharedElementEnterTransition(details_enter);
        announcementDetailsFragment.setSharedElementReturnTransition(details_exit);
        ft.addSharedElement(announcementItem.getBackgroundView(), announcementItem.getBackgroundView().getTransitionName());
    }

    ft.replace(R.id.content_main, announcementDetailsFragment, "Announcement details transition");
    ft.addToBackStack(null);
    ft.commitAllowingStateLoss();
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:27,代码来源:AnnouncementsFragment.java

示例14: onOpenStoryDetail

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
public void onOpenStoryDetail(Story story, StoryAdapter.ViewHolder vh) {
    Fragment storyDetailFragment = StoryDetailFragment.newInstance(story);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Transition changeTransform = TransitionInflater.from(this)
                .inflateTransition(R.transition.transition_story);
        mTopStoriesFragment.setExitTransition(new Fade());
        storyDetailFragment.setEnterTransition(new Fade());
        storyDetailFragment.setSharedElementEnterTransition(changeTransform);
        storyDetailFragment.setSharedElementReturnTransition(changeTransform);
    }

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.fragment_container, storyDetailFragment, TAG_STORY_DETAIL)
            .addToBackStack(null)
            .addSharedElement(vh.itemView, getString(R.string.story_transition_name, story.getId()))
            .commit();
}
 
开发者ID:setiawanp,项目名称:sunny-reader,代码行数:19,代码来源:MainActivity.java

示例15: onCreate

import android.transition.TransitionInflater; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    pager.setAdapter(new AboutPagerAdapter(this));
    pager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.spacing_normal));
    pageIndicator.setViewPager(pager);

    draggableFrame.addListener(
            new ElasticDragDismissFrameLayout.SystemChromeFader(this) {
                @Override
                public void onDragDismissed() {
                    // if we drag dismiss downward then the default reversal of the enter
                    // transition would slide content upward which looks weird. So reverse it.
                    if (draggableFrame.getTranslationY() > 0) {
                        getWindow().setReturnTransition(
                                TransitionInflater.from(AboutActivity.this)
                                        .inflateTransition(R.transition.about_return_downward));
                    }
                    finishAfterTransition();
                }
            });
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:26,代码来源:AboutActivity.java


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