mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +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() {
|
private fun checkExtendedDetails() {
|
||||||
if (context!!.config.showExtendedDetails) {
|
if (context!!.config.showExtendedDetails) {
|
||||||
view.photo_details.apply {
|
view.photo_details.apply {
|
||||||
|
beInvisible() // make it invisible so we can measure it, but not show yet
|
||||||
text = getMediumExtendedDetails(medium)
|
text = getMediumExtendedDetails(medium)
|
||||||
|
onGlobalLayout {
|
||||||
|
if (isAdded) {
|
||||||
|
val realY = getExtendedDetailsY(height)
|
||||||
|
if (realY > 0) {
|
||||||
|
y = realY
|
||||||
beVisibleIf(text.isNotEmpty())
|
beVisibleIf(text.isNotEmpty())
|
||||||
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
|
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) {
|
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||||
this.isFullscreen = isFullscreen
|
this.isFullscreen = isFullscreen
|
||||||
view.photo_details.apply {
|
view.photo_details.apply {
|
||||||
if (storedShowExtendedDetails) {
|
if (storedShowExtendedDetails && isVisible()) {
|
||||||
animate().y(getExtendedDetailsY(height))
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
|
||||||
if (storedHideExtendedDetails) {
|
if (storedHideExtendedDetails) {
|
||||||
|
@ -427,6 +431,6 @@ 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 = resources.getDimension(R.dimen.small_margin)
|
||||||
val fullscreenOffset = context!!.navigationBarHeight.toFloat() - smallMargin
|
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() {
|
private fun checkExtendedDetails() {
|
||||||
if (context!!.config.showExtendedDetails) {
|
if (context!!.config.showExtendedDetails) {
|
||||||
mView!!.video_details.apply {
|
mView!!.video_details.apply {
|
||||||
|
beInvisible() // make it invisible so we can measure it, but not show yet
|
||||||
text = getMediumExtendedDetails(medium)
|
text = getMediumExtendedDetails(medium)
|
||||||
|
onGlobalLayout {
|
||||||
|
if (isAdded) {
|
||||||
|
val realY = getExtendedDetailsY(height)
|
||||||
|
if (realY > 0) {
|
||||||
|
y = realY
|
||||||
beVisibleIf(text.isNotEmpty())
|
beVisibleIf(text.isNotEmpty())
|
||||||
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
|
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
|
mIsFullscreen = isFullscreen
|
||||||
checkFullscreen()
|
checkFullscreen()
|
||||||
mView!!.video_details.apply {
|
mView!!.video_details.apply {
|
||||||
if (mStoredShowExtendedDetails) {
|
if (mStoredShowExtendedDetails && isVisible()) {
|
||||||
animate().y(getExtendedDetailsY(height))
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
|
||||||
if (mStoredHideExtendedDetails) {
|
if (mStoredHideExtendedDetails) {
|
||||||
|
@ -535,6 +539,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
val smallMargin = resources.getDimension(R.dimen.small_margin)
|
val smallMargin = resources.getDimension(R.dimen.small_margin)
|
||||||
val timeHolderHeight = mTimeHolder!!.height - context!!.navigationBarHeight.toFloat()
|
val timeHolderHeight = mTimeHolder!!.height - context!!.navigationBarHeight.toFloat()
|
||||||
val fullscreenOffset = context!!.navigationBarHeight.toFloat() - smallMargin
|
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