mirror of
				https://github.com/SimpleMobileTools/Simple-Gallery.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	make sure extended details are always properly positioned
This commit is contained in:
		| @@ -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) { | ||||||
|                 val smallMargin = resources.getDimension(R.dimen.small_margin) |                 animate().y(getExtendedDetailsY(height)) | ||||||
|                 val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin |  | ||||||
|                 val newY = context.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -(if (context.navigationBarHeight == 0) smallMargin else 0f) |  | ||||||
|                 animate().y(newY) |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     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) | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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) { | ||||||
|                 val smallMargin = resources.getDimension(R.dimen.small_margin) |                 animate().y(getExtendedDetailsY(height)) | ||||||
|                 val timeHolderHeight = mTimeHolder!!.height - context.navigationBarHeight.toFloat() |  | ||||||
|                 val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin |  | ||||||
|                 val newY = context.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + if (context.navigationBarHeight == 0) smallMargin else 0f) |  | ||||||
|                 animate().y(newY) |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     private fun getExtendedDetailsY(height: Int): Float { | ||||||
|  |         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) | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user