Search in sources :

Example 1 with InfoBean

use of immortalz.me.library.bean.InfoBean in project TransitionHelper by ImmortalZ.

the class TransitionsHeleper method unBind.

public static void unBind(Activity activity) {
    if (staticMap.get(activity.getClass().getName()) != null) {
        InfoBean bean = staticMap.get(activity.getClass().getName());
        if (bean.bitmap != null) {
            bean.bitmap = null;
        }
        if (showMethod != null) {
            showMethod = null;
        }
        staticMap.remove(activity.getClass().getName());
    }
}
Also used : InfoBean(immortalz.me.library.bean.InfoBean)

Example 2 with InfoBean

use of immortalz.me.library.bean.InfoBean in project TransitionHelper by ImmortalZ.

the class TransitionsHeleper method startActivity.

private static void startActivity(final Activity activity, final Class<?> cls, Intent intent, final View view, final Integer imgId) {
    if (intent == null) {
        intent = new Intent(activity, cls);
    }
    final InfoBean bean = new InfoBean();
    final Intent finalIntent = intent;
    view.post(new Runnable() {

        @Override
        public void run() {
            //get statusBar height
            view.getWindowVisibleDisplayFrame(bean.originRect);
            bean.statusBarHeight = bean.originRect.top;
            //get Origin View's rect
            view.getGlobalVisibleRect(bean.originRect);
            bean.originWidth = view.getWidth();
            bean.originHeight = view.getHeight();
            if (imgId == 0) {
                bean.bitmap = createBitmap(view, bean.originWidth, bean.originHeight, false);
            } else {
                bean.setImgId(imgId);
            }
            finalIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            staticMap.put(finalIntent.getComponent().getClassName(), bean);
            activity.startActivity(finalIntent);
            activity.overridePendingTransition(0, 0);
        }
    });
}
Also used : InfoBean(immortalz.me.library.bean.InfoBean) Intent(android.content.Intent)

Example 3 with InfoBean

use of immortalz.me.library.bean.InfoBean in project TransitionHelper by ImmortalZ.

the class ButtonActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TransitionsHeleper.getInstance().setShowMethod(new ColorShowMethod(R.color.bg_purple, R.color.bg_teal) {

        @Override
        public void loadCopyView(InfoBean bean, ImageView copyView) {
            AnimatorSet set = new AnimatorSet();
            set.playTogether(ObjectAnimator.ofFloat(copyView, "alpha", 1f, 0f), ObjectAnimator.ofFloat(copyView, "scaleX", 1.5f, 1f), ObjectAnimator.ofFloat(copyView, "scaleY", 1.5f, 1f));
            set.setInterpolator(new AccelerateInterpolator());
            set.setDuration(duration / 4 * 5).start();
        }

        @Override
        public void loadTargetView(InfoBean bean, ImageView targetView) {
        }
    }).show(this, null);
}
Also used : InfoBean(immortalz.me.library.bean.InfoBean) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ColorShowMethod(immortalz.me.library.method.ColorShowMethod) AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 4 with InfoBean

use of immortalz.me.library.bean.InfoBean in project TransitionHelper by ImmortalZ.

the class FabCircleActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TransitionsHeleper.getInstance().setShowMethod(new ColorShowMethod(R.color.bg_purple, R.color.bg_teal) {

        @Override
        public void loadCopyView(InfoBean bean, ImageView copyView) {
            AnimatorSet set = new AnimatorSet();
            set.playTogether(ObjectAnimator.ofFloat(copyView, "rotation", 0, 180), ObjectAnimator.ofFloat(copyView, "scaleX", 1, 0), ObjectAnimator.ofFloat(copyView, "scaleY", 1, 0));
            set.setInterpolator(new AccelerateInterpolator());
            set.setDuration(duration / 4 * 5).start();
        }

        @Override
        public void loadTargetView(InfoBean bean, ImageView targetView) {
        }
    }).show(this, null);
}
Also used : InfoBean(immortalz.me.library.bean.InfoBean) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ColorShowMethod(immortalz.me.library.method.ColorShowMethod) AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 5 with InfoBean

use of immortalz.me.library.bean.InfoBean in project TransitionHelper by ImmortalZ.

the class FabNoCircleActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TransitionsHeleper.getInstance().setShowMethod(new NoneShowMethod() {

        @Override
        public void loadCopyView(InfoBean bean, ImageView copyView) {
            AnimatorSet set = new AnimatorSet();
            set.playTogether(ObjectAnimator.ofFloat(copyView, "rotation", 0, 180), ObjectAnimator.ofFloat(copyView, "scaleX", 1, 0), ObjectAnimator.ofFloat(copyView, "scaleY", 1, 0));
            set.setInterpolator(new AccelerateInterpolator());
            set.setDuration(duration / 4 * 5).start();
        }
    }).show(this, null);
}
Also used : InfoBean(immortalz.me.library.bean.InfoBean) NoneShowMethod(immortalz.me.library.method.NoneShowMethod) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView)

Aggregations

InfoBean (immortalz.me.library.bean.InfoBean)8 ImageView (android.widget.ImageView)5 AnimatorSet (android.animation.AnimatorSet)4 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 ColorShowMethod (immortalz.me.library.method.ColorShowMethod)3 Intent (android.content.Intent)2 NoneShowMethod (immortalz.me.library.method.NoneShowMethod)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ViewGroup (android.view.ViewGroup)1 RelativeLayout (android.widget.RelativeLayout)1 InflateShowMethod (immortalz.me.library.method.InflateShowMethod)1 CirleAnimView (immortalz.me.library.view.CirleAnimView)1