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:Main.java

public static Bundle toBundle(ActivityOptions options) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        return options.toBundle();
    } else {//from ww w  .  j  a v a  2s .co m
        return null;
    }
}

From source file:com.bluros.music.utils.NavigationUtils.java

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID,
        String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }/* w w  w  .  j a  v a 2 s  . c om*/
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);

    if (MusicUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(),
                transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivity(intent, options.toBundle());
    } else {
        context.startActivity(intent);
    }
}

From source file:com.evandroid.musica.utils.NavigationUtils.java

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID,
        String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }//from  w  w  w. j av a  2 s .  c  o  m
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);

    if (TimberUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(),
                transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivity(intent, options.toBundle());
    } else {
        context.startActivity(intent);
    }
}

From source file:com.techmighty.baseplayer.utils.NavigationUtils.java

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID,
        String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }/* w w  w. j a va2s.c o m*/
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);

    if (BasePlayerUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(),
                transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivity(intent, options.toBundle());
    } else {
        context.startActivity(intent);
    }
}

From source file:com.devalladolid.musictoday.utils.NavigationUtils.java

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID,
        String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }//from   w  ww  . j a v a 2  s.  c  o  m
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);
    intent.putExtra(Constants.ACTIVITY_TRANSITION, transitionViews != null);

    if (transitionViews != null && TimberUtils.isLollipop()
            && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(),
                transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST, options.toBundle());
    } else {
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST);
    }
}

From source file:de.schildbach.wallet.ui.scan.ScanActivity.java

public static void startForResult(final Activity activity, @Nullable final View clickView,
        final int requestCode) {
    if (clickView != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final int[] clickViewLocation = new int[2];
        clickView.getLocationOnScreen(clickViewLocation);
        final Intent intent = new Intent(activity, ScanActivity.class);
        intent.putExtra(ScanActivity.INTENT_EXTRA_SCENE_TRANSITION_X,
                (int) (clickViewLocation[0] + clickView.getWidth() / 2));
        intent.putExtra(ScanActivity.INTENT_EXTRA_SCENE_TRANSITION_Y,
                (int) (clickViewLocation[1] + clickView.getHeight() / 2));
        final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, clickView,
                "transition");
        activity.startActivityForResult(intent, requestCode, options.toBundle());
    } else {//  ww  w. j a  v a 2s . c  o m
        startForResult(activity, requestCode);
    }
}

From source file:de.dreier.mytargets.utils.IntentWrapper.java

public IntentWrapper fromFab(View fab, @ColorRes int color, int icon) {
    if (Utils.isLollipop()) {
        FabTransform.addExtras(intent, color, icon);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getActivity(fab), fab,
                fab.getContext().getString(R.string.transition_root_view));
        this.options = options.toBundle();
    }//from  www  . ja  v a2 s  .  c o m
    return this;
}

From source file:it.cammino.risuscito.LUtils.java

public void startActivityWithTransition(Intent intent, final View clickedView, final String transitionName) {
    ActivityOptions options = null;
    if (hasL() && clickedView != null && !TextUtils.isEmpty(transitionName)) {
        options = ActivityOptions.makeSceneTransitionAnimation(mActivity, clickedView, transitionName);
        ActivityCompat.startActivity(mActivity, intent, options.toBundle());
    } else {/*from   www  .  ja  va 2 s.  com*/
        mActivity.startActivity(intent);
        mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.hold_on);
    }
}

From source file:it.cammino.risuscito.LUtils.java

public void startActivityWithFadeIn(Intent intent, final View clickedView, final String transitionName) {
    ActivityOptions options = null;
    if (hasL() && clickedView != null && !TextUtils.isEmpty(transitionName)) {
        options = ActivityOptions.makeSceneTransitionAnimation(mActivity, clickedView, transitionName);
        ActivityCompat.startActivity(mActivity, intent, options.toBundle());
    } else {// w  w  w  . j a v a  2 s  . c om
        mActivity.startActivity(intent);
        mActivity.overridePendingTransition(R.anim.image_fade_in, R.anim.hold_on);
    }
}

From source file:com.yahoo.mobile.client.android.yodel.ui.PostDetailActivity.java

@Override
public void onPostImagesSelected(List<Photo> imagesToShow, View clickedImageView) {
    Intent intent = new Intent(this, ImageGalleryActivity.class);
    // Because Photo objects are not parcelable, we serialize to JSON to pass between activities
    String photoListJson = new Gson().toJson(imagesToShow);
    intent.putExtra(ImageGalleryActivity.EXTRA_PHOTO_LIST, photoListJson);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, clickedImageView,
                "post_image");
        startActivity(intent, options.toBundle());
    } else {/*from  w ww . j ava 2  s .c om*/
        startActivity(intent);
    }
}