Skip to content

Instantly share code, notes, and snippets.

@Bradleycorn
Last active January 21, 2019 13:19
Show Gist options
  • Save Bradleycorn/94a7e8875adbc0875043f3065fc4fb5e to your computer and use it in GitHub Desktop.
Save Bradleycorn/94a7e8875adbc0875043f3065fc4fb5e to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
lateinit var orientationListener: OrientationEventListener
override fun onCreate(savedInstanceState: Bundle?) {
orientationListener = object: OrientationEventListener(this) {
override fun onOrientationChanged(orientation: Int) {
viewModel.onOrientationChange(orientation, resources.configuration.orientation)
}
}.apply { disable() }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment