Example usage for android.app ActivityOptions toBundle

List of usage examples for android.app ActivityOptions toBundle

Introduction

In this page you can find the example usage for android.app ActivityOptions toBundle.

Prototype

public Bundle toBundle() 

Source Link

Document

Returns the created options as a Bundle, which can be passed to android.content.Context#startActivity(android.content.Intent,android.os.Bundle) Context.startActivity(Intent, Bundle) and related methods.

Usage

From source file:com.hackvg.android.views.activities.MoviesActivity.java

@SuppressWarnings("unchecked")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startDetailActivityBySharedElements(View touchedView, int moviePosition,
        Intent movieDetailActivityIntent) {

    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this,
            new Pair<>(touchedView, SHARED_ELEMENT_COVER + moviePosition));

    startActivity(movieDetailActivityIntent, options.toBundle());
}

From source file:com.example.admin.news.mvp.ui.fragment.NewsListFragment.java

private void startActivity(View view, Intent intent) {
    ImageView newsSummaryPhotoIv = (ImageView) view.findViewById(R.id.news_summary_photo_iv);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, newsSummaryPhotoIv,
                Constants.TRANSITION_ANIMATION_NEWS_PHOTOS);
        startActivity(intent, options.toBundle());
    } else {/*  ww w . ja v a 2  s  .  c  o  m*/
        /*            ActivityOptionsCompat.makeCustomAnimation(this,
            R.anim.slide_bottom_in, R.anim.slide_bottom_out);
                    
                    overridePendingTransition(R.anim.slide_bottom_in, android.R.anim.fade_out);*/

        /*            ActivityOptionsCompat.makeThumbnailScaleUpAnimation(source, thumbnail, startX, startY)
                    ?4.x??Bitmpat*/

        //Activity??
        ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getWidth() / 2,
                view.getHeight() / 2, 0, 0);
        ActivityCompat.startActivity(mActivity, intent, options.toBundle());
    }
}

From source file:com.example.camera360.ui.ImageGridFragment.java

@TargetApi(16)
@Override/* w  w w .  ja v  a 2s.c  o  m*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    final Intent i = new Intent(activity, ImageDetailActivity.class);
    i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (int) id);
    i.putExtra(ImageDetailActivity.IMAGE_URL, arrayList);
    if (Utils.hasJellyBean()) {
        // makeThumbnailScaleUpAnimation() looks kind of ugly here as the
        // loading spinner may
        // show plus the thumbnail image in GridView is cropped. so using
        // makeScaleUpAnimation() instead.
        ActivityOptions options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight());
        activity.startActivity(i, options.toBundle());
    } else {
        startActivity(i);
    }
}

From source file:io.romain.passport.ui.fragments.CityListFragment.java

@Override
public void onCityClicked(final View v, final City city) {
    Intent intent = new Intent(getContext(), CityDetailActivity.class);
    intent.putExtra(CityDetailActivity.EXTRA_CITY, city);
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(),
            //            Pair.create((View) image, getContext().getString(R.string.transition_picture)),
            (Pair<View, String>) Pair.create(v, getContext().getString(R.string.transition_detail_background)));

    getContext().startActivity(intent, options.toBundle());
}

From source file:io.romain.passport.ui.MainActivity.java

@OnClick(R.id.floating_action_button)
protected void onFloatingActionButtonClicked() {
    Intent intent = new Intent(this, AddCityActivity.class);
    intent.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_COLOR,
            ContextCompat.getColor(this, R.color.accent));
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, mFloatingActionButton,
            getString(R.string.transition_add_city));
    startActivityForResult(intent, REQUEST_CODE_ADD_CITY, options.toBundle());
}

From source file:com.lithiumli.fiction.FictionActivity.java

public void initializeBottomActionBar() {
    View layout = findViewById(R.id.bab_info);
    layout.setOnClickListener(new View.OnClickListener() {
        @Override/*w w  w. j  av  a 2 s.c  om*/
        public void onClick(View v) {
            Intent intent = new Intent(FictionActivity.this, NowPlayingActivity.class);
            ActivityOptions options = ActivityOptions.makeCustomAnimation(FictionActivity.this,
                    R.anim.activity_slide_down, R.anim.activity_slide_up);
            FictionActivity.this.startActivity(intent, options.toBundle());
        }
    });
}

From source file:com.example.android.bitmapfun.ui.SearchStreamGridFragment.java

@TargetApi(16)
@Override//from w w  w  .j a va  2s  .c  om
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    final Intent i = new Intent(getActivity(), StreamImageGridActivity.class);

    //ImageAdapter ad = (ImageAdapter) parent.getAdapter();
    //int cols = ad.getNumColumns();
    int cols = mAdapter.getNumColumns();
    if (BuildConfig.DEBUG) {
        Log.d("Connexus", Long.toString(id));
        Log.d("Connexus", String.valueOf(position));
        Log.d("Connexus", String.valueOf(cols));
        Log.d("Connexus", Long.toString(streamList.get(position - cols).id));
        Log.d("Connexus", streamList.get(position - cols).name);
    }

    Bundle b = new Bundle();
    b.putLong(StreamImageGridActivity.EXTRA_STREAM_DATA_STREAM_ID, streamList.get(position - cols).id);
    b.putString(StreamImageGridActivity.EXTRA_STREAM_DATA_STREAM_NAME, streamList.get(position - cols).name);
    i.putExtra(StreamImageGridActivity.EXTRA_IMAGE_DATA_URL, b);
    //i.putExtra(StreamImageGridActivity.EXTRA_IMAGE_DATA_URL, (position - cols));

    if (Utils.hasJellyBean()) {
        // makeThumbnailScaleUpAnimation() looks kind of ugly here as the loading spinner may
        // show plus the thumbnail image in GridView is cropped. so using
        // makeScaleUpAnimation() instead.
        ActivityOptions options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight());
        getActivity().startActivity(i, options.toBundle());
    } else {
        startActivity(i);
    }
}

From source file:com.jrummyapps.busybox.fragments.ScriptsFragment.java

@Override
public void onClick(View view) {
    if (view == fab) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Intent intent = new Intent(getActivity(), CreateScriptActivity.class);
            intent.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_COLOR, getRadiant().accentColor());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(), view,
                    getString(R.string.morphing_dialog_transition));
            getActivity().startActivityForResult(intent, REQUEST_CREATE_SCRIPT, options.toBundle());
        } else {//www  .j a va 2s. com
            new CreateScriptDialog().show(getActivity().getFragmentManager(), "CreateScriptDialog");
        }
    }
}

From source file:net.wespot.pim.view.InqImageGridFragment.java

@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override//from   ww  w . j  a  v a  2 s  .c  o m
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
    i.putExtra(ImageDetailActivity.RESPONSE_POSITION, (int) id);
    if (Utils.hasJellyBean()) {
        // makeThumbnailScaleUpAnimation() looks kind of ugly here as the loading spinner may
        // show plus the thumbnail image in GridView is cropped. so using
        // makeScaleUpAnimation() instead.
        ActivityOptions options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight());
        getActivity().startActivity(i, options.toBundle());
    } else {
        startActivity(i);
    }
}

From source file:com.fastbootmobile.encore.app.fragments.PlaylistListFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // If mAdapter isn't null, we're in portrait with the draggable list view.
    if (mAdapter != null) {
        mRecyclerView = (RecyclerView) view.findViewById(R.id.rvPlaylists);
        mLayoutManager = new LinearLayoutManager(getContext());

        // drag & drop manager
        mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();

        //adapter
        mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter); // wrap for dragging

        final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();

        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
        mRecyclerView.setItemAnimator(animator);

        // additional decorations
        mRecyclerView.addItemDecoration(
                new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));

        mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);

        if (!mIsStandalone) {
            mRecyclerView.setPadding(0, 0, 0, 0);
        }/*from  w ww .j  a va  2  s  . c  o m*/
    } else {
        // We're in landscape with the grid view
        GridView root = (GridView) view.findViewById(R.id.gvPlaylists);
        root.setAdapter(mGridAdapter);

        if (!mIsStandalone) {
            root.setPadding(0, 0, 0, 0);
        }

        // Setup the click listener
        root.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                MainActivity act = (MainActivity) getActivity();
                PlaylistGridAdapter.ViewHolder tag = (PlaylistGridAdapter.ViewHolder) view.getTag();
                Intent intent = PlaylistActivity.craftIntent(act, mGridAdapter.getItem(position),
                        ((MaterialTransitionDrawable) tag.ivCover.getDrawable()).getFinalDrawable()
                                .getBitmap());

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    ActivityOptions opt = ActivityOptions.makeSceneTransitionAnimation(getActivity(),
                            tag.ivCover, "itemImage");
                    act.startActivity(intent, opt.toBundle());
                } else {
                    act.startActivity(intent);
                }
            }
        });
    }
}