Search in sources :

Example 1 with ChangeBounds

use of com.transitionseverywhere.ChangeBounds 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)

Example 2 with ChangeBounds

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

the class TransitionNameSample method onCreateView.

@Nullable
@Override
@SuppressLint("DefaultLocale")
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_names, container, false);
    final ViewGroup layout = (ViewGroup) view.findViewById(R.id.transitions_container);
    final Button button = (Button) view.findViewById(R.id.button1);
    final List<String> titles = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        titles.add(String.format("Item %d", i + 1));
    }
    createViews(inflater, layout, titles);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(layout, new ChangeBounds());
            Collections.shuffle(titles);
            createViews(inflater, layout, titles);
        }
    });
    return view;
}
Also used : Button(android.widget.Button) ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) ArrayList(java.util.ArrayList) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint) Nullable(android.support.annotation.Nullable)

Example 3 with ChangeBounds

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

the class ImageTransformSample method onCreateView.

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

        boolean mExpanded;

        @Override
        public void onClick(View v) {
            mExpanded = !mExpanded;
            TransitionManager.beginDelayedTransition(transitionsContainer, new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeImageTransform()));
            ViewGroup.LayoutParams params = imageView.getLayoutParams();
            params.height = mExpanded ? ViewGroup.LayoutParams.MATCH_PARENT : ViewGroup.LayoutParams.WRAP_CONTENT;
            imageView.setLayoutParams(params);
            imageView.setScaleType(mExpanded ? ImageView.ScaleType.CENTER_CROP : ImageView.ScaleType.FIT_CENTER);
        }
    });
    return view;
}
Also used : TransitionSet(com.transitionseverywhere.TransitionSet) ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) ChangeImageTransform(com.transitionseverywhere.ChangeImageTransform) Nullable(android.support.annotation.Nullable)

Example 4 with ChangeBounds

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

the class InterpolatorDurationStartDelaySample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_interpolator, 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) {
            mToRightAnimation = !mToRightAnimation;
            Transition transition = new ChangeBounds();
            transition.setDuration(mToRightAnimation ? 700 : 300);
            transition.setInterpolator(mToRightAnimation ? new FastOutSlowInInterpolator() : new AccelerateInterpolator());
            transition.setStartDelay(mToRightAnimation ? 0 : 500);
            TransitionManager.beginDelayedTransition(transitionsContainer, transition);
            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
            params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.TOP) : (Gravity.LEFT | Gravity.TOP);
            button.setLayoutParams(params);
        }
    });
    return view;
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) FrameLayout(android.widget.FrameLayout) Transition(com.transitionseverywhere.Transition) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)4 View (android.view.View)4 ViewGroup (android.view.ViewGroup)4 ChangeBounds (com.transitionseverywhere.ChangeBounds)4 FrameLayout (android.widget.FrameLayout)2 SuppressLint (android.annotation.SuppressLint)1 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)1 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)1 Button (android.widget.Button)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ArcMotion (com.transitionseverywhere.ArcMotion)1 ChangeImageTransform (com.transitionseverywhere.ChangeImageTransform)1 Transition (com.transitionseverywhere.Transition)1 TransitionSet (com.transitionseverywhere.TransitionSet)1 ArrayList (java.util.ArrayList)1