List of usage examples for android.support.v4.app ActivityOptionsCompat makeCustomAnimation
public static ActivityOptionsCompat makeCustomAnimation(Context context, int i, int i2)
From source file:Main.java
private static Bundle getOptionsBundle(final Context context, final int enterAnim, final int exitAnim) { return ActivityOptionsCompat.makeCustomAnimation(context, enterAnim, exitAnim).toBundle(); }
From source file:Main.java
/** * Helper method to recreate the Activity. This method should be called after a Locale change. * @param activity the Activity that will be recreated * @param animate a flag indicating if the recreation will be animated or not *//*from w ww .j a v a 2 s . c o m*/ public static void recreate(Activity activity, boolean animate) { Intent restartIntent = new Intent(activity, activity.getClass()); Bundle extras = activity.getIntent().getExtras(); if (extras != null) { restartIntent.putExtras(extras); } if (animate) { ActivityCompat.startActivity(activity, restartIntent, ActivityOptionsCompat .makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out).toBundle()); } else { activity.startActivity(restartIntent); activity.overridePendingTransition(0, 0); } activity.finish(); }
From source file:siarhei.luskanau.places.presentation.navigation.Navigator.java
public void startActivityWithAnimations(Activity activity, Intent intent) { Bundle options = ActivityOptionsCompat .makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out).toBundle(); ActivityCompat.startActivity(activity, intent, options); }
From source file:ngoc.com.pedometer.ui.Fragment_Overview.java
private void setUpNavigationView() { //Setting Navigation View Item Selected Listener to handle the item click of the navigation menu navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger on item Click of navigation menu @Override//from ww w . java 2 s . c o m public boolean onNavigationItemSelected(MenuItem menuItem) { //Check to see which item was being clicked and perform appropriate action switch (menuItem.getItemId()) { //Replacing the main content with ContentFragment Which is our Inbox View; case R.id.action_settings: drawer.closeDrawers(); ActivityOptionsCompat options = ActivityOptionsCompat.makeCustomAnimation(getActivity(), R.anim.push_in_to_right, R.anim.push_in_to_left); Intent intent = new Intent(getActivity(), SettingActivity.class); ((Activity) getActivity()).startActivity(intent, options.toBundle()); break; case R.id.action_split_count: drawer.closeDrawers(); Dialog_Split.getDialog(getActivity(), total_start + Math.max(todayOffset + since_boot, 0)) .show(); break; case R.id.action_faq: drawer.closeDrawers(); FAQDialog.getInstance().show(getActivity()); break; case R.id.action_about: drawer.closeDrawers(); showAboutDialog(); break; default: } //Checking if the item is in checked state or not, if not make it in checked state if (menuItem.isChecked()) { menuItem.setChecked(false); } else { menuItem.setChecked(true); } menuItem.setChecked(true); return true; } }); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawer, toolbar, R.string.openDrawer, R.string.closeDrawer) { @Override public void onDrawerClosed(View drawerView) { // Code here will be triggered once the drawer closes as we dont want anything to happen so we leave this blank super.onDrawerClosed(drawerView); } @Override public void onDrawerOpened(View drawerView) { // Code here will be triggered once the drawer open as we dont want anything to happen so we leave this blank super.onDrawerOpened(drawerView); } }; //Setting the actionbarToggle to drawer layout drawer.addDrawerListener(actionBarDrawerToggle); //calling sync state is necessary or else your hamburger icon wont show up actionBarDrawerToggle.syncState(); }
From source file:com.sachinshinde.theweatherapp.utils.LUtils.java
public static void launchActivity(Activity activity, View transitionView, Class<?> cls) { ActivityOptionsCompat options = ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.slide_in_right, R.anim.slide_out_left);// w w w. ja v a2 s. c om // ActivityOptionsCompat.makeSceneTransitionAnimation( // activity, transitionView, ""); Intent intent = new Intent(activity, cls); ActivityCompat.startActivity(activity, intent, options.toBundle()); // activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); }
From source file:com.hotmart.dragonfly.ui.BaseActivity.java
/** * Enables back navigation for activities that are launched from the NavBar. See * {@code AndroidManifest.xml} to find out the parent activity names for each activity. * @param intent/* w w w . jav a 2s .c o m*/ */ private void createBackStack(Intent intent) { final Bundle bundle = ActivityOptionsCompat .makeCustomAnimation(this, android.R.anim.fade_in, android.R.anim.fade_out).toBundle(); TaskStackBuilder builder = TaskStackBuilder.create(this); builder.addNextIntentWithParentStack(intent); builder.startActivities(bundle); }
From source file:com.ayuget.redface.ui.misc.ImageMenuHandler.java
public void openExifData() { Intent intent = new Intent(activity, ExifDetailsActivity.class); intent.putExtra(UIConstants.ARG_EXIF_IMAGE, imageUrl); activity.startActivity(intent,/*from w ww . j ava 2s . c o m*/ ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.slide_up, R.anim.slide_down).toBundle()); }
From source file:org.chromium.chrome.browser.customtabs.CustomTabActivity.java
/** * Opens the URL currently being displayed in the Custom Tab in the regular browser. * @param forceReparenting Whether tab reparenting should be forced for testing. * * @return Whether or not the tab was sent over successfully. *//*from w w w .j av a2s . c o m*/ boolean openCurrentUrlInBrowser(boolean forceReparenting) { Tab tab = getActivityTab(); if (tab == null) return false; String url = tab.getUrl(); if (DomDistillerUrlUtils.isDistilledPage(url)) { url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url); } if (TextUtils.isEmpty(url)) url = getUrlToLoad(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_TO_PARENT, false); boolean willChromeHandleIntent = getIntentDataProvider().isOpenedByChrome(); StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); StrictMode.allowThreadDiskWrites(); try { willChromeHandleIntent |= ExternalNavigationDelegateImpl.willChromeHandleIntent(this, intent, true); } finally { StrictMode.setThreadPolicy(oldPolicy); } Bundle startActivityOptions = ActivityOptionsCompat .makeCustomAnimation(this, R.anim.abc_fade_in, R.anim.abc_fade_out).toBundle(); if (willChromeHandleIntent || forceReparenting) { Runnable finalizeCallback = new Runnable() { @Override public void run() { finishAndClose(); } }; mMainTab = null; tab.detachAndStartReparenting(intent, startActivityOptions, finalizeCallback); } else { // Temporarily allowing disk access while fixing. TODO: http://crbug.com/581860 StrictMode.allowThreadDiskReads(); StrictMode.allowThreadDiskWrites(); try { startActivity(intent, startActivityOptions); } finally { StrictMode.setThreadPolicy(oldPolicy); } } return true; }