Search in sources :

Example 1 with SectionInfoFragment

use of com.tevinjeffrey.rutgersct.ui.sectioninfo.SectionInfoFragment 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)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)1 Fade (android.transition.Fade)1 Transition (android.transition.Transition)1 SectionInfoFragment (com.tevinjeffrey.rutgersct.ui.sectioninfo.SectionInfoFragment)1 CircleSharedElementCallback (com.tevinjeffrey.rutgersct.ui.utils.CircleSharedElementCallback)1 CircleView (com.tevinjeffrey.rutgersct.ui.utils.CircleView)1