adding extra null checks at extended details fetching

This commit is contained in:
tibbi 2019-12-16 20:54:34 +01:00
parent d730278659
commit 290ff6f993
2 changed files with 2 additions and 2 deletions

View file

@ -792,7 +792,7 @@ class PhotoFragment : ViewPagerFragment() {
} }
private fun getExtendedDetailsY(height: Int): Float { private fun getExtendedDetailsY(height: Int): Float {
val smallMargin = resources.getDimension(R.dimen.small_margin) val smallMargin = context?.resources?.getDimension(R.dimen.small_margin) ?: return 0f
val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight
val actionsHeight = if (context!!.config.bottomActions && !mIsFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f val actionsHeight = if (context!!.config.bottomActions && !mIsFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f
return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset

View file

@ -471,7 +471,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
} }
private fun getExtendedDetailsY(height: Int): Float { private fun getExtendedDetailsY(height: Int): Float {
val smallMargin = resources.getDimension(R.dimen.small_margin) val smallMargin = context?.resources?.getDimension(R.dimen.small_margin) ?: return 0f
val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight
var actionsHeight = 0f var actionsHeight = 0f
if (!mIsFullscreen) { if (!mIsFullscreen) {