Java 类android.transition.TransitionInflater 实例源码

项目:GitHub    文件:DetailsFragment.java   
@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()));
  }
项目:GitHub    文件:DetailsFragment.java   
@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()));
  }
项目:Android-Code-Demos    文件:WindowTransitionsSecondActivity.java   
@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);
    }
项目:Android-Code-Demos    文件:WindowTransitionsActivity.java   
@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);
    }
项目:Hello-Music-droid    文件:NavigationUtils.java   
@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();

}
项目:Hello-Music-droid    文件:NavigationUtils.java   
@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();

}
项目:Mix    文件:OrderDialogFragment.java   
@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);
}
项目:chaosflix    文件:BrowseActivity.java   
@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();
            }));
}
项目:From-design-to-Android-part1    文件:OrderDialogFragment.java   
@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);
}
项目:AnimationShowcase    文件:FragmentSharedElementTransitionSource.java   
@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();
}
项目:Alligator    文件:SampleTransitionAnimationProvider.java   
@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);
    }
}
项目:Harmony-Music-Player    文件:NavigationUtils.java   
@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();
}
项目:Muzesto    文件:NavigationUtils.java   
@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();

}
项目:Muzesto    文件:NavigationUtils.java   
@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();

}
项目:AndroidAnimationExercise    文件:SwitchAnimActivity.java   
@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);
    }

}
项目:librus-client    文件:AnnouncementsFragment.java   
@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();
}
项目:sunny-reader    文件:MainActivity.java   
@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();
}
项目:Amumu    文件:AboutActivity.java   
@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();
                }
            });
}
项目:ticdesign    文件:ContentActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_content);
    ButterKnife.bind(this);

    if (getIntent() != null) {
        int avatar = getIntent().getIntExtra(getString(R.string.transition_shared_avatar), 0);
        String title = getIntent().getStringExtra(getString(R.string.transition_shared_title));

        if (avatar > 0) {
            imageAvatar.setImageResource(avatar);
            colorize(((BitmapDrawable) imageAvatar.getDrawable()).getBitmap());
        }
        if (title != null) {
            textTitle.setText(title);
        }

        Transition transition =
                TransitionInflater.from(this).inflateTransition(R.transition.slide_bottom);
        getWindow().setEnterTransition(transition);
    }
}
项目:android-proguards    文件:AboutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    pager.setAdapter(new AboutPagerAdapter(AboutActivity.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();
                }
            });
}
项目:OldDriver-master    文件:AboutActivity.java   
@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();
                }
            });
}
项目:mosby    文件:DetailsFragment.java   
@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()));
  }
项目:honki_android    文件:FragmentTransitionsFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Transitionsを生成
    TransitionInflater ti = TransitionInflater.from(getActivity());

    // 指定されたタイプの Transitions を設定
    int viewId = getArguments().getInt(EXTRA_TRANSITIONS_TYPE_VIEW_ID);
    if (viewId == R.id.btn_add_fragment_explode) {
        setEnterTransition(ti.inflateTransition(android.R.transition.explode));
        setExitTransition(ti.inflateTransition(android.R.transition.explode));
    } else if (viewId == R.id.btn_add_fragment_fade) {
        setEnterTransition(ti.inflateTransition(android.R.transition.fade));
        setExitTransition(ti.inflateTransition(android.R.transition.fade));
    } else if (viewId == R.id.btn_add_fragment_slide) {
        setEnterTransition(ti.inflateTransition(android.R.transition.slide_left));
        setExitTransition(ti.inflateTransition(android.R.transition.slide_right));
    } else {
        // "NONE"押下時。この場合何もセットしない
    }
}
项目:honki_android    文件:FragmentTransitionsFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Transitionsを生成
    TransitionInflater ti = TransitionInflater.from(getActivity());

    // 指定されたタイプの Transitions を設定
    int viewId = getArguments().getInt(EXTRA_TRANSITIONS_TYPE_VIEW_ID);
    if (viewId == R.id.btn_add_fragment_explode) {
        setEnterTransition(ti.inflateTransition(android.R.transition.explode));
        setExitTransition(ti.inflateTransition(android.R.transition.explode));
    } else if (viewId == R.id.btn_add_fragment_fade) {
        setEnterTransition(ti.inflateTransition(android.R.transition.fade));
        setExitTransition(ti.inflateTransition(android.R.transition.fade));
    } else if (viewId == R.id.btn_add_fragment_slide) {
        setEnterTransition(ti.inflateTransition(android.R.transition.slide_left));
        setExitTransition(ti.inflateTransition(android.R.transition.slide_right));
    } else {
        // "NONE"押下時。この場合何もセットしない
    }
}
项目:chanobol    文件:PostsDialog.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void animatePostsArrival() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        postsView.setVisibility(View.INVISIBLE);
        postsView.postDelayed(new Runnable() {
            @Override public void run() {
                revealBackground();
                postsView.setVisibility(View.GONE);
                Transition t = TransitionInflater.from(getActivity()).inflateTransition(R.transition.postsdialog);
                TransitionManager.beginDelayedTransition(postsView, t);
                postsView.setVisibility(View.VISIBLE);
            }
        }, 10);
    } else {
        background.setVisibility(View.VISIBLE);
    }
}
项目:plaid    文件:AboutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    pager.setAdapter(new AboutPagerAdapter(AboutActivity.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();
                }
            });
}
项目:ApkLauncher    文件:Transitions.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.transition);

    mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);

    TransitionInflater inflater = TransitionInflater.from(this);

    // Note that this is not the only way to create a Scene object, but that
    // loading them from layout resources cooperates with the
    // TransitionManager that we are also loading from resources, and which
    // uses the same layout resource files to determine the scenes to transition
    // from/to.
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
    mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr,
            mSceneRoot);
}
项目:binea_project_for_android    文件:ScenesSample.java   
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scenes, container, false);

    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.select_scene);
    radioGroup.setOnCheckedChangeListener(this);
    mSceneRoot = (ViewGroup) view.findViewById(R.id.scene_root);

    // A Scene can be instantiated from a live view hierarchy.
    mScene1 = new Scene(mSceneRoot, mSceneRoot.findViewById(R.id.container));

    // You can also inflate a generate a Scene from a layout resource file.
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, getContext());

    // Another scene from a layout resource file.
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene3, getContext());

    // We create a custom TransitionManager for Scene 3, in which ChangeBounds, Fade and
    // ChangeImageTransform take place at the same time.
    mTransitionManagerForScene3 = TransitionInflater.from(getContext()).inflateTransitionManager(R.anim.scene3_transition_manager, mSceneRoot);

    return view;
}
项目:ApiDemos    文件:Transitions.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.transition);

    mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);

    TransitionInflater inflater = TransitionInflater.from(this);

    // Note that this is not the only way to create a Scene object, but that
    // loading them from layout resources cooperates with the
    // TransitionManager that we are also loading from resources, and which
    // uses the same layout resource files to determine the scenes to transition
    // from/to.
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
    mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr,
            mSceneRoot);
}
项目:chanobol    文件:PostsDialog.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void animatePostsArrival() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        postsView.setVisibility(View.INVISIBLE);
        postsView.postDelayed(new Runnable() {
            @Override public void run() {
                revealBackground();
                postsView.setVisibility(View.GONE);
                Transition t = TransitionInflater.from(getActivity()).inflateTransition(R.transition.postsdialog);
                TransitionManager.beginDelayedTransition(postsView, t);
                postsView.setVisibility(View.VISIBLE);
            }
        }, 10);
    } else {
        background.setVisibility(View.VISIBLE);
    }
}
项目:EhViewer    文件:GalleryDetailScene.java   
@Override
public boolean onTransition(Context context,
        FragmentTransaction transaction, Fragment exit, Fragment enter) {
    if (!(enter instanceof GalleryListScene) && !(enter instanceof DownloadsScene) &&
            !(enter instanceof FavoritesScene) && !(enter instanceof HistoryScene)) {
        return false;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        exit.setSharedElementReturnTransition(
                TransitionInflater.from(context).inflateTransition(R.transition.trans_move));
        exit.setExitTransition(
                TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
        enter.setSharedElementEnterTransition(
                TransitionInflater.from(context).inflateTransition(R.transition.trans_move));
        enter.setEnterTransition(
                TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
        transaction.addSharedElement(mThumb, mThumb.getTransitionName());
    }
    return true;
}
项目:EhViewer    文件:EnterGalleryDetailTransaction.java   
@Override
public boolean onTransition(Context context, FragmentTransaction transaction,
        Fragment exit, Fragment enter) {
    if (mThumb == null || !(enter instanceof GalleryDetailScene)) {
        return false;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        exit.setSharedElementReturnTransition(
                TransitionInflater.from(context).inflateTransition(R.transition.trans_move));
        exit.setExitTransition(
                TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
        enter.setSharedElementEnterTransition(
                TransitionInflater.from(context).inflateTransition(R.transition.trans_move));
        enter.setEnterTransition(
                TransitionInflater.from(context).inflateTransition(android.R.transition.fade));
        transaction.addSharedElement(mThumb, mThumb.getTransitionName());
    }
    return true;
}
项目:felix-on-android    文件:Transitions.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.transition);

    mSceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);

    TransitionInflater inflater = TransitionInflater.from(this);

    // Note that this is not the only way to create a Scene object, but that
    // loading them from layout resources cooperates with the
    // TransitionManager that we are also loading from resources, and which
    // uses the same layout resource files to determine the scenes to transition
    // from/to.
    mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene1, this);
    mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene2, this);
    mScene3 = Scene.getSceneForLayout(mSceneRoot, R.layout.transition_scene3, this);
    mTransitionManager = inflater.inflateTransitionManager(R.transition.transitions_mgr,
            mSceneRoot);
}
项目:GitHub    文件:SharedElementActivityActivity.java   
@Override
public void initView(Bundle savedInstanceState, View view) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Explode explode = (Explode) TransitionInflater.from(this).inflateTransition(R.transition.explode_1000);
        Fade fade = (Fade) TransitionInflater.from(this).inflateTransition(R.transition.fade_1000);
        getWindow().setEnterTransition(fade);
        getWindow().setExitTransition(explode);
    }
    findViewById(android.R.id.content).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SharedElementActivityActivity.start(SharedElementActivityActivity.this);
        }
    });
}
项目:GitHub    文件:ActivityActivity.java   
@Override
public void initView(Bundle savedInstanceState, View view) {
    getToolBar().setTitle(getString(R.string.demo_activity));
    viewSharedElement = (ImageView) findViewById(R.id.view_shared_element);
    findViewById(R.id.btn_cls).setOnClickListener(this);
    findViewById(R.id.btn_cls_opt_anim).setOnClickListener(this);
    findViewById(R.id.btn_cls_opt_shared).setOnClickListener(this);
    findViewById(R.id.btn_cls_opt_scale_up).setOnClickListener(this);
    findViewById(R.id.btn_cls_opt_thumbnail_scale_up).setOnClickListener(this);
    findViewById(R.id.btn_cls_opt_clip_reveal).setOnClickListener(this);
    findViewById(R.id.btn_cls_anim).setOnClickListener(this);
    findViewById(R.id.btn_shared_element).setOnClickListener(this);
    findViewById(R.id.btn_start_home_activity).setOnClickListener(this);
    findViewById(R.id.btn_finish_all_activity).setOnClickListener(this);
    TextView tvAboutActivity = (TextView) findViewById(R.id.tv_about_activity);
    tvAboutActivity.setText("Is ImageActivity Exists: " + ActivityUtils.isActivityExists(Config.PKG, ImageActivity.class.getName())
            + "\ngetLauncherActivity: " + ActivityUtils.getLauncherActivity(Config.PKG)
            + "\ngetTopActivity: " + ActivityUtils.getTopActivity()
    );
    bitmap = ((BitmapDrawable) viewSharedElement.getDrawable()).getBitmap();

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Explode explode = (Explode) TransitionInflater.from(this).inflateTransition(R.transition.explode_1000);
        Fade fade = (Fade) TransitionInflater.from(this).inflateTransition(R.transition.fade_1000);
        getWindow().setEnterTransition(explode);
        getWindow().setReturnTransition(fade);
    }
}
项目:shared-element-transitions    文件:PicassoFragmentB.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    postponeEnterTransition();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setSharedElementEnterTransition(TransitionInflater.from(getContext()).inflateTransition(android.R.transition.move));
    }
}
项目:shared-element-transitions    文件:AnimalViewPagerFragment.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    postponeEnterTransition();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setSharedElementEnterTransition(TransitionInflater.from(getContext()).inflateTransition(android.R.transition.move));
    }
    setSharedElementReturnTransition(null);
}
项目:shared-element-transitions    文件:AnimalDetailFragment.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    postponeEnterTransition();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setSharedElementEnterTransition(TransitionInflater.from(getContext()).inflateTransition(android.R.transition.move));
    }
}
项目:shared-element-transitions    文件:GlideFragmentB.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    postponeEnterTransition();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setSharedElementEnterTransition(TransitionInflater.from(getContext()).inflateTransition(android.R.transition.move));
    }
}
项目:shared-element-transitions    文件:SimpleFragmentB.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setSharedElementEnterTransition(TransitionInflater.from(getContext()).inflateTransition(android.R.transition.move));
    }
}