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)
|
||||||
beVisibleIf(text.isNotEmpty())
|
|
||||||
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
|
|
||||||
onGlobalLayout {
|
onGlobalLayout {
|
||||||
if (height != 0 && isAdded) {
|
if (isAdded) {
|
||||||
y = getExtendedDetailsY(height)
|
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) {
|
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)
|
||||||
beVisibleIf(text.isNotEmpty())
|
|
||||||
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
|
|
||||||
onGlobalLayout {
|
onGlobalLayout {
|
||||||
if (height != 0 && isAdded) {
|
if (isAdded) {
|
||||||
y = getExtendedDetailsY(height)
|
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
|
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