Example usage for android.app Activity overridePendingTransition

List of usage examples for android.app Activity overridePendingTransition

Introduction

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

Prototype

public void overridePendingTransition(int enterAnim, int exitAnim) 

Source Link

Document

Call immediately after one of the flavors of #startActivity(Intent) or #finish to specify an explicit transition animation to perform next.

Usage

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link GroupContactsActivity}.
 *
 * @param activity The context used to start this intent
 * @param group    group data/*from   w ww  .  j a va 2  s  .co m*/
 */
public static void launchEditGroupContactsActivity(Activity activity, Group group) {
    Intent intent = new Intent(Intents.ACTION_VIEW_GROUP_USERS);
    intent.putExtra(ARG_SELECTED_GROUP, group);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Add a new group or edit a selected group and it's channels.
 *
 * @param activity      context//from  ww w.  j a  va2  s. co m
 * @param group         selected
 * @param groupEditType add edit or public group
 */
public static void launchEditGroupChannelsActivity(Activity activity, Group group,
        GroupEditType groupEditType) {
    Intent intent = new Intent(Intents.ACTION_EDIT_GROUP_CHANNEL);
    intent.putExtra(ARG_SELECTED_GROUP, group);
    intent.putExtra(ARG_EDIT_GROUP_TYPE, groupEditType);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.mercandalli.android.apps.files.file.image.FileImageActivity.java

public static void startOnlineImage(final @NonNull Activity activity, final @NonNull FileModel fileModel,
        final @Nullable View iconAnimationView, final @Nullable View titleAnimationView) {
    Preconditions.checkNotNull(activity);
    Preconditions.checkNotNull(fileModel);

    final Intent intent = new Intent(activity, FileImageActivity.class);
    intent.putExtra("ID", fileModel.getId());
    intent.putExtra("TITLE", "" + fileModel.getFullName());
    intent.putExtra("URL_FILE", "" + fileModel.getOnlineUrl());
    intent.putExtra("CLOUD", true);
    intent.putExtra("SIZE_FILE", fileModel.getSize());
    intent.putExtra("DATE_FILE", fileModel.getDateCreation());
    if (iconAnimationView == null || titleAnimationView == null
            || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        activity.startActivity(intent);/*from  w  w  w . j a  v a2 s. c o  m*/
        activity.overridePendingTransition(R.anim.left_in, R.anim.left_out);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        activity.startActivity(intent,
                ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
                        Pair.create(iconAnimationView, "transitionIcon"),
                        Pair.create(titleAnimationView, "transitionTitle")).toBundle());
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link MainActivity}.// w w  w .ja v  a  2s . c om
 *
 * @param activity The context used to start this intent
 */
public static void launchMainActivity(Activity activity, int selectTab, boolean groupDeleted, Group group) {
    Intent intent = new Intent(Intents.ACTION_MAIN_VIEW).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra(Constants.ARG_MAINFRAGMENT_SELECTED_TAB, selectTab);
    intent.putExtra(Constants.ARG_MAINGROUPFRAGMENT_WAS_GROUP_DELETED, groupDeleted);
    intent.putExtra(Constants.ARG_MAINGROUPFRAGMENT_DELETED_GROUP, group);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

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

private void animate(Activity activity) {
    if (!Utils.isLollipop() && animate) {
        activity.overridePendingTransition(R.anim.right_in, R.anim.left_out);
    }/*from   w w  w.j a  v a2 s .  c  o  m*/
}

From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Navigate "up" the demo structure to the launchpad activity.
        if (selectedItem != START_PREFERENCE && changed)
            restartPC(this);
        else if (selectedItem != START_PREFERENCE) {
            selectItem(START_PREFERENCE);
        } else {/*from w  w  w.j  a va  2 s .c  o  m*/
            Intent in = new Intent(PreferencesActivity.this, MainActivity.class);
            in.setAction(Intent.ACTION_MAIN);
            in.setAction(Intent.CATEGORY_LAUNCHER);

            final int enter_anim = android.R.anim.fade_in;
            final int exit_anim = android.R.anim.fade_out;
            Activity activity = this;
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.finish();
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.startActivity(in);
        }
        return true;
    }
    return true;
}

From source file:com.apptentive.android.sdk.module.messagecenter.ApptentiveMessageCenter.java

protected static void show(Activity activity) {
    SharedPreferences prefs = activity.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE);
    Configuration conf = Configuration.load(activity);
    boolean enableMessageCenter = conf.isMessageCenterEnabled(activity);
    boolean emailRequired = conf.isMessageCenterEmailRequired(activity);
    boolean shouldShowIntroDialog = !enableMessageCenter
            || prefs.getBoolean(Constants.PREF_KEY_MESSAGE_CENTER_SHOULD_SHOW_INTRO_DIALOG, true);
    // TODO: What if there is an incoming message that is unread? Shouldn't they see the Message Center right away?
    if (shouldShowIntroDialog) {
        showIntroDialog(activity, emailRequired);
    } else {//w  ww. ja v a 2s  . co m
        Intent intent = new Intent();
        intent.setClass(activity, ViewActivity.class);
        intent.putExtra(ActivityContent.KEY, ActivityContent.Type.MESSAGE_CENTER.toString());
        activity.startActivity(intent);
        activity.overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out);
    }
}

From source file:com.filemanager.free.activities.Preferences.java

@Override
public void onBackPressed() {
    if (select == 1 && changed == 1)
        restartPC(this);
    else if (select == 1 || select == 2) {
        selectItem(0);/*from   ww  w .j a va2 s.co  m*/
    } else {
        Intent in = new Intent(Preferences.this, MainActivity.class);
        in.setAction(Intent.ACTION_MAIN);
        final int enter_anim = android.R.anim.fade_in;
        final int exit_anim = android.R.anim.fade_out;
        Activity activity = this;
        activity.overridePendingTransition(enter_anim, exit_anim);
        activity.finish();
        activity.overridePendingTransition(enter_anim, exit_anim);
        activity.startActivity(in);
    }
    MainActivity.showInterstitial();
}

From source file:com.filemanager.free.activities.Preferences.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Navigate "up" the demo structure to the launchpad activity.
        if (select == 1 && changed == 1)
            restartPC(this);
        else if (select == 1) {
            selectItem(0);//from   w  w  w. j a v  a  2 s.com
        } else {
            Intent in = new Intent(Preferences.this, MainActivity.class);
            in.setAction(Intent.ACTION_MAIN);
            final int enter_anim = android.R.anim.fade_in;
            final int exit_anim = android.R.anim.fade_out;
            Activity activity = this;
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.finish();
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.startActivity(in);
        }
        MainActivity.showInterstitial();
        return true;

    }
    return true;
}

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

/**
 * Start this {@link AppCompatActivity}.
 *//*from  ww  w .  jav  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);
}