Guest User

Untitled

a guest
Mar 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. private void redirectUsingCustomTab(String url)
  2. {
  3. Uri uri = Uri.parse(url);
  4.  
  5. CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
  6.  
  7. // set desired toolbar colors
  8. intentBuilder.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary));
  9. intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
  10.  
  11. // add start and exit animations if you want(optional)
  12. intentBuilder.setStartAnimations(this, android.R.anim.slide_in_left, android.R.anim.slide_out_right);
  13. intentBuilder.setExitAnimations(this, android.R.anim.slide_in_left,
  14. android.R.anim.slide_out_right);
  15.  
  16. CustomTabsIntent customTabsIntent = intentBuilder.build();
  17.  
  18. customTabsIntent.launchUrl(getActivity(), uri);
  19. }
  20.  
  21. implementation fileTree(dir: 'libs', include: ['*.jar'])
  22. implementation 'com.android.support:appcompat-v7:26.1.0'
  23. implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  24. implementation 'com.android.support:design:26.1.0'
  25. implementation 'com.android.support:recyclerview-v7:26.1.0'
  26. testImplementation 'junit:junit:4.12'
  27. androidTestImplementation 'com.android.support.test:runner:1.0.1'
  28. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  29. compile 'com.prolificinteractive:material-calendarview:1.4.3'
  30. compile 'com.android.support:support-v4:26.1.0'
Add Comment
Please, Sign In to add comment