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;
}
Aggregations