Java Code Examples for android.transition.Transition#setDuration()

The following examples show how to use android.transition.Transition#setDuration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgramEventDetailActivity.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
@Override
public void showHideFilter() {
    Transition transition = new ChangeBounds();
    transition.setDuration(200);
    TransitionManager.beginDelayedTransition(binding.backdropLayout, transition);
    backDropActive = !backDropActive;
    ConstraintSet initSet = new ConstraintSet();
    initSet.clone(binding.backdropLayout);
    binding.filterOpen.setVisibility(backDropActive ? View.VISIBLE : View.GONE);

    if (backDropActive) {
        initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.filterLayout, ConstraintSet.BOTTOM, 50);
    } else {
        initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.backdropGuideTop, ConstraintSet.BOTTOM, 0);
    }

    initSet.applyTo(binding.backdropLayout);
}
 
Example 2
Source File: SearchTEActivity.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void swipeFilters(boolean general) {
    Transition transition = new ChangeBounds();
    transition.setDuration(200);
    TransitionManager.beginDelayedTransition(binding.backdropLayout, transition);
    if (backDropActive && !general && switchOpenClose == 0)
        switchOpenClose = 1;
    else if (backDropActive && general && switchOpenClose == 1)
        switchOpenClose = 0;
    else {
        switchOpenClose = general ? 0 : 1;
        backDropActive = !backDropActive;
    }
    binding.filterOpen.setVisibility(backDropActive ? View.VISIBLE : View.GONE);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
        activeFilter(general);
}
 
Example 3
Source File: DataSetDetailActivity.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void showHideFilter() {
    Transition transition = new ChangeBounds();
    transition.setDuration(200);
    TransitionManager.beginDelayedTransition(binding.backdropLayout, transition);
    backDropActive = !backDropActive;
    ConstraintSet initSet = new ConstraintSet();
    initSet.clone(binding.backdropLayout);
    if (backDropActive) {
        initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.filterLayout, ConstraintSet.BOTTOM, 50);
    }
    else {
        initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.backdropGuideTop, ConstraintSet.BOTTOM, 0);
    }
    initSet.applyTo(binding.backdropLayout);

    binding.filterOpen.setVisibility(backDropActive ? View.VISIBLE : View.GONE);
}
 
Example 4
Source File: SampleTransitionAnimationProvider.java    From Alligator with MIT License 6 votes vote down vote up
@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);
	}
}
 
Example 5
Source File: AlbumDetailActivity.java    From android-animations-transitions with MIT License 6 votes vote down vote up
private Transition createTransition() {
    TransitionSet set = new TransitionSet();
    set.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);

    Transition tFab = new Scale();
    tFab.setDuration(150);
    tFab.addTarget(fab);

    Transition tTitle = new Fold();
    tTitle.setDuration(150);
    tTitle.addTarget(titlePanel);

    Transition tTrack = new Fold();
    tTrack.setDuration(150);
    tTrack.addTarget(trackPanel);

    set.addTransition(tTrack);
    set.addTransition(tTitle);
    set.addTransition(tFab);

    return set;
}
 
Example 6
Source File: ViewActivity.java    From recurrence with GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}