diff --git a/app/build.gradle b/app/build.gradle
index e7f656397..a60229b8b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,6 +56,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.0'
implementation 'com.google.vr:sdk-panowidget:1.170.0'
+ implementation 'com.google.vr:sdk-videowidget:1.170.0'
implementation 'org.apache.sanselan:sanselan:0.97-incubator'
implementation 'info.androidhive:imagefilters:1.0.7'
implementation 'com.squareup.picasso:picasso:2.71828'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 90fe663e1..86ed4b512 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -127,6 +127,11 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/FullScreenTheme"/>
+
+
+ isFullScreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
+ toggleButtonVisibility()
+ }
+ }
+
+ override fun onConfigurationChanged(newConfig: Configuration?) {
+ super.onConfigurationChanged(newConfig)
+ setupButtonMargins()
+ }
+
+ private fun setupButtonMargins() {
+ (explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navigationBarHeight
+ }
+
+ private fun toggleButtonVisibility() {
+ explore.animate().alpha(if (isFullScreen) 0f else 1f)
+ explore.isClickable = !isFullScreen
+ }
+
+ private fun handleClick() {
+ isFullScreen = !isFullScreen
+ toggleButtonVisibility()
+ if (isFullScreen) {
+ hideSystemUI(false)
+ } else {
+ showSystemUI(false)
+ }
+ }
+}
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 aedb8a284..d6fddb039 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt
@@ -1,5 +1,6 @@
package com.simplemobiletools.gallery.fragments
+import android.content.Intent
import android.content.res.Configuration
import android.graphics.Point
import android.graphics.SurfaceTexture
@@ -26,10 +27,12 @@ import com.google.android.exoplayer2.upstream.FileDataSource
import com.google.android.exoplayer2.video.VideoListener
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.gallery.R
+import com.simplemobiletools.gallery.activities.PanoramaVideoActivity
import com.simplemobiletools.gallery.activities.VideoActivity
import com.simplemobiletools.gallery.extensions.*
import com.simplemobiletools.gallery.helpers.MEDIUM
import com.simplemobiletools.gallery.helpers.MediaSideScroll
+import com.simplemobiletools.gallery.helpers.PATH
import com.simplemobiletools.gallery.models.Medium
import kotlinx.android.synthetic.main.pager_video_item.view.*
import java.io.File
@@ -77,6 +80,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
video_curr_time.setOnClickListener { skip(false) }
video_duration.setOnClickListener { skip(true) }
video_holder.setOnClickListener { toggleFullscreen() }
+ panorama_outline.setOnClickListener { openPanorama() }
// adding an empty click listener just to avoid ripple animation at toggling fullscreen
video_seekbar.setOnClickListener { }
@@ -611,6 +615,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
mIsDragged = false
}
+ private fun openPanorama() {
+ Intent(context, PanoramaVideoActivity::class.java).apply {
+ putExtra(PATH, medium.path)
+ startActivity(this)
+ }
+ }
+
override fun fullscreenToggled(isFullscreen: Boolean) {
mIsFullscreen = isFullscreen
checkFullscreen()
diff --git a/app/src/main/res/layout/activity_panorama.xml b/app/src/main/res/layout/activity_panorama_photo.xml
similarity index 100%
rename from app/src/main/res/layout/activity_panorama.xml
rename to app/src/main/res/layout/activity_panorama_photo.xml
index ab146f09e..ff13ef97c 100644
--- a/app/src/main/res/layout/activity_panorama.xml
+++ b/app/src/main/res/layout/activity_panorama_photo.xml
@@ -16,8 +16,8 @@
android:id="@+id/cardboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
+ android:layout_alignParentBottom="true"
android:padding="@dimen/activity_margin"
android:src="@drawable/ic_cardboard"/>
@@ -25,8 +25,8 @@
android:id="@+id/explore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
+ android:layout_alignParentBottom="true"
android:padding="@dimen/activity_margin"
android:src="@drawable/ic_explore"/>
diff --git a/app/src/main/res/layout/activity_panorama_video.xml b/app/src/main/res/layout/activity_panorama_video.xml
new file mode 100644
index 000000000..7708f6412
--- /dev/null
+++ b/app/src/main/res/layout/activity_panorama_video.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+