Search in sources :

Example 1 with Visibility

use of android.transition.Visibility in project Material-Animations by lgvalle.

the class TransitionActivity1 method setupLayout.

private void setupLayout() {
    findViewById(R.id.sample1_button1).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(TransitionActivity1.this, TransitionActivity2.class);
            i.putExtra(EXTRA_SAMPLE, sample);
            i.putExtra(EXTRA_TYPE, TYPE_PROGRAMMATICALLY);
            transitionTo(i);
        }
    });
    findViewById(R.id.sample1_button2).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(TransitionActivity1.this, TransitionActivity2.class);
            i.putExtra(EXTRA_SAMPLE, sample);
            i.putExtra(EXTRA_TYPE, TYPE_XML);
            transitionTo(i);
        }
    });
    findViewById(R.id.sample1_button3).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(TransitionActivity1.this, TransitionActivity3.class);
            i.putExtra(EXTRA_SAMPLE, sample);
            i.putExtra(EXTRA_TYPE, TYPE_PROGRAMMATICALLY);
            transitionTo(i);
        }
    });
    findViewById(R.id.sample1_button4).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(TransitionActivity1.this, TransitionActivity3.class);
            i.putExtra(EXTRA_SAMPLE, sample);
            i.putExtra(EXTRA_TYPE, TYPE_XML);
            transitionTo(i);
        }
    });
    findViewById(R.id.sample1_button5).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Visibility returnTransition = buildReturnTransition();
            getWindow().setReturnTransition(returnTransition);
            finishAfterTransition();
        }
    });
    findViewById(R.id.sample1_button6).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            /**
                 * If no return transition is defined Android will use reversed enter transition
                 * In this case, return transition will be a reversed Slide (defined in buildEnterTransition)
                 */
            finishAfterTransition();
        }
    });
}
Also used : Intent(android.content.Intent) Visibility(android.transition.Visibility) View(android.view.View)

Example 2 with Visibility

use of android.transition.Visibility in project Material-Animations by lgvalle.

the class TransitionActivity1 method buildReturnTransition.

private Visibility buildReturnTransition() {
    Visibility enterTransition = new Slide();
    enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
    return enterTransition;
}
Also used : Slide(android.transition.Slide) Visibility(android.transition.Visibility)

Example 3 with Visibility

use of android.transition.Visibility in project android_frameworks_base by DirtyUnicorns.

the class ActivityTransitionCoordinator method noLayoutSuppressionForVisibilityTransitions.

/**
     * 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));
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Visibility(android.transition.Visibility)

Example 4 with Visibility

use of android.transition.Visibility in project android_frameworks_base by ResurrectionRemix.

the class ActivityTransitionCoordinator method noLayoutSuppressionForVisibilityTransitions.

/**
     * 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));
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Visibility(android.transition.Visibility)

Example 5 with Visibility

use of android.transition.Visibility in project android_frameworks_base by crdroidandroid.

the class ActivityTransitionCoordinator method noLayoutSuppressionForVisibilityTransitions.

/**
     * 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));
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Visibility(android.transition.Visibility)

Aggregations

Visibility (android.transition.Visibility)8 TransitionSet (android.transition.TransitionSet)5 Intent (android.content.Intent)1 Slide (android.transition.Slide)1 View (android.view.View)1