Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. String EXTRA_CUSTOM_TABS_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
  2. Bundle finishBundle = ActivityOptions.makeCustomAnimation(mActivity, android.R.anim.slide_in_left, android.R.anim.slide_out_right).toBundle();
  3. i.putExtra(EXTRA_CUSTOM_TABS_EXIT_ANIMATION_BUNDLE, finishBundle);
  4.  
  5. Bundle startBundle = ActivityOptions.makeCustomAnimation(mActivity, R.anim.slide_in_right, R.anim.slide_out_left).toBundle();
  6. mActivity.startActivity(i, startBundle);
  7.  
  8. CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
  9. .setExitAnimations(this,
  10. android.R.anim.slide_in_left, android.R.anim.slide_out_right)
  11. .build();
  12. customTabsIntent.launchUrl(this, Uri.parse("http://www.example.com"));
  13.  
  14. public static final String EXTRA_EXIT_ANIMATION_BUNDLE =
  15. "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
  16.  
  17. public static final String EXTRA_SESSION = "android.support.customtabs.extra.SESSION";
  18.  
  19. public void openCustomTab() {
  20. Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
  21.  
  22. Bundle bundle = ActivityOptions
  23. .makeCustomAnimation(
  24. this, android.R.anim.slide_in_left, android.R.anim.slide_out_right)
  25. .toBundle();
  26.  
  27. Bundle extrasBundle = new Bundle();
  28. extrasBundle.putBinder(EXTRA_SESSION, null);
  29. intent.putExtras(extrasBundle);
  30.  
  31. intent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle);
  32. startActivity(intent);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement