Skip to content

Instantly share code, notes, and snippets.

@huuphuoc1396
Last active October 19, 2020 07:47
Show Gist options
  • Save huuphuoc1396/c2736505ded8b151257347255e120c52 to your computer and use it in GitHub Desktop.
Save huuphuoc1396/c2736505ded8b151257347255e120c52 to your computer and use it in GitHub Desktop.
MainCoverDisplayCallback
private inner class MainCoverDisplayCallback : DisplayManagerHelper.CoverDisplayCallback() {
override fun onCoverDisplayEnabledChangedCallback(state: Int) {
displayManagerHelper?.coverDisplayState?.let {
Log.i(TAG, "Current DualScreen Callback state: ${coverDisplayStateToString(it)}")
}
if (prevDualScreenState != state) {
when (state) {
DisplayManagerHelper.STATE_UNMOUNT -> {
Log.i(TAG, "Changed DualScreen State to STATE_UNMOUNT")
}
DisplayManagerHelper.STATE_DISABLED -> {
Log.i(TAG, "Changed DualScreen State to STATE_DISABLED")
}
DisplayManagerHelper.STATE_ENABLED -> {
toSecondScreen()
Log.i(TAG, "Changed DualScreen State to STATE_ENABLED")
}
}
prevDualScreenState = state
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment