mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
add back the video time holder at the bottom of the video fragment
This commit is contained in:
parent
a5191666b2
commit
6d1cf81c96
2 changed files with 21 additions and 1 deletions
|
@ -6,6 +6,7 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.RelativeLayout
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
|
@ -15,6 +16,7 @@ import com.simplemobiletools.gallery.pro.helpers.MEDIUM
|
||||||
import com.simplemobiletools.gallery.pro.helpers.PATH
|
import com.simplemobiletools.gallery.pro.helpers.PATH
|
||||||
import com.simplemobiletools.gallery.pro.models.Medium
|
import com.simplemobiletools.gallery.pro.models.Medium
|
||||||
import com.simplemobiletools.gallery.pro.views.MediaSideScroll
|
import com.simplemobiletools.gallery.pro.views.MediaSideScroll
|
||||||
|
import kotlinx.android.synthetic.main.bottom_video_time_holder.view.*
|
||||||
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
@ -29,6 +31,7 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
private var mStoredBottomActions = true
|
private var mStoredBottomActions = true
|
||||||
private var mStoredExtendedDetails = 0
|
private var mStoredExtendedDetails = 0
|
||||||
|
|
||||||
|
private lateinit var mTimeHolder: View
|
||||||
private lateinit var mBrightnessSideScroll: MediaSideScroll
|
private lateinit var mBrightnessSideScroll: MediaSideScroll
|
||||||
private lateinit var mVolumeSideScroll: MediaSideScroll
|
private lateinit var mVolumeSideScroll: MediaSideScroll
|
||||||
|
|
||||||
|
@ -44,6 +47,7 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
panorama_outline.setOnClickListener { openPanorama() }
|
panorama_outline.setOnClickListener { openPanorama() }
|
||||||
video_play_outline.setOnClickListener { launchVideoPlayer() }
|
video_play_outline.setOnClickListener { launchVideoPlayer() }
|
||||||
|
|
||||||
|
mTimeHolder = video_time_holder
|
||||||
mBrightnessSideScroll = video_brightness_controller
|
mBrightnessSideScroll = video_brightness_controller
|
||||||
mVolumeSideScroll = video_volume_controller
|
mVolumeSideScroll = video_volume_controller
|
||||||
|
|
||||||
|
@ -60,6 +64,7 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
Glide.with(context!!).load(mMedium.path).into(mView.video_preview)
|
Glide.with(context!!).load(mMedium.path).into(mView.video_preview)
|
||||||
|
|
||||||
mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
initTimeHolder()
|
||||||
checkIfPanorama()
|
checkIfPanorama()
|
||||||
|
|
||||||
if (mIsPanorama) {
|
if (mIsPanorama) {
|
||||||
|
@ -105,6 +110,7 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkExtendedDetails()
|
checkExtendedDetails()
|
||||||
|
initTimeHolder()
|
||||||
storeStateVariables()
|
storeStateVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +122,7 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
checkExtendedDetails()
|
checkExtendedDetails()
|
||||||
|
initTimeHolder()
|
||||||
updateInstantSwitchWidths()
|
updateInstantSwitchWidths()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +164,15 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initTimeHolder() {
|
||||||
|
var bottomMargin = context!!.navigationBarHeight
|
||||||
|
if (context!!.config.bottomActions) {
|
||||||
|
bottomMargin += resources.getDimension(R.dimen.bottom_actions_height).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
(mTimeHolder.layoutParams as RelativeLayout.LayoutParams).bottomMargin = bottomMargin
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkIfPanorama() {
|
private fun checkIfPanorama() {
|
||||||
try {
|
try {
|
||||||
val fis = FileInputStream(File(mMedium.path))
|
val fis = FileInputStream(File(mMedium.path))
|
||||||
|
@ -183,12 +199,14 @@ class VideoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
override fun fullscreenToggled(isFullscreen: Boolean) {
|
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||||
mIsFullscreen = isFullscreen
|
mIsFullscreen = isFullscreen
|
||||||
|
val newAlpha = if (isFullscreen) 0f else 1f
|
||||||
|
mTimeHolder.animate().alpha(newAlpha).start()
|
||||||
mView.video_details.apply {
|
mView.video_details.apply {
|
||||||
if (mStoredShowExtendedDetails && isVisible()) {
|
if (mStoredShowExtendedDetails && isVisible()) {
|
||||||
animate().y(getExtendedDetailsY(height))
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
|
||||||
if (mStoredHideExtendedDetails) {
|
if (mStoredHideExtendedDetails) {
|
||||||
animate().alpha(if (isFullscreen) 0f else 1f).start()
|
animate().alpha(newAlpha).start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,4 +83,6 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="My video\nAnother line"/>
|
tools:text="My video\nAnother line"/>
|
||||||
|
|
||||||
|
<include layout="@layout/bottom_video_time_holder"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
Loading…
Reference in a new issue