mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
fix some visual glitches around fullscreen Extended details
This commit is contained in:
parent
039d6fdfd5
commit
347959b830
2 changed files with 20 additions and 12 deletions
|
@ -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)
|
||||
beVisibleIf(text.isNotEmpty())
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
|
||||
onGlobalLayout {
|
||||
if (height != 0 && isAdded) {
|
||||
y = getExtendedDetailsY(height)
|
||||
if (isAdded) {
|
||||
val realY = getExtendedDetailsY(height)
|
||||
if (realY > 0) {
|
||||
y = realY
|
||||
beVisibleIf(text.isNotEmpty())
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
beVisibleIf(text.isNotEmpty())
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
|
||||
onGlobalLayout {
|
||||
if (height != 0 && isAdded) {
|
||||
y = getExtendedDetailsY(height)
|
||||
if (isAdded) {
|
||||
val realY = getExtendedDetailsY(height)
|
||||
if (realY > 0) {
|
||||
y = realY
|
||||
beVisibleIf(text.isNotEmpty())
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue