fix some visual glitches around fullscreen Extended details

This commit is contained in:
tibbi 2018-06-14 11:25:37 +02:00
parent 039d6fdfd5
commit 347959b830
2 changed files with 20 additions and 12 deletions

View file

@ -379,12 +379,16 @@ class PhotoFragment : ViewPagerFragment() {
private fun checkExtendedDetails() {
if (context!!.config.showExtendedDetails) {
view.photo_details.apply {
beInvisible() // make it invisible so we can measure it, but not show yet
text = getMediumExtendedDetails(medium)
onGlobalLayout {
if (isAdded) {
val realY = getExtendedDetailsY(height)
if (realY > 0) {
y = realY
beVisibleIf(text.isNotEmpty())
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
onGlobalLayout {
if (height != 0 && isAdded) {
y = getExtendedDetailsY(height)
}
}
}
}
@ -414,7 +418,7 @@ class PhotoFragment : ViewPagerFragment() {
override fun fullscreenToggled(isFullscreen: Boolean) {
this.isFullscreen = isFullscreen
view.photo_details.apply {
if (storedShowExtendedDetails) {
if (storedShowExtendedDetails && isVisible()) {
animate().y(getExtendedDetailsY(height))
if (storedHideExtendedDetails) {
@ -427,6 +431,6 @@ class PhotoFragment : ViewPagerFragment() {
private fun getExtendedDetailsY(height: Int): Float {
val smallMargin = resources.getDimension(R.dimen.small_margin)
val fullscreenOffset = context!!.navigationBarHeight.toFloat() - smallMargin
return context!!.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -(if (context!!.navigationBarHeight == 0) smallMargin else 0f)
return context!!.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -smallMargin
}
}

View file

@ -462,12 +462,16 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
private fun checkExtendedDetails() {
if (context!!.config.showExtendedDetails) {
mView!!.video_details.apply {
beInvisible() // make it invisible so we can measure it, but not show yet
text = getMediumExtendedDetails(medium)
onGlobalLayout {
if (isAdded) {
val realY = getExtendedDetailsY(height)
if (realY > 0) {
y = realY
beVisibleIf(text.isNotEmpty())
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
onGlobalLayout {
if (height != 0 && isAdded) {
y = getExtendedDetailsY(height)
}
}
}
}
@ -521,7 +525,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
mIsFullscreen = isFullscreen
checkFullscreen()
mView!!.video_details.apply {
if (mStoredShowExtendedDetails) {
if (mStoredShowExtendedDetails && isVisible()) {
animate().y(getExtendedDetailsY(height))
if (mStoredHideExtendedDetails) {
@ -535,6 +539,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
val smallMargin = resources.getDimension(R.dimen.small_margin)
val timeHolderHeight = mTimeHolder!!.height - context!!.navigationBarHeight.toFloat()
val fullscreenOffset = context!!.navigationBarHeight.toFloat() - smallMargin
return context!!.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + if (context!!.navigationBarHeight == 0) smallMargin else 0f)
return context!!.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + smallMargin)
}
}