andkulikov / Transitions-Everywhere

Set of extra Transitions on top of Jetpack Transitions Library
Apache License 2.0
4.83k stars 486 forks source link

[Question] How to set duration when calling slide transition #72

Closed HyowonHwang closed 7 years ago

HyowonHwang commented 7 years ago

I have been testing Slide transition based slidesample code. However, visible and gone effect are so fast, I would like to make slide animation slower than current thing. Could you please guide me if there is any?

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_slide, container, false);

    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView text = (TextView) transitionsContainer.findViewById(R.id.text);

    transitionsContainer.findViewById(R.id.button).setOnClickListener(new VisibleToggleClickListener() {
        @Override
        protected void changeVisibility(boolean visible) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Slide(Gravity.BOTTOM));
            text.setVisibility(visible ? View.VISIBLE : View.GONE);
        }
    });

    return view;
andkulikov commented 7 years ago

Hi. Every transition has setDuration method. Like new Slide(Gravity.BOTTOM).setDuration(500) You can read more about usage here https://medium.com/@andkulikov/animate-all-the-things-transitions-in-android-914af5477d50 And also I had specal sample fragment with duration in the repo