openHPI / xikolo-android

📱 Android App of the HPI MOOC Platform
https://play.google.com/store/apps/dev?id=7185448023325736337
GNU General Public License v3.0
41 stars 15 forks source link

Fix crash when in PiP #194

Closed bengelhaupt closed 4 years ago

bengelhaupt commented 4 years ago

Fixes a bug that caused a crash when a video was played in picture-in-picture mode and playback for another video was started.

When a new video is played, the onNewIntent of the Activity is invoked. This leads to the construction of a new player Fragment. This new Fragment is committed via commit(). The following tasks included checking whether immersive mode is available by checking the aspect ratio of the player view. But because the Fragment was not yet initialized, this process failed. commitNow() solves this by executing the transaction immediately, effectively synchronizing the lifecycle of Activity and Fragment.