Search in sources :

Example 36 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Tapad by berict.

the class IntentHelper method intentSharedElement.

public void intentSharedElement(final Activity activity, final String targetName, final int start_element_id, final String transitionName, int delay) {
    final String classname = "com.bedrock.padder." + targetName;
    final Class<Object> classToLoad;
    try {
        classToLoad = (Class<Object>) Class.forName(classname);
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {

            @Override
            public void run() {
                if (Build.VERSION.SDK_INT >= 21) {
                    Intent intent = new Intent(activity, classToLoad);
                    View view = activity.findViewById(start_element_id);
                    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, // The view which starts the transition
                    view, // The transitionName of the view we’re transitioning to
                    transitionName);
                    ActivityCompat.startActivity(activity, intent, options.toBundle());
                } else {
                    intent(activity, targetName);
                }
            }
        }, delay);
    } catch (ClassNotFoundException e) {
        Log.i("IntentHelper", "Error, there is no such class");
    }
}
Also used : Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 37 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project EasyVolley by asifmujteba.

the class DetailsActivity method launch.

public static void launch(BaseActivity mContext, Product product, ImageView imageView) {
    Intent intent = new Intent(mContext, DetailsActivity.class);
    intent.putExtra(EXTRA_PRODUCT, Parcels.wrap(product));
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mContext, imageView, "productImage");
    ActivityCompat.startActivity(mContext, intent, options.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 38 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project MaterialLogin by fanrunqi.

the class AActivityOne method setListener.

private void setListener() {
    btGo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Explode explode = new Explode();
            explode.setDuration(500);
            getWindow().setExitTransition(explode);
            getWindow().setEnterTransition(explode);
            ActivityOptionsCompat oc2 = ActivityOptionsCompat.makeSceneTransitionAnimation(AActivityOne.this);
            Intent i2 = new Intent(AActivityOne.this, AActivityThree.class);
            startActivity(i2, oc2.toBundle());
        }
    });
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getWindow().setExitTransition(null);
            getWindow().setEnterTransition(null);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(AActivityOne.this, fab, fab.getTransitionName());
            startActivity(new Intent(AActivityOne.this, AActivityTwo.class), options.toBundle());
        }
    });
}
Also used : Explode(android.transition.Explode) Intent(android.content.Intent) CardView(android.support.v7.widget.CardView) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) ActivityOptions(android.app.ActivityOptions)

Example 39 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Material-Animations by lgvalle.

the class SamplesRecyclerAdapter method startActivity.

private void startActivity(Class target, Pair<View, String>[] pairs, Sample sample) {
    Intent i = new Intent(activity, target);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
    i.putExtra("sample", sample);
    activity.startActivity(i, transitionActivityOptions.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 40 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Material-Animations by lgvalle.

the class BaseDetailActivity method transitionTo.

@SuppressWarnings("unchecked")
void transitionTo(Intent i) {
    final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(this, true);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pairs);
    startActivity(i, transitionActivityOptions.toBundle());
}
Also used : ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Aggregations

ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)92 Intent (android.content.Intent)72 View (android.view.View)31 Pair (android.support.v4.util.Pair)18 ImageView (android.widget.ImageView)15 TextView (android.widget.TextView)14 RecyclerView (android.support.v7.widget.RecyclerView)13 Activity (android.app.Activity)12 OnClick (butterknife.OnClick)7 ActivityOptions (android.app.ActivityOptions)4 Context (android.content.Context)4 Bundle (android.os.Bundle)4 Handler (android.os.Handler)4 BindView (butterknife.BindView)4 CardView (android.support.v7.widget.CardView)3 Explode (android.transition.Explode)3 AdapterView (android.widget.AdapterView)3 LinearLayout (android.widget.LinearLayout)3 Uri (android.net.Uri)2 LayoutInflater (android.view.LayoutInflater)2