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.abs.telecam.gui.ControllerViewer.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override/*  w w w  .j  av a2  s. co  m*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    String uri = Images.getPhotos()[(int) id];
    final Intent i = new Intent(getActivity(), PhotoDetail.class);
    i.putExtra(PhotoDetail.PHOTO, uri);
    if (isGallery()) {
        if (Utils.hasJellyBean()) {
            ActivityOptions options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(),
                    v.getHeight());
            getActivity().startActivity(i, options.toBundle());
        } else {
            startActivity(i);
        }
    }
}

From source file:com.collabora.xwperf.notxw_contacts.fragments.MainFragment.java

private void setContactClickListener(ITabScrollHider fragment) {
    fragment.setContactClickListener(new ContactsAdapter.OnItemClickListener() {
        @Override/*from  w w w  .  ja v  a 2 s .  c om*/
        public void onItemClicked(int itemId) {
            Intent intent = new Intent(getActivity(), DetailsActivity_.class);
            intent.putExtra(DetailsActivity.EXTRA_ITEM_ID, itemId);
            if (getResources().getBoolean(R.bool.custom_animations)) {
                ActivityOptions opts = ActivityOptions.makeCustomAnimation(getActivity(),
                        android.R.anim.fade_in, android.R.anim.fade_out);
                getActivity().startActivity(intent, opts.toBundle());
            } else {
                getActivity().startActivity(intent);
            }
        }
    });
}

From source file:io.plaidapp.ui.PostNewDesignerNewsStory.java

@OnClick(R.id.new_story_post)
protected void postNewStory() {
    if (DesignerNewsPrefs.get(this).isLoggedIn()) {
        ImeUtils.hideIme(title);//  w ww .j  a va2s .c o m
        Intent data = new Intent();
        data.putExtra(EXTRA_STORY_TITLE, title.getText().toString());
        data.putExtra(EXTRA_STORY_URL, url.getText().toString());
        data.putExtra(EXTRA_STORY_COMMENT, comment.getText().toString());
        setResult(RESULT_POST, data);
        finishAfterTransition();
    } else {
        Intent login = new Intent(this, DesignerNewsLogin.class);
        login.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_COLOR,
                ContextCompat.getColor(this, R.color.designer_news));
        login.putExtra(FabDialogMorphSetup.EXTRA_SHARED_ELEMENT_START_CORNER_RADIUS, 0);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, post,
                getString(R.string.transition_designer_news_login));
        startActivity(login, options.toBundle());
    }
}

From source file:io.plaidapp.ui.PostNewDesignerNewsStory.java

@OnClick(R.id.new_story_post)
protected void postNewStory() {
    if (DesignerNewsPrefs.get(this).isLoggedIn()) {
        ImeUtils.hideIme(title);//from  ww w  . j  a  v a2  s  . c om
        Intent postIntent = new Intent(PostStoryService.ACTION_POST_NEW_STORY, null, this,
                PostStoryService.class);
        postIntent.putExtra(PostStoryService.EXTRA_STORY_TITLE, title.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_STORY_URL, url.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_STORY_COMMENT, comment.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_BROADCAST_RESULT,
                getIntent().getBooleanExtra(PostStoryService.EXTRA_BROADCAST_RESULT, false));
        startService(postIntent);
        setResult(RESULT_POSTING);
        finishAfterTransition();
    } else {
        Intent login = new Intent(this, DesignerNewsLogin.class);
        MorphTransform.addExtras(login, ContextCompat.getColor(this, R.color.designer_news), 0);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, post,
                getString(R.string.transition_designer_news_login));
        startActivity(login, options.toBundle());
    }
}

From source file:com.example.admin.news.mvp.ui.activities.PhotoActivity.java

private void startActivity(View view, Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, view,
                Constants.TRANSITION_ANIMATION_NEWS_PHOTOS);
        startActivity(intent, options.toBundle());
    } else {/*from  ww w  .j a  v a2  s  . c  o  m*/
        ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getWidth() / 2,
                view.getHeight() / 2, 0, 0);
        ActivityCompat.startActivity(mActivity, intent, options.toBundle());
    }
}

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

/**
 * {@inheritDoc}//from w w w  .j  a  v a  2 s  .  c o  m
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final View root = inflater.inflate(R.layout.fragment_albums, container, false);
    mGridView = (GridView) root.findViewById(R.id.gvAlbums);
    mGridView.setFastScrollEnabled(true);

    // Get the albums
    new GetAlbumsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    // Setup the click listener
    mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            AlbumsAdapter.ViewHolder tag = (AlbumsAdapter.ViewHolder) view.getTag();
            ImageView ivCover = tag.ivCover;
            Album item = mAdapter.getItem(position);

            Bitmap hero = ((MaterialTransitionDrawable) ivCover.getDrawable()).getFinalDrawable().getBitmap();
            Intent intent = AlbumActivity.craftIntent(getActivity(), hero, item.getRef(), item.getProvider(),
                    tag.itemColor);

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

    return root;
}

From source file:com.ces.cloudnote.app.bitmapfun.ui.ImageGridFragment.java

@TargetApi(16)
@Override//w w  w .j a va  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.EXTRA_IMAGE, (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.brkc.traffic.ui.image.ImageListFragment.java

@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override/*from ww w. j a  v  a  2  s . co m*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Log.d(TAG, "v=" + v.getId() + ",id=" + id + ",position=" + position);
    final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
    i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (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.vbehl.connections.ui.ImageGridFragment.java

@TargetApi(16)
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
    i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (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 {/*from  ww  w.  j a va 2s .c o  m*/
        startActivity(i);
    }
}

From source file:com.bluetech.gallery5.ui.ImageGridFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
    i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (int) id);
    i.putExtra("PATH", this.path);

    // 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());
}