diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaPhotoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaPhotoActivity.kt
index 7773ddd0d..27584fdc9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaPhotoActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaPhotoActivity.kt
@@ -24,7 +24,7 @@ import kotlinx.android.synthetic.main.activity_panorama_photo.*
open class PanoramaPhotoActivity : SimpleActivity() {
private val CARDBOARD_DISPLAY_MODE = 3
- private var isFullScreen = false
+ private var isFullscreen = false
private var isExploreEnabled = true
private var isRendering = false
@@ -131,7 +131,7 @@ open class PanoramaPhotoActivity : SimpleActivity() {
}
window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
- isFullScreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
+ isFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
toggleButtonVisibility()
}
}
@@ -159,8 +159,9 @@ open class PanoramaPhotoActivity : SimpleActivity() {
}
private fun setupButtonMargins() {
+ val navBarHeight = navigationBarHeight
(cardboard.layoutParams as RelativeLayout.LayoutParams).apply {
- bottomMargin = navigationBarHeight
+ bottomMargin = navBarHeight
rightMargin = navigationBarWidth
}
@@ -168,17 +169,17 @@ open class PanoramaPhotoActivity : SimpleActivity() {
}
private fun toggleButtonVisibility() {
- cardboard.animate().alpha(if (isFullScreen) 0f else 1f)
- cardboard.isClickable = !isFullScreen
+ cardboard.animate().alpha(if (isFullscreen) 0f else 1f)
+ cardboard.isClickable = !isFullscreen
- explore.animate().alpha(if (isFullScreen) 0f else 1f)
- explore.isClickable = !isFullScreen
+ explore.animate().alpha(if (isFullscreen) 0f else 1f)
+ explore.isClickable = !isFullscreen
}
private fun handleClick() {
- isFullScreen = !isFullScreen
+ isFullscreen = !isFullscreen
toggleButtonVisibility()
- if (isFullScreen) {
+ if (isFullscreen) {
hideSystemUI(false)
} else {
showSystemUI(false)
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaVideoActivity.kt
index 194554028..30e76ad5a 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaVideoActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PanoramaVideoActivity.kt
@@ -20,10 +20,7 @@ import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
import com.simplemobiletools.commons.helpers.isPiePlus
import com.simplemobiletools.gallery.R
-import com.simplemobiletools.gallery.extensions.config
-import com.simplemobiletools.gallery.extensions.hideSystemUI
-import com.simplemobiletools.gallery.extensions.navigationBarHeight
-import com.simplemobiletools.gallery.extensions.showSystemUI
+import com.simplemobiletools.gallery.extensions.*
import com.simplemobiletools.gallery.helpers.HIDE_PLAY_PAUSE_DELAY
import com.simplemobiletools.gallery.helpers.MIN_SKIP_LENGTH
import com.simplemobiletools.gallery.helpers.PATH
@@ -33,6 +30,8 @@ import kotlinx.android.synthetic.main.bottom_video_time_holder.*
import java.io.File
open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
+ private val CARDBOARD_DISPLAY_MODE = 3
+
private var mIsFullscreen = false
private var mIsExploreEnabled = true
private var mIsRendering = false
@@ -59,6 +58,10 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
setupButtonMargins()
+ cardboard.setOnClickListener {
+ vr_video_view.displayMode = CARDBOARD_DISPLAY_MODE
+ }
+
explore.setOnClickListener {
mIsExploreEnabled = !mIsExploreEnabled
vr_video_view.setPureTouchTracking(mIsExploreEnabled)
@@ -254,14 +257,27 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
}
private fun setupButtonMargins() {
- (video_time_holder.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navigationBarHeight
+ val navBarHeight = navigationBarHeight
+ video_time_holder.apply {
+ (layoutParams as RelativeLayout.LayoutParams).bottomMargin = navBarHeight
+ setPadding(paddingLeft, paddingTop, navigationBarWidth, paddingBottom)
+ }
+
video_time_holder.onGlobalLayout {
- (explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navigationBarHeight + video_time_holder.height
+ (explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navBarHeight + video_time_holder.height
+
+ (cardboard.layoutParams as RelativeLayout.LayoutParams).apply {
+ bottomMargin = navBarHeight + video_time_holder.height
+ rightMargin = navigationBarWidth
+ }
explore.requestLayout()
}
}
private fun toggleButtonVisibility() {
+ cardboard.animate().alpha(if (mIsFullscreen) 0f else 1f)
+ cardboard.isClickable = !mIsFullscreen
+
explore.animate().alpha(if (mIsFullscreen) 0f else 1f)
explore.isClickable = !mIsFullscreen
diff --git a/app/src/main/res/layout/activity_panorama_video.xml b/app/src/main/res/layout/activity_panorama_video.xml
index 84a1962aa..ca3704d84 100644
--- a/app/src/main/res/layout/activity_panorama_video.xml
+++ b/app/src/main/res/layout/activity_panorama_video.xml
@@ -20,6 +20,15 @@
android:padding="@dimen/activity_margin"
android:src="@drawable/ic_explore"/>
+
+