diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 1ca989a5b..a96db9a4a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -12,7 +12,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.RelativeLayout import com.bumptech.glide.Glide import com.bumptech.glide.Priority import com.bumptech.glide.load.DataSource @@ -25,9 +24,7 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import com.simplemobiletools.commons.extensions.beGone -import com.simplemobiletools.commons.extensions.beVisible -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* @@ -276,10 +273,15 @@ class PhotoFragment : ViewPagerFragment() { private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { view.photo_details.apply { - beVisible() - setTextColor(context.config.textColor) text = getMediumExtendedDetails(medium) - (layoutParams as RelativeLayout.LayoutParams).bottomMargin = (resources.getDimension(R.dimen.small_margin) + context.navigationBarHeight).toInt() + setTextColor(context.config.textColor) + beVisible() + onGlobalLayout { + if (height != 0) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + y = context.usableScreenSize.y - height - if (context.navigationBarHeight == 0) smallMargin else 0f + } + } } } else { view.photo_details.beGone() @@ -288,6 +290,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onDestroyView() { super.onDestroyView() + context.isKitkatPlus() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !activity.isDestroyed) { Glide.with(context).clear(view.photo_view) } @@ -304,6 +307,13 @@ class PhotoFragment : ViewPagerFragment() { } override fun fullscreenToggled(isFullscreen: Boolean) { - + view.photo_details.apply { + if (visibility == View.VISIBLE) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + 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) + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 4efa3b8d1..9d2e395f1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -17,10 +17,7 @@ import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.audioManager -import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.hasNavBar -import com.simplemobiletools.gallery.extensions.navigationBarHeight +import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* @@ -507,9 +504,16 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { mView.video_details.apply { - beVisible() - setTextColor(context.config.textColor) text = getMediumExtendedDetails(medium) + setTextColor(context.config.textColor) + beVisible() + onGlobalLayout { + if (height != 0) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + val timeHolderHeight = mTimeHolder.height - context.navigationBarHeight + y = context.usableScreenSize.y - height - timeHolderHeight - if (context.navigationBarHeight == 0) smallMargin else 0f + } + } } } else { mView.video_details.beGone() @@ -544,5 +548,14 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun fullscreenToggled(isFullscreen: Boolean) { mIsFullscreen = isFullscreen checkFullscreen() + mView.video_details.apply { + if (visibility == View.VISIBLE) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + 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) + } + } } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 6a8b21a47..e48b6b90a 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -21,7 +21,6 @@ android:id="@+id/photo_details" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/small_margin" android:layout_marginRight="@dimen/small_margin" diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 5a104f2ef..d0be9b3d2 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -55,7 +55,6 @@ android:id="@+id/video_details" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_above="@+id/video_time_holder" android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/small_margin" android:layout_marginRight="@dimen/small_margin"