android.transition.Visibility Java Examples

The following examples show how to use android.transition.Visibility. 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: ActivityTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Blocks suppressLayout from Visibility transitions. It is ok to suppress the layout,
 * but we don't want to force the layout when suppressLayout becomes false. This leads
 * to visual glitches.
 */
private static void noLayoutSuppressionForVisibilityTransitions(Transition transition) {
    if (transition instanceof Visibility) {
        final Visibility visibility = (Visibility) transition;
        visibility.setSuppressLayout(false);
    } else if (transition instanceof TransitionSet) {
        final TransitionSet set = (TransitionSet) transition;
        final int count = set.getTransitionCount();
        for (int i = 0; i < count; i++) {
            noLayoutSuppressionForVisibilityTransitions(set.getTransitionAt(i));
        }
    }
}
 
Example #2
Source File: OfflineDownloadBaseActivity.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected Visibility buildEnterTransition() {
    Slide enterTransition = new Slide();
    enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    enterTransition.setSlideEdge(Gravity.RIGHT); //从右边滑动进入
    return enterTransition;
}
 
Example #3
Source File: TransitionAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 4 votes vote down vote up
/**
 * TransitionsViewGroup's item onClick Event
 *
 * @param v v's position in v's parent(TransitionsViewGroup):
 *          position =
 *          0: Explode by code;
 *          1: Explode by xml;
 *          2: Slide by code;
 *          3: Slide by xml;
 *          4: Exit;
 *          5: Exit by Overriding return transition.
 */
@Override
@SuppressWarnings("unchecked")
public void onClick(View v) {
    for (int i = 0; i < ((ViewGroup) v.getParent()).getChildCount(); i++) {
        if (v == (((ViewGroup) v.getParent()).getChildAt(i))) {
            switch (i) {
                case 0:
                    Intent explodeByCodeIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationByExplodeActivity.class);
                    explodeByCodeIntent.putExtra(TransitionAnimationByExplodeActivity.EXPLODE_TYPE, TransitionAnimationByExplodeActivity.EXPLODE_CODE);
                    startActivity(explodeByCodeIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 1:
                    Intent explodeByXmlIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationByExplodeActivity.class);
                    explodeByXmlIntent.putExtra(TransitionAnimationByExplodeActivity.EXPLODE_TYPE, TransitionAnimationByExplodeActivity.EXPLODE_XML);
                    startActivity(explodeByXmlIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 2:
                    Intent slideByCodeIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationBySlideActivity.class);
                    slideByCodeIntent.putExtra(TransitionAnimationBySlideActivity.SLIDE_TYPE, TransitionAnimationBySlideActivity.SLIDE_CODE);
                    startActivity(slideByCodeIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 3:
                    Intent slideByXmlIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationBySlideActivity.class);
                    slideByXmlIntent.putExtra(TransitionAnimationBySlideActivity.SLIDE_TYPE, TransitionAnimationBySlideActivity.SLIDE_XML);
                    startActivity(slideByXmlIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 4:
                    finishAfterTransition();
                    break;
                case 5:
                    Visibility returnTransition = buildReturnTransition();
                    getWindow().setReturnTransition(returnTransition);
                    finishAfterTransition();
                    break;
                default:
                    break;
            }
            break;
        }
    }
}
 
Example #4
Source File: TransitionAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 4 votes vote down vote up
private Visibility buildReturnTransition() {
    Visibility enterTransition = new Slide();
    enterTransition.setDuration(500);
    return enterTransition;
}
 
Example #5
Source File: TransitionAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
/**
 * TransitionsViewGroup's item onClick Event
 *
 * @param v v's position in v's parent(TransitionsViewGroup):
 *          position =
 *          0: Explode by code;
 *          1: Explode by xml;
 *          2: Slide by code;
 *          3: Slide by xml;
 *          4: Exit;
 *          5: Exit by Overriding return transition.
 */
@Override
@SuppressWarnings("unchecked")
public void onClick(View v) {
    for (int i = 0; i < ((ViewGroup) v.getParent()).getChildCount(); i++) {
        if (v == (((ViewGroup) v.getParent()).getChildAt(i))) {
            switch (i) {
                case 0:
                    Intent explodeByCodeIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationByExplodeActivity.class);
                    explodeByCodeIntent.putExtra(TransitionAnimationByExplodeActivity.EXPLODE_TYPE, TransitionAnimationByExplodeActivity.EXPLODE_CODE);
                    startActivity(explodeByCodeIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 1:
                    Intent explodeByXmlIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationByExplodeActivity.class);
                    explodeByXmlIntent.putExtra(TransitionAnimationByExplodeActivity.EXPLODE_TYPE, TransitionAnimationByExplodeActivity.EXPLODE_XML);
                    startActivity(explodeByXmlIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 2:
                    Intent slideByCodeIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationBySlideActivity.class);
                    slideByCodeIntent.putExtra(TransitionAnimationBySlideActivity.SLIDE_TYPE, TransitionAnimationBySlideActivity.SLIDE_CODE);
                    startActivity(slideByCodeIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 3:
                    Intent slideByXmlIntent = new Intent(TransitionAnimationActivity.this, TransitionAnimationBySlideActivity.class);
                    slideByXmlIntent.putExtra(TransitionAnimationBySlideActivity.SLIDE_TYPE, TransitionAnimationBySlideActivity.SLIDE_XML);
                    startActivity(slideByXmlIntent, ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle());
                    break;
                case 4:
                    finishAfterTransition();
                    break;
                case 5:
                    Visibility returnTransition = buildReturnTransition();
                    getWindow().setReturnTransition(returnTransition);
                    finishAfterTransition();
                    break;
                default:
                    break;
            }
            break;
        }
    }
}
 
Example #6
Source File: TransitionAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
private Visibility buildReturnTransition() {
    Visibility enterTransition = new Slide();
    enterTransition.setDuration(500);
    return enterTransition;
}