Example usage for android.transition ChangeBounds ChangeBounds

List of usage examples for android.transition ChangeBounds ChangeBounds

Introduction

In this page you can find the example usage for android.transition ChangeBounds ChangeBounds.

Prototype

public ChangeBounds() 

Source Link

Usage

From source file:Main.java

public static ChangeBounds getChangeBounds() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        ChangeBounds changeBounds = new ChangeBounds();
        return changeBounds;
    } else {/*  ww w.ja v a2 s  .  co m*/
        return null;
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void createChangeBoundsAnimation(View disappearingView, View appearingView) {
    Scene scene;/*  ww w . j  a  v a  2 s.  co  m*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        scene = new Scene((ViewGroup) disappearingView.getParent(), appearingView);
    } else {
        scene = new Scene((ViewGroup) disappearingView.getParent(), (ViewGroup) appearingView.getParent());
    }

    TransitionManager.beginDelayedTransition((ViewGroup) disappearingView.getParent(), new ChangeBounds());
    disappearingView.setLeft(appearingView.getLeft());
}

From source file:MainActivity.java

public void goAnimate(View view) {

    ViewGroup root = (ViewGroup) findViewById(R.id.layout);
    Scene scene = new Scene(root);

    Transition transition = new ChangeBounds();
    TransitionManager.beginDelayedTransition(root, transition);

    TextView textViewTop = (TextView) findViewById(R.id.textViewTop);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textViewTop.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
    textViewTop.setLayoutParams(params);

    TextView textViewBottom = (TextView) findViewById(R.id.textViewBottom);
    params = (RelativeLayout.LayoutParams) textViewBottom.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 1);
    textViewBottom.setLayoutParams(params);

    TransitionManager.go(scene);/*from  w w w  .j a v  a  2s  .  c  om*/

}

From source file:com.kogitune.activitytransition.fragment.FragmentTransitionLauncher.java

public void prepare(Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    if (Build.VERSION.SDK_INT >= 21) {
        toFragment.setSharedElementEnterTransition(new ChangeBounds());
        toFragment.setSharedElementReturnTransition(new ChangeBounds());
    }//from  w  w  w  .  j  a  v a 2 s.co  m
    toFragment.setArguments(transitionBundle);
}

From source file:com.kogitune.activitytransition.fragment.FragmentTransitionLauncher.java

public void prepare(android.support.v4.app.Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    if (Build.VERSION.SDK_INT >= 21) {
        toFragment.setSharedElementEnterTransition(new ChangeBounds());
        toFragment.setSharedElementReturnTransition(new ChangeBounds());
    }/*  w w  w .  ja  v  a2  s .  c  om*/
    toFragment.setArguments(transitionBundle);
}

From source file:com.kogitune.activitytransition.ActivityTransition.java

public ExitActivityTransition start(Bundle savedInstanceState) {
    if (interpolator == null) {
        interpolator = new DecelerateInterpolator();
    }/*w ww  .  j a va 2 s .  co  m*/

    final Bundle bundle = fromIntent.getExtras();
    if (Build.VERSION.SDK_INT >= 21) {
        final TransitionData transitionData = new TransitionData(toView.getContext(), bundle);
        if (transitionData.imageFilePath != null) {
            TransitionAnimation.setImageToView(toView, transitionData.imageFilePath);
        }

        ViewCompat.setTransitionName(toView, toViewName);
        final Window window = ((Activity) context).getWindow();
        TransitionSet set = new TransitionSet();
        set.addTransition(new ChangeBounds());
        set.addTransition(new ChangeImageTransform());
        set.setInterpolator(interpolator);

        window.setSharedElementEnterTransition(set);
        window.setSharedElementReturnTransition(set);

        return new ExitActivityTransition(null);
    }
    final Context context = toView.getContext();
    final MoveData moveData = TransitionAnimation.startAnimation(context, toView, bundle, savedInstanceState,
            duration, interpolator);

    return new ExitActivityTransition(moveData);
}

From source file:net.huannguyen.conductorexample.transition.DetailPushTransChangeHandler.java

@NonNull
@Override/*ww w.  j a va  2  s . co m*/
protected Transition getTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to,
        boolean isPush) {

    if (to == null || !(to instanceof CountryDetailView)) {
        throw new IllegalArgumentException("The to view must be a CountryDetailView");
    }

    final CountryDetailView detailView = (CountryDetailView) to;

    detailView.flagView.setTransitionName(flagViewTransitionName);

    ChangeTransform changeTransform = new ChangeTransform();

    // Shared elements (the flag view in this case) are drawn in the window's view overlay during the transition by default.
    // That causes the favourite fab being drawn behind the flag when it is scaled up.
    // Setting the change transform not using overlay addresses this issue.
    changeTransform.setReparentWithOverlay(false);

    return new TransitionSet()
            .addTransition(new TransitionSet().addTransition(new ChangeBounds())
                    .addTransition(new ChangeClipBounds()).addTransition(changeTransform)
                    .addTransition(new ChangeImageTransform()).setDuration(300))
            .addTransition(new Slide().addTarget(detailView.detailGroup).setStartDelay(150))
            .addTransition(new Scale().addTarget(detailView.favouriteFab).setStartDelay(300))
            .setInterpolator(new FastOutSlowInInterpolator());
}

From source file:com.melkir.ourstreets.fragment.DetailFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    mDescriptionChange = new ChangeBounds();
    mDescriptionChange.addListener(new Transition.TransitionListener() {
        @Override/* w  ww  .java 2 s  .c o m*/
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            applyMapPadding();
        }

        @Override
        public void onTransitionCancel(Transition transition) {

        }

        @Override
        public void onTransitionPause(Transition transition) {

        }

        @Override
        public void onTransitionResume(Transition transition) {

        }
    });
    if (ViewUtils.isMainDisplayInLandscape(getContext())) {
        ViewUtils.applyTopWindowInsetsForView(view.findViewById(R.id.description_layout));
    }
    loadDetails();
    if (mSelectedDetail == null) {
        setDescriptionText(mGallery);
    } else {
        setDescriptionText(mSelectedDetail);
    }
    applyMapPadding();
}

From source file:com.google.samples.apps.ourstreets.fragment.DetailFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    mDescriptionChange = new ChangeBounds();
    if (ViewUtils.isMainDisplayInLandscape(getContext())) {
        ViewUtils.applyTopWindowInsetsForView(view.findViewById(R.id.description_layout));
    }//from w  w  w .ja v  a 2 s. c  o m
    loadDetails();
    if (mSelectedDetail == null) {
        setDescriptionText(mGallery);
    } else {
        setDescriptionText(mSelectedDetail);
    }
}

From source file:com.bullmobi.message.ui.fragments.EasyNotificationFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Resources res = getResources();
    mConfigWidgetPinDuration = res.getInteger(R.integer.config_maxPinTime);
    mConfigWidgetSelectDelay = res.getInteger(R.integer.config_iconSelectDelayMillis);
    ViewConfiguration vc = ViewConfiguration.get(getActivity());
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();

    // Clock widget
    mClockWidget = new ClockWidget(this, this);

    // Media widget
    mMediaController = MediaController2.newInstance(getActivity());
    mMediaWidget = new MediaWidget(this, this);

    // Transitions
    if (Device.hasKitKatApi()) {
        mTransitionJit = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade()).addTransition(new ChangeBounds());
        mTransitionSwitchScene = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade(Fade.OUT).setDuration(200))
                .addTransition(new Fade(Fade.IN).setStartDelay(80))
                .addTransition(new ChangeBounds().setStartDelay(80));
    }/*ww  w  .j  a v a2s  .c  om*/

    // Timeout
    mTimeout = isNotDemo() ? mActivityAcd.getTimeout() : new Timeout();
}