Search in sources :

Example 86 with Transition

use of android.transition.Transition in project ion by koush.

the class LollipopTransitionFullscreen method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lollipop_fullscreen);
    final ImageView iv = (ImageView) findViewById(R.id.image);
    String bitmapKey = getIntent().getStringExtra("bitmapInfo");
    BitmapInfo bi = Ion.getDefault(this).getBitmapCache().get(bitmapKey);
    iv.setImageBitmap(bi.bitmap);
    final int thumb = getIntent().getIntExtra("thumb", 1);
    getWindow().getEnterTransition().addListener(new Transition.TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            getWindow().getEnterTransition().removeListener(this);
            // load the full version, crossfading from the thumbnail image
            Ion.with(iv).crossfade(true).load("https://raw.githubusercontent.com/koush/SampleImages/master/" + thumb + ".jpg");
        }
    });
}
Also used : Transition(android.transition.Transition) ImageView(android.widget.ImageView) BitmapInfo(com.koushikdutta.ion.bitmap.BitmapInfo)

Example 87 with Transition

use of android.transition.Transition in project BottomSheet by soarcn.

the class BottomSheet method showFullItems.

private void showFullItems() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Transition changeBounds = new ChangeBounds();
        changeBounds.setDuration(300);
        TransitionManager.beginDelayedTransition(list, changeBounds);
    }
    actions = fullMenuItem;
    updateSection();
    adapter.notifyDataSetChanged();
    list.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    icon.setVisibility(View.VISIBLE);
    icon.setImageDrawable(close);
    icon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showShortItems();
        }
    });
    setListLayout();
}
Also used : ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 88 with Transition

use of android.transition.Transition in project Douya by DreaminginCodeZH.

the class TransitionUtils method setEnterReturnExplode.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setEnterReturnExplode(Fragment fragment) {
    if (!shouldEnableTransition()) {
        return;
    }
    Window window = fragment.getActivity().getWindow();
    Transition explode = new Explode().excludeTarget(android.R.id.statusBarBackground, true).excludeTarget(android.R.id.navigationBarBackground, true);
    window.setEnterTransition(explode);
    window.setReturnTransition(explode);
}
Also used : Window(android.view.Window) Explode(android.transition.Explode) Transition(android.transition.Transition) TargetApi(android.annotation.TargetApi)

Example 89 with Transition

use of android.transition.Transition in project Conductor by bluelinelabs.

the class ArcFadeMoveChangeHandler method getSharedElementTransition.

@Nullable
@Override
public Transition getSharedElementTransition(@NonNull ViewGroup container, @Nullable final View from, @Nullable View to, boolean isPush) {
    Transition transition = new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform());
    transition.setPathMotion(new ArcMotion());
    // The framework doesn't totally fade out the "from" shared element, so we'll hide it manually once it's safe.
    transition.addListener(new TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
            if (from != null) {
                for (String name : sharedElementNames) {
                    View namedView = TransitionUtils.findNamedView(from, name);
                    if (namedView != null) {
                        namedView.setVisibility(View.INVISIBLE);
                    }
                }
            }
        }

        @Override
        public void onTransitionEnd(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    return transition;
}
Also used : ChangeTransform(android.transition.ChangeTransform) TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) TransitionListener(android.transition.Transition.TransitionListener) View(android.view.View) ArcMotion(android.transition.ArcMotion) ChangeClipBounds(android.transition.ChangeClipBounds) Nullable(android.support.annotation.Nullable)

Example 90 with Transition

use of android.transition.Transition in project Conductor by bluelinelabs.

the class TransitionUtils method replaceTargets.

public static void replaceTargets(@NonNull Transition transition, @NonNull List<View> oldTargets, @Nullable List<View> newTargets) {
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            replaceTargets(child, oldTargets, newTargets);
        }
    } else if (!TransitionUtils.hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == oldTargets.size() && targets.containsAll(oldTargets)) {
            final int targetCount = newTargets == null ? 0 : newTargets.size();
            for (int i = 0; i < targetCount; i++) {
                transition.addTarget(newTargets.get(i));
            }
            for (int i = oldTargets.size() - 1; i >= 0; i--) {
                transition.removeTarget(oldTargets.get(i));
            }
        }
    }
}
Also used : TransitionSet(android.transition.TransitionSet) Transition(android.transition.Transition) List(java.util.List)

Aggregations

Transition (android.transition.Transition)176 TransitionSet (android.transition.TransitionSet)62 View (android.view.View)54 ViewGroup (android.view.ViewGroup)37 ArrayList (java.util.ArrayList)23 TransitionInflater (android.transition.TransitionInflater)19 Fade (android.transition.Fade)18 ViewTreeObserver (android.view.ViewTreeObserver)18 ChangeBounds (android.transition.ChangeBounds)17 Rect (android.graphics.Rect)12 List (java.util.List)12 TargetApi (android.annotation.TargetApi)11 TextView (android.widget.TextView)11 AutoTransition (android.transition.AutoTransition)10 Scene (android.transition.Scene)8 ObjectAnimator (android.animation.ObjectAnimator)7 Fragment (android.support.v4.app.Fragment)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 AdapterView (android.widget.AdapterView)6 ImageView (android.widget.ImageView)6