Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. fun Context.toast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) = Toast.makeText(this, message, duration).show()
  2.  
  3. fun List<String>.containsAny(other: List<String>): Boolean {
  4. forEach { left ->
  5. other.forEach { right ->
  6. if (left.equals(right)) {
  7. return true
  8. }
  9. }
  10. }
  11. return false
  12. }
  13.  
  14. fun View.hideKeyboard() {
  15. val keyboard = getContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
  16. keyboard.hideSoftInputFromWindow(getApplicationWindowToken(), 0)
  17. }
  18.  
  19. fun Context.openBrowser(url: String) = startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement