Search in sources :

Example 1 with ArcMotion

use of com.transitionseverywhere.ArcMotion in project Transitions-Everywhere by andkulikov.

the class PathMotionSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_path, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final View button = transitionsContainer.findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {

        boolean mToRightAnimation;

        @Override
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new ChangeBounds().setPathMotion(new ArcMotion()).setDuration(500));
            mToRightAnimation = !mToRightAnimation;
            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
            params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.BOTTOM) : (Gravity.LEFT | Gravity.TOP);
            button.setLayoutParams(params);
        }
    });
    return view;
}
Also used : ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) FrameLayout(android.widget.FrameLayout) View(android.view.View) ArcMotion(com.transitionseverywhere.ArcMotion) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 FrameLayout (android.widget.FrameLayout)1 ArcMotion (com.transitionseverywhere.ArcMotion)1 ChangeBounds (com.transitionseverywhere.ChangeBounds)1