mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-11 17:40:44 +01:00
make sure extended details are always properly positioned
This commit is contained in:
parent
80fadfec62
commit
ae9cce880a
@ -39,6 +39,7 @@ import java.io.FileOutputStream
|
|||||||
|
|
||||||
class PhotoFragment : ViewPagerFragment() {
|
class PhotoFragment : ViewPagerFragment() {
|
||||||
private var isFragmentVisible = false
|
private var isFragmentVisible = false
|
||||||
|
private var isFullscreen = false
|
||||||
private var wasInit = false
|
private var wasInit = false
|
||||||
private var storedShowExtendedDetails = false
|
private var storedShowExtendedDetails = false
|
||||||
private var storedExtendedDetails = 0
|
private var storedExtendedDetails = 0
|
||||||
@ -86,6 +87,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
view.subsampling_view.setOnClickListener { photoClicked() }
|
view.subsampling_view.setOnClickListener { photoClicked() }
|
||||||
view.gif_view.setOnClickListener { photoClicked() }
|
view.gif_view.setOnClickListener { photoClicked() }
|
||||||
loadImage()
|
loadImage()
|
||||||
@ -288,9 +290,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||||||
setTextColor(context.config.textColor)
|
setTextColor(context.config.textColor)
|
||||||
beVisibleIf(text.isNotEmpty())
|
beVisibleIf(text.isNotEmpty())
|
||||||
onGlobalLayout {
|
onGlobalLayout {
|
||||||
if (height != 0) {
|
if (height != 0 && isAdded) {
|
||||||
val smallMargin = resources.getDimension(R.dimen.small_margin)
|
y = getExtendedDetailsY(height)
|
||||||
y = context.usableScreenSize.y - height - if (context.navigationBarHeight == 0) smallMargin else 0f
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,13 +318,17 @@ class PhotoFragment : ViewPagerFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun fullscreenToggled(isFullscreen: Boolean) {
|
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||||
|
this.isFullscreen = isFullscreen
|
||||||
view.photo_details.apply {
|
view.photo_details.apply {
|
||||||
if (visibility == View.VISIBLE) {
|
if (visibility == View.VISIBLE) {
|
||||||
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
val newY = context.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -(if (context.navigationBarHeight == 0) smallMargin else 0f)
|
return context!!.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -(if (context!!.navigationBarHeight == 0) smallMargin else 0f)
|
||||||
animate().y(newY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,10 +555,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||||||
setTextColor(context.config.textColor)
|
setTextColor(context.config.textColor)
|
||||||
beVisibleIf(text.isNotEmpty())
|
beVisibleIf(text.isNotEmpty())
|
||||||
onGlobalLayout {
|
onGlobalLayout {
|
||||||
if (height != 0) {
|
if (height != 0 && isAdded) {
|
||||||
val smallMargin = resources.getDimension(R.dimen.small_margin)
|
y = getExtendedDetailsY(height)
|
||||||
val timeHolderHeight = mTimeHolder!!.height - context.navigationBarHeight
|
|
||||||
y = context.usableScreenSize.y - height - timeHolderHeight - if (context.navigationBarHeight == 0) smallMargin else 0f
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -597,12 +595,15 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||||||
checkFullscreen()
|
checkFullscreen()
|
||||||
mView.video_details.apply {
|
mView.video_details.apply {
|
||||||
if (visibility == View.VISIBLE) {
|
if (visibility == View.VISIBLE) {
|
||||||
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getExtendedDetailsY(height: Int): Float {
|
||||||
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
|
||||||
val newY = 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 + if (context!!.navigationBarHeight == 0) smallMargin else 0f)
|
||||||
animate().y(newY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user