Search in sources :

Example 1 with CircleSharedElementCallback

use of com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback in project Rutgers-Course-Tracker by tevjef.

the class CourseInfoFragment method startSectionInfoFragment.

private void startSectionInfoFragment(Bundle b, View clickedView) {
    SectionInfoFragment sectionInfoFragment = new SectionInfoFragment();
    FragmentTransaction ft = this.getFragmentManager().beginTransaction();
    CircleView circleView = ButterKnife.findById(clickedView, R.id.section_number_background);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        circleView.setTransitionName(getString(R.string.transition_name_circle_view));
        ft.addSharedElement(circleView, getString(R.string.transition_name_circle_view));
        mAppBarLayout.setTransitionName(null);
        Transition cifSectionEnter = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.cif_section_enter);
        Transition cifSectionReturn = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.cif_section_return);
        sectionInfoFragment.setEnterTransition(cifSectionEnter);
        sectionInfoFragment.setReturnTransition(cifSectionReturn);
        setReenterTransition(new Fade(Fade.IN).setDuration(200));
        Transition cifExit = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.cif_exit);
        setExitTransition(cifExit);
        sectionInfoFragment.setAllowReturnTransitionOverlap(false);
        sectionInfoFragment.setAllowEnterTransitionOverlap(false);
        Transition sharedElementsEnter = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.cif_shared_element_enter);
        Transition sharedElementsReturn = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.cif_shared_element_return);
        sectionInfoFragment.setSharedElementEnterTransition(sharedElementsEnter);
        sectionInfoFragment.setSharedElementReturnTransition(sharedElementsReturn);
        CircleSharedElementCallback sharedelementCallback = new CircleSharedElementCallback();
        sectionInfoFragment.setEnterSharedElementCallback(sharedelementCallback);
        sharedElementsEnter.addListener(sharedelementCallback.getTransitionCallback());
    } else {
        ft.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
    }
    sectionInfoFragment.setArguments(b);
    startFragment(this, sectionInfoFragment, ft);
}
Also used : CircleSharedElementCallback(com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback) FragmentTransaction(android.app.FragmentTransaction) SectionInfoFragment(com.tevinjeffrey.rutgersct.ui.sectioninfo.SectionInfoFragment) Transition(android.transition.Transition) CircleView(com.tevinjeffrey.rutgersct.ui.utils.CircleView) Fade(android.transition.Fade)

Example 2 with CircleSharedElementCallback

use of com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback in project Rutgers-Course-Tracker by tevjef.

the class TrackedSectionsFragment method startSectionInfoFragment.

private void startSectionInfoFragment(SectionInfoFragment sectionInfoFragment, View view) {
    FragmentTransaction ft = this.getFragmentManager().beginTransaction();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        CircleView circleView = ButterKnife.findById(view, R.id.section_number_background);
        mFab.setTransitionName(getString(R.string.transition_name_fab));
        ft.addSharedElement(mFab, getString(R.string.transition_name_fab));
        circleView.setTransitionName(getString(R.string.transition_name_circle_view));
        ft.addSharedElement(circleView, getString(R.string.transition_name_circle_view));
        Transition tsfSectionEnter = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.tsf_section_enter);
        Transition tsfSectionReturn = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.tsf_section_return);
        sectionInfoFragment.setEnterTransition(tsfSectionEnter);
        sectionInfoFragment.setReturnTransition(tsfSectionReturn);
        setReenterTransition(new Fade(Fade.IN).addTarget(RecyclerView.class));
        setExitTransition(new Fade(Fade.OUT).addTarget(RecyclerView.class));
        sectionInfoFragment.setAllowReturnTransitionOverlap(false);
        sectionInfoFragment.setAllowEnterTransitionOverlap(false);
        Transition sharedElementsEnter = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.tsf_shared_element_enter);
        Transition sharedElementsReturn = TransitionInflater.from(getParentActivity()).inflateTransition(R.transition.tsf_shared_element_return);
        sectionInfoFragment.setSharedElementEnterTransition(sharedElementsEnter);
        sectionInfoFragment.setSharedElementReturnTransition(sharedElementsReturn);
        CircleSharedElementCallback sharedelementCallback = new CircleSharedElementCallback();
        sectionInfoFragment.setEnterSharedElementCallback(sharedelementCallback);
        sharedElementsEnter.addListener(sharedelementCallback.getTransitionCallback());
    } else {
        ft.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
    }
    startFragment(this, sectionInfoFragment, ft);
}
Also used : CircleSharedElementCallback(com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback) FragmentTransaction(android.app.FragmentTransaction) Transition(android.transition.Transition) CircleView(com.tevinjeffrey.rutgersct.ui.utils.CircleView) RecyclerView(android.support.v7.widget.RecyclerView) Fade(android.transition.Fade)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)2 Fade (android.transition.Fade)2 Transition (android.transition.Transition)2 CircleSharedElementCallback (com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback)2 CircleView (com.tevinjeffrey.rutgersct.ui.utils.CircleView)2 RecyclerView (android.support.v7.widget.RecyclerView)1 SectionInfoFragment (com.tevinjeffrey.rutgersct.ui.sectioninfo.SectionInfoFragment)1