Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent, @Nullable Bundle options) 

Source Link

Document

Launch a new activity.

Usage

From source file:Main.java

private static void startItemFigureDetailActivity(Intent intent, Activity activity, View view) {
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, view,
            "detail");
    activity.startActivity(intent, options.toBundle());
}

From source file:Main.java

public static void startActivity(Activity activity, Intent intent, View shareView, String transition) {
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, shareView,
            transition);/* w  ww .  j a  v a2s  . c o  m*/
    activity.startActivity(intent, options.toBundle());
}

From source file:Main.java

public static void openActivity(Activity activity, Intent intent, Bundle options) {
    if (null == activity || null == intent)
        return;/*  www.j  a  v  a 2  s  . c  om*/

    activity.startActivity(intent, options);
}

From source file:com.cpacm.moemusic.utils.TransitionHelper.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void startSharedElementActivity(Activity activity, Intent intent, Pair<View, String>[] pairs) {
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat
            .makeSceneTransitionAnimation(activity, pairs);
    activity.startActivity(intent, transitionActivityOptions.toBundle());
}

From source file:com.maskyn.fileeditorpro.util.AnimationUtils.java

public static void startActivityWithScale(@NonNull Activity startActivity, @NonNull Intent subActivity,
        @NonNull boolean forResult, @Nullable int code, @NonNull View view) {
    if (forResult) {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
            startActivity.startActivityForResult(subActivity, code, AnimationUtils.getScaleBundle(view));
        else//  w w w  . j  ava 2s.  c o m
            startActivity.startActivityForResult(subActivity, code);
    } else {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
            startActivity.startActivity(subActivity, AnimationUtils.getScaleBundle(view));
        else
            startActivity.startActivity(subActivity);
    }
}

From source file:com.fa.imaged.activity.DetailActivityV2.java

public static void launch(Activity activity, View transitionView, InstagramImage image, String url) {
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, transitionView,
            EXTRA_IMAGE);//from w  w  w . j a  va  2s  .c om
    Intent intent = new Intent(activity, DetailActivityV2.class);
    intent.putExtra("EXTRA_DATA", image);
    intent.putExtra(EXTRA_IMAGE, url);
    if (Build.VERSION.SDK_INT >= 16) {
        activity.startActivity(intent, options.toBundle());
    } else {
        activity.startActivity(intent);
    }
}

From source file:com.mercandalli.android.apps.files.file.audio.FileAudioActivity.java

/**
 * Start this {@link AppCompatActivity}.
 *///  w  w w  .ja  v  a  2 s  .  c  om
public static void start(final Activity activity, final int currentPosition, final List<String> fileMusicPath,
        final View animationView, final boolean isOnline) {

    Bundle args = new Bundle();
    final Intent intent = new Intent(activity, FileAudioActivity.class);

    intent.putExtra(EXTRA_IS_ONLINE, isOnline);
    intent.putExtra(EXTRA_FILE_CURRENT_POSITION, currentPosition);
    intent.putExtra(EXTRA_FILES_PATH, new ArrayList<>(fileMusicPath));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && animationView != null) {
        ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
                animationView, "transitionIcon");
        args = options.toBundle();
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        activity.startActivity(intent, args);
    } else {
        activity.startActivity(intent);
    }
    activity.overridePendingTransition(R.anim.left_in, R.anim.left_out);
}

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);
    }//from  w  w w.jav  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 (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  ww  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.doctoror.fuckoffmusicplayer.presentation.nowplaying.NowPlayingActivity.java

public static void start(@NonNull final Activity activity, @Nullable final View albumArt,
        @Nullable final View listItemView) {
    final Intent intent = Henson.with(activity).gotoNowPlayingActivity().hasCoverTransition(albumArt != null)
            .hasListViewTransition(listItemView != null).build();

    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    Bundle options = null;//from   w  w  w.  j  a  v a2  s  . c o m
    if (albumArt != null) {
        options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, albumArt, TRANSITION_NAME_ALBUM_ART).toBundle();
    } else if (listItemView != null) {
        options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, listItemView, TRANSITION_NAME_ROOT).toBundle();
    }
    activity.startActivity(intent, options);
}