Skip to content

Instantly share code, notes, and snippets.

@gavingt
Last active January 12, 2020 14:21
Show Gist options
  • Save gavingt/b1e80ba9e0da3e59a95c045a0e058928 to your computer and use it in GitHub Desktop.
Save gavingt/b1e80ba9e0da3e59a95c045a0e058928 to your computer and use it in GitHub Desktop.
view.viewTreeObserver.addOnGlobalLayoutListener {
autocompleteFragment.view?.viewTreeObserver?.addOnGlobalLayoutListener {
val clearButton =
autocompleteFragment.view!!.findViewById<ImageButton>(R.id.places_autocomplete_clear_button)
//If user presses autocompleteFragment's clearButton, set place = null
clearButton.setOnClickListener {
sharedViewModel.onPlaceChanged(null)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment