Created
January 22, 2019 02:14
-
-
Save Bradleycorn/485fd69a5b880058ef5fa24510bcd685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
private val viewModel: MainActivityViewModel by viewModels() | |
private val videoPlayerCallbacks = object: ControlledVideoView.IVideoListener { | |
override fun onPipToggleClicked() { | |
viewModel.onPipToggled() | |
} | |
override fun onVideoCloseClicked() { | |
viewModel.onVideoClosed() | |
} | |
override fun onVideoFullScreenClicked(isFullScreen: Boolean) { | |
//isFullScreen = true means we're already in fullscreen, | |
// so we want to turn it off and lock to portrait. And Vice Versa | |
val orientationLock = when (isFullScreen) { | |
true -> Configuration.ORIENTATION_PORTRAIT | |
false -> Configuration.ORIENTATION_LANDSCAPE | |
} | |
viewModel.onOrientationForced(orientationLock) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment