mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 04:28:00 +01:00
Remove panorama support temporarily
The library used (https://github.com/googlevr/gvr-android-sdk) was not open source.
This commit is contained in:
parent
e30078b6d5
commit
2faae85d4d
14 changed files with 25 additions and 684 deletions
|
@ -26,7 +26,7 @@ Customize the look, feel, and functionality to match your style. From UI themes
|
|||
|
||||
**📷 UNIVERSAL FORMAT FREEDOM:**
|
||||
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, panoramas, videos, and more – we've got your memories covered, in any format you choose. No restrictions, just limitless possibilities.
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, videos, and more – we've got your memories covered, in any format you choose. No restrictions, just limitless possibilities.
|
||||
|
||||
**✨ MATERIAL DESIGN WITH DYNAMIC THEMES:**
|
||||
|
||||
|
|
|
@ -99,8 +99,6 @@ dependencies {
|
|||
implementation(libs.android.gif.drawable)
|
||||
implementation(libs.androidx.constraintlayout)
|
||||
implementation(libs.androidx.media3.exoplayer)
|
||||
implementation(libs.sdk.panowidget)
|
||||
implementation(libs.sdk.videowidget)
|
||||
implementation(libs.sanselan)
|
||||
implementation(libs.imagefilters)
|
||||
implementation(libs.androidsvg.aar)
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
android:name="android.permission.CAMERA"
|
||||
tools:node="remove" />
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.google.vr.widgets.common, com.google.vr.sdk.widgets.pano" />
|
||||
|
||||
<queries>
|
||||
<package android:name="org.fossify.gallery.debug" />
|
||||
<package android:name="org.fossify.gallery" />
|
||||
|
@ -161,18 +159,6 @@
|
|||
android:parentActivityName=".activities.MediaActivity"
|
||||
android:theme="@style/TranslucentTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.PanoramaPhotoActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:theme="@style/FullScreenTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.PanoramaVideoActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:theme="@style/FullScreenTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.IncludedFoldersActivity"
|
||||
android:configChanges="orientation"
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
package org.fossify.gallery.activities
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
import android.view.WindowInsetsController
|
||||
import android.widget.RelativeLayout
|
||||
import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener
|
||||
import com.google.vr.sdk.widgets.pano.VrPanoramaView
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.isRPlus
|
||||
import org.fossify.gallery.R
|
||||
import org.fossify.gallery.databinding.ActivityPanoramaPhotoBinding
|
||||
import org.fossify.gallery.extensions.config
|
||||
import org.fossify.gallery.extensions.hideSystemUI
|
||||
import org.fossify.gallery.extensions.showSystemUI
|
||||
import org.fossify.gallery.helpers.PATH
|
||||
|
||||
open class PanoramaPhotoActivity : SimpleActivity() {
|
||||
private val CARDBOARD_DISPLAY_MODE = 3
|
||||
|
||||
private var isFullscreen = false
|
||||
private var isExploreEnabled = true
|
||||
private var isRendering = false
|
||||
|
||||
private val binding by viewBinding(ActivityPanoramaPhotoBinding::inflate)
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(binding.root)
|
||||
|
||||
checkNotchSupport()
|
||||
setupButtonMargins()
|
||||
|
||||
binding.cardboard.setOnClickListener {
|
||||
binding.panoramaView.displayMode = CARDBOARD_DISPLAY_MODE
|
||||
}
|
||||
|
||||
binding.explore.setOnClickListener {
|
||||
isExploreEnabled = !isExploreEnabled
|
||||
binding.panoramaView.setPureTouchTracking(isExploreEnabled)
|
||||
binding.explore.setImageResource(if (isExploreEnabled) R.drawable.ic_explore_vector else R.drawable.ic_explore_off_vector)
|
||||
}
|
||||
|
||||
checkIntent()
|
||||
|
||||
if (isRPlus()) {
|
||||
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.panoramaView.resumeRendering()
|
||||
isRendering = true
|
||||
if (config.blackBackground) {
|
||||
updateStatusbarColor(Color.BLACK)
|
||||
}
|
||||
|
||||
window.statusBarColor = resources.getColor(R.color.circle_black_background)
|
||||
|
||||
if (config.maxBrightness) {
|
||||
val attributes = window.attributes
|
||||
attributes.screenBrightness = 1f
|
||||
window.attributes = attributes
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.panoramaView.pauseRendering()
|
||||
isRendering = false
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (isRendering) {
|
||||
binding.panoramaView.shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
setupButtonMargins()
|
||||
}
|
||||
|
||||
private fun checkIntent() {
|
||||
val path = intent.getStringExtra(PATH)
|
||||
if (path == null) {
|
||||
toast(R.string.invalid_image_path)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
intent.removeExtra(PATH)
|
||||
|
||||
try {
|
||||
val options = VrPanoramaView.Options()
|
||||
options.inputType = VrPanoramaView.Options.TYPE_MONO
|
||||
ensureBackgroundThread {
|
||||
val bitmap = getBitmapToLoad(path)
|
||||
runOnUiThread {
|
||||
binding.panoramaView.apply {
|
||||
beVisible()
|
||||
loadImageFromBitmap(bitmap, options)
|
||||
setFlingingEnabled(true)
|
||||
setPureTouchTracking(true)
|
||||
|
||||
// add custom buttons so we can position them and toggle visibility as desired
|
||||
setFullscreenButtonEnabled(false)
|
||||
setInfoButtonEnabled(false)
|
||||
setTransitionViewEnabled(false)
|
||||
setStereoModeButtonEnabled(false)
|
||||
|
||||
setOnClickListener {
|
||||
handleClick()
|
||||
}
|
||||
|
||||
setEventListener(object : VrPanoramaEventListener() {
|
||||
override fun onClick() {
|
||||
handleClick()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
|
||||
window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
|
||||
isFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
|
||||
toggleButtonVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getBitmapToLoad(path: String): Bitmap? {
|
||||
val options = BitmapFactory.Options()
|
||||
options.inSampleSize = 1
|
||||
var bitmap: Bitmap? = null
|
||||
|
||||
for (i in 0..10) {
|
||||
try {
|
||||
bitmap = if (path.startsWith("content://")) {
|
||||
val inputStream = contentResolver.openInputStream(Uri.parse(path))
|
||||
BitmapFactory.decodeStream(inputStream)
|
||||
} else {
|
||||
BitmapFactory.decodeFile(path, options)
|
||||
}
|
||||
break
|
||||
} catch (e: OutOfMemoryError) {
|
||||
options.inSampleSize *= 2
|
||||
}
|
||||
}
|
||||
|
||||
return bitmap
|
||||
}
|
||||
|
||||
private fun setupButtonMargins() {
|
||||
val navBarHeight = navigationBarHeight
|
||||
(binding.cardboard.layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
bottomMargin = navBarHeight
|
||||
rightMargin = navigationBarWidth
|
||||
}
|
||||
|
||||
(binding.explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navigationBarHeight
|
||||
|
||||
binding.cardboard.onGlobalLayout {
|
||||
binding.panoramaGradientBackground.layoutParams.height = navBarHeight + binding.cardboard.height
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleButtonVisibility() {
|
||||
arrayOf(binding.cardboard, binding.explore, binding.panoramaGradientBackground).forEach {
|
||||
it.animate().alpha(if (isFullscreen) 0f else 1f)
|
||||
it.isClickable = !isFullscreen
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleClick() {
|
||||
isFullscreen = !isFullscreen
|
||||
toggleButtonVisibility()
|
||||
if (isFullscreen) {
|
||||
hideSystemUI(false)
|
||||
} else {
|
||||
showSystemUI(false)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,340 +0,0 @@
|
|||
package org.fossify.gallery.activities
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
import android.view.WindowInsetsController
|
||||
import android.view.WindowManager
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.SeekBar
|
||||
import com.google.vr.sdk.widgets.video.VrVideoEventListener
|
||||
import com.google.vr.sdk.widgets.video.VrVideoView
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.isRPlus
|
||||
import org.fossify.gallery.R
|
||||
import org.fossify.gallery.databinding.ActivityPanoramaVideoBinding
|
||||
import org.fossify.gallery.extensions.config
|
||||
import org.fossify.gallery.extensions.hasNavBar
|
||||
import org.fossify.gallery.extensions.hideSystemUI
|
||||
import org.fossify.gallery.extensions.showSystemUI
|
||||
import org.fossify.gallery.helpers.MIN_SKIP_LENGTH
|
||||
import org.fossify.gallery.helpers.PATH
|
||||
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
|
||||
private var mIsPlaying = false
|
||||
private var mIsDragged = false
|
||||
private var mPlayOnReady = false
|
||||
private var mDuration = 0
|
||||
private var mCurrTime = 0
|
||||
|
||||
private var mTimerHandler = Handler()
|
||||
private val binding by viewBinding(ActivityPanoramaVideoBinding::inflate)
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(binding.root)
|
||||
|
||||
checkNotchSupport()
|
||||
checkIntent()
|
||||
|
||||
if (isRPlus()) {
|
||||
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.vrVideoView.resumeRendering()
|
||||
mIsRendering = true
|
||||
if (config.blackBackground) {
|
||||
updateStatusbarColor(Color.BLACK)
|
||||
}
|
||||
|
||||
window.statusBarColor = resources.getColor(R.color.circle_black_background)
|
||||
|
||||
if (config.maxBrightness) {
|
||||
val attributes = window.attributes
|
||||
attributes.screenBrightness = 1f
|
||||
window.attributes = attributes
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.vrVideoView.pauseRendering()
|
||||
mIsRendering = false
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (mIsRendering) {
|
||||
binding.vrVideoView.shutdown()
|
||||
}
|
||||
|
||||
if (!isChangingConfigurations) {
|
||||
mTimerHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
setupButtons()
|
||||
}
|
||||
|
||||
private fun checkIntent() {
|
||||
val path = intent.getStringExtra(PATH)
|
||||
if (path == null) {
|
||||
toast(R.string.invalid_image_path)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
setupButtons()
|
||||
intent.removeExtra(PATH)
|
||||
|
||||
binding.bottomVideoTimeHolder.videoCurrTime.setOnClickListener { skip(false) }
|
||||
binding.bottomVideoTimeHolder.videoDuration.setOnClickListener { skip(true) }
|
||||
|
||||
try {
|
||||
val options = VrVideoView.Options()
|
||||
options.inputType = VrVideoView.Options.TYPE_MONO
|
||||
val uri = if (path.startsWith("content://")) {
|
||||
Uri.parse(path)
|
||||
} else {
|
||||
Uri.fromFile(File(path))
|
||||
}
|
||||
|
||||
binding.vrVideoView.apply {
|
||||
loadVideo(uri, options)
|
||||
pauseVideo()
|
||||
|
||||
setFlingingEnabled(true)
|
||||
setPureTouchTracking(true)
|
||||
|
||||
// add custom buttons so we can position them and toggle visibility as desired
|
||||
setFullscreenButtonEnabled(false)
|
||||
setInfoButtonEnabled(false)
|
||||
setTransitionViewEnabled(false)
|
||||
setStereoModeButtonEnabled(false)
|
||||
|
||||
setOnClickListener {
|
||||
handleClick()
|
||||
}
|
||||
|
||||
setEventListener(object : VrVideoEventListener() {
|
||||
override fun onClick() {
|
||||
handleClick()
|
||||
}
|
||||
|
||||
override fun onLoadSuccess() {
|
||||
if (mDuration == 0) {
|
||||
setupDuration(duration)
|
||||
setupTimer()
|
||||
}
|
||||
|
||||
if (mPlayOnReady || config.autoplayVideos) {
|
||||
mPlayOnReady = false
|
||||
mIsPlaying = true
|
||||
resumeVideo()
|
||||
} else {
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.setImageResource(org.fossify.commons.R.drawable.ic_play_outline_vector)
|
||||
}
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.beVisible()
|
||||
}
|
||||
|
||||
override fun onCompletion() {
|
||||
videoCompleted()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.setOnClickListener {
|
||||
togglePlayPause()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
|
||||
window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
|
||||
mIsFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
|
||||
toggleButtonVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupDuration(duration: Long) {
|
||||
mDuration = (duration / 1000).toInt()
|
||||
binding.bottomVideoTimeHolder.videoSeekbar.max = mDuration
|
||||
binding.bottomVideoTimeHolder.videoDuration.text = mDuration.getFormattedDuration()
|
||||
setVideoProgress(0)
|
||||
}
|
||||
|
||||
private fun setupTimer() {
|
||||
runOnUiThread(object : Runnable {
|
||||
override fun run() {
|
||||
if (mIsPlaying && !mIsDragged) {
|
||||
mCurrTime = (binding.vrVideoView.currentPosition / 1000).toInt()
|
||||
binding.bottomVideoTimeHolder.videoSeekbar.progress = mCurrTime
|
||||
binding.bottomVideoTimeHolder.videoCurrTime.text = mCurrTime.getFormattedDuration()
|
||||
}
|
||||
|
||||
mTimerHandler.postDelayed(this, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun togglePlayPause() {
|
||||
mIsPlaying = !mIsPlaying
|
||||
if (mIsPlaying) {
|
||||
resumeVideo()
|
||||
} else {
|
||||
pauseVideo()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resumeVideo() {
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.setImageResource(org.fossify.commons.R.drawable.ic_pause_outline_vector)
|
||||
if (mCurrTime == mDuration) {
|
||||
setVideoProgress(0)
|
||||
mPlayOnReady = true
|
||||
return
|
||||
}
|
||||
|
||||
binding.vrVideoView.playVideo()
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
private fun pauseVideo() {
|
||||
binding.vrVideoView.pauseVideo()
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.setImageResource(org.fossify.commons.R.drawable.ic_play_outline_vector)
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
private fun setVideoProgress(seconds: Int) {
|
||||
binding.vrVideoView.seekTo(seconds * 1000L)
|
||||
binding.bottomVideoTimeHolder.videoSeekbar.progress = seconds
|
||||
mCurrTime = seconds
|
||||
binding.bottomVideoTimeHolder.videoCurrTime.text = seconds.getFormattedDuration()
|
||||
}
|
||||
|
||||
private fun videoCompleted() {
|
||||
mIsPlaying = false
|
||||
mCurrTime = (binding.vrVideoView.duration / 1000).toInt()
|
||||
binding.bottomVideoTimeHolder.videoSeekbar.progress = binding.bottomVideoTimeHolder.videoSeekbar.max
|
||||
binding.bottomVideoTimeHolder.videoCurrTime.text = mDuration.getFormattedDuration()
|
||||
pauseVideo()
|
||||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
var right = 0
|
||||
var bottom = 0
|
||||
|
||||
if (hasNavBar()) {
|
||||
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
bottom += navigationBarHeight
|
||||
} else {
|
||||
right += navigationBarWidth
|
||||
bottom += navigationBarHeight
|
||||
}
|
||||
}
|
||||
|
||||
binding.bottomVideoTimeHolder.root.setPadding(0, 0, right, bottom)
|
||||
binding.bottomVideoTimeHolder.root.background = resources.getDrawable(R.drawable.gradient_background)
|
||||
binding.bottomVideoTimeHolder.root.onGlobalLayout {
|
||||
val newBottomMargin = binding.bottomVideoTimeHolder.root.height - resources.getDimension(R.dimen.video_player_play_pause_size)
|
||||
.toInt() - resources.getDimension(org.fossify.commons.R.dimen.activity_margin).toInt()
|
||||
(binding.explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = newBottomMargin
|
||||
|
||||
(binding.cardboard.layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
bottomMargin = newBottomMargin
|
||||
rightMargin = navigationBarWidth
|
||||
}
|
||||
binding.explore.requestLayout()
|
||||
}
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause.setImageResource(org.fossify.commons.R.drawable.ic_play_outline_vector)
|
||||
|
||||
binding.cardboard.setOnClickListener {
|
||||
binding.vrVideoView.displayMode = CARDBOARD_DISPLAY_MODE
|
||||
}
|
||||
|
||||
binding.explore.setOnClickListener {
|
||||
mIsExploreEnabled = !mIsExploreEnabled
|
||||
binding.vrVideoView.setPureTouchTracking(mIsExploreEnabled)
|
||||
binding.explore.setImageResource(if (mIsExploreEnabled) R.drawable.ic_explore_vector else R.drawable.ic_explore_off_vector)
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleButtonVisibility() {
|
||||
val newAlpha = if (mIsFullscreen) 0f else 1f
|
||||
arrayOf(binding.cardboard, binding.explore).forEach {
|
||||
it.animate().alpha(newAlpha)
|
||||
}
|
||||
|
||||
arrayOf(
|
||||
binding.cardboard,
|
||||
binding.explore,
|
||||
binding.bottomVideoTimeHolder.videoTogglePlayPause,
|
||||
binding.bottomVideoTimeHolder.videoCurrTime,
|
||||
binding.bottomVideoTimeHolder.videoDuration
|
||||
).forEach {
|
||||
it.isClickable = !mIsFullscreen
|
||||
}
|
||||
|
||||
binding.bottomVideoTimeHolder.videoSeekbar.setOnSeekBarChangeListener(if (mIsFullscreen) null else this)
|
||||
binding.bottomVideoTimeHolder.videoTimeHolder.animate().alpha(newAlpha).start()
|
||||
}
|
||||
|
||||
private fun handleClick() {
|
||||
mIsFullscreen = !mIsFullscreen
|
||||
toggleButtonVisibility()
|
||||
if (mIsFullscreen) {
|
||||
hideSystemUI(false)
|
||||
} else {
|
||||
showSystemUI(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun skip(forward: Boolean) {
|
||||
if (forward && mCurrTime == mDuration) {
|
||||
return
|
||||
}
|
||||
|
||||
val curr = binding.vrVideoView.currentPosition
|
||||
val twoPercents = Math.max((binding.vrVideoView.duration / 50).toInt(), MIN_SKIP_LENGTH)
|
||||
val newProgress = if (forward) curr + twoPercents else curr - twoPercents
|
||||
val roundProgress = Math.round(newProgress / 1000f)
|
||||
val limitedProgress = Math.max(Math.min(binding.vrVideoView.duration.toInt(), roundProgress), 0)
|
||||
setVideoProgress(limitedProgress)
|
||||
if (!mIsPlaying) {
|
||||
togglePlayPause()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
setVideoProgress(progress)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
binding.vrVideoView.pauseVideo()
|
||||
mIsDragged = true
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
mIsPlaying = true
|
||||
resumeVideo()
|
||||
mIsDragged = false
|
||||
}
|
||||
}
|
|
@ -23,7 +23,6 @@ import org.fossify.gallery.fragments.ViewPagerFragment
|
|||
import org.fossify.gallery.helpers.*
|
||||
import org.fossify.gallery.models.Medium
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
|
||||
open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener {
|
||||
private var mMedium: Medium? = null
|
||||
|
@ -258,37 +257,18 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
return
|
||||
}
|
||||
|
||||
var isPanorama = false
|
||||
val realPath = intent?.extras?.getString(REAL_FILE_PATH) ?: ""
|
||||
try {
|
||||
if (realPath.isNotEmpty()) {
|
||||
val fis = FileInputStream(File(realPath))
|
||||
parseFileChannel(realPath, fis.channel, 0, 0, 0) {
|
||||
isPanorama = true
|
||||
}
|
||||
}
|
||||
} catch (ignored: Exception) {
|
||||
} catch (ignored: OutOfMemoryError) {
|
||||
}
|
||||
|
||||
hideKeyboard()
|
||||
if (isPanorama) {
|
||||
Intent(applicationContext, PanoramaVideoActivity::class.java).apply {
|
||||
putExtra(PATH, realPath)
|
||||
startActivity(this)
|
||||
val mimeType = getUriMimeType(mUri.toString(), newUri)
|
||||
Intent(applicationContext, VideoPlayerActivity::class.java).apply {
|
||||
setDataAndType(newUri, mimeType)
|
||||
addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
||||
if (intent.extras != null) {
|
||||
putExtras(intent.extras!!)
|
||||
}
|
||||
} else {
|
||||
val mimeType = getUriMimeType(mUri.toString(), newUri)
|
||||
Intent(applicationContext, VideoPlayerActivity::class.java).apply {
|
||||
setDataAndType(newUri, mimeType)
|
||||
addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
||||
if (intent.extras != null) {
|
||||
putExtras(intent.extras!!)
|
||||
}
|
||||
|
||||
startActivity(this)
|
||||
}
|
||||
startActivity(this)
|
||||
}
|
||||
|
||||
finish()
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ fun SimpleActivity.launchSettings() {
|
|||
|
||||
fun SimpleActivity.launchAbout() {
|
||||
val licenses = LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_RTL or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE or
|
||||
LICENSE_PICASSO or LICENSE_EXOPLAYER or LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS or LICENSE_GESTURE_VIEWS or LICENSE_APNG
|
||||
LICENSE_PICASSO or LICENSE_EXOPLAYER or LICENSE_SANSELAN or LICENSE_FILTERS or LICENSE_GESTURE_VIEWS or LICENSE_APNG
|
||||
|
||||
val faqItems = arrayListOf(
|
||||
FAQItem(R.string.faq_3_title, R.string.faq_3_text),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.fossify.gallery.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
|
@ -48,7 +47,6 @@ import org.fossify.commons.extensions.*
|
|||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.isRPlus
|
||||
import org.fossify.gallery.R
|
||||
import org.fossify.gallery.activities.PanoramaPhotoActivity
|
||||
import org.fossify.gallery.activities.PhotoActivity
|
||||
import org.fossify.gallery.activities.PhotoVideoActivity
|
||||
import org.fossify.gallery.activities.ViewPagerActivity
|
||||
|
@ -212,9 +210,10 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
mWasInit = true
|
||||
updateInstantSwitchWidths()
|
||||
|
||||
ensureBackgroundThread {
|
||||
checkIfPanorama()
|
||||
}
|
||||
// TODO: Implement panorama using a FOSS library
|
||||
// ensureBackgroundThread {
|
||||
// checkIfPanorama()
|
||||
// }
|
||||
|
||||
return mView
|
||||
}
|
||||
|
@ -517,7 +516,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
if (mMedium.path != mOriginalPath) {
|
||||
mMedium.path = mOriginalPath
|
||||
loadImage()
|
||||
checkIfPanorama()
|
||||
// TODO: Implement panorama using a FOSS library
|
||||
// checkIfPanorama()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -642,10 +642,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
private fun getFilePathToShow() = if (mMedium.isPortrait()) mCurrentPortraitPhotoPath else getPathToLoad(mMedium)
|
||||
|
||||
private fun openPanorama() {
|
||||
Intent(context, PanoramaPhotoActivity::class.java).apply {
|
||||
putExtra(PATH, mMedium.path)
|
||||
startActivity(this)
|
||||
}
|
||||
TODO("Panorama is not yet implemented.")
|
||||
}
|
||||
|
||||
private fun scheduleZoomableView() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.fossify.gallery.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Point
|
||||
import android.graphics.SurfaceTexture
|
||||
|
@ -28,13 +27,15 @@ import com.bumptech.glide.Glide
|
|||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.gallery.R
|
||||
import org.fossify.gallery.activities.PanoramaVideoActivity
|
||||
import org.fossify.gallery.activities.VideoActivity
|
||||
import org.fossify.gallery.databinding.PagerVideoItemBinding
|
||||
import org.fossify.gallery.extensions.config
|
||||
import org.fossify.gallery.extensions.hasNavBar
|
||||
import org.fossify.gallery.extensions.parseFileChannel
|
||||
import org.fossify.gallery.helpers.*
|
||||
import org.fossify.gallery.helpers.Config
|
||||
import org.fossify.gallery.helpers.FAST_FORWARD_VIDEO_MS
|
||||
import org.fossify.gallery.helpers.MEDIUM
|
||||
import org.fossify.gallery.helpers.SHOULD_INIT_FRAGMENT
|
||||
import org.fossify.gallery.models.Medium
|
||||
import org.fossify.gallery.views.MediaSideScroll
|
||||
import java.io.File
|
||||
|
@ -176,7 +177,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
|
||||
mIsFullscreen = activity.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
initTimeHolder()
|
||||
checkIfPanorama()
|
||||
// checkIfPanorama() TODO: Implement panorama using a FOSS library
|
||||
|
||||
ensureBackgroundThread {
|
||||
activity.getVideoResolution(mMedium.path)?.apply {
|
||||
|
@ -502,10 +503,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
private fun openPanorama() {
|
||||
Intent(context, PanoramaVideoActivity::class.java).apply {
|
||||
putExtra(PATH, mMedium.path)
|
||||
startActivity(this)
|
||||
}
|
||||
TODO("Panorama is not yet implemented.")
|
||||
}
|
||||
|
||||
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/panorama_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/md_grey_black">
|
||||
|
||||
<com.google.vr.sdk.widgets.pano.VrPanoramaView
|
||||
android:id="@+id/panorama_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panorama_gradient_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background"
|
||||
android:contentDescription="@null"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cardboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_cardboard_vector"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/explore"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_explore_vector"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/vr_video_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/md_grey_black">
|
||||
|
||||
<com.google.vr.sdk.widgets.video.VrVideoView
|
||||
android:id="@+id/vr_video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/bottom_video_time_holder"
|
||||
layout="@layout/bottom_video_time_holder"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/explore"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_explore_vector"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cardboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_cardboard_vector"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -16,7 +16,7 @@ Breathe easy, accidents happen! Fossify Gallery's built-in recycle bin lets you
|
|||
Customize the look, feel, and functionality to match your style. From UI themes to function buttons, Fossify Gallery gives you the creative freedom you crave.
|
||||
|
||||
📷 UNIVERSAL FORMAT FREEDOM:
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, panoramas, videos, and more – we've got your memories covered, in any format you choose. No restrictions, just limitless possibilities.
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, videos, and more – we've got your memories covered, in any format you choose. No restrictions, just limitless possibilities.
|
||||
|
||||
✨ MATERIAL DESIGN WITH DYNAMIC THEMES:
|
||||
Experience the beauty of intuitive material design with dynamic themes. Want more? Dive into custom themes and make your gallery truly unique.
|
||||
|
|
|
@ -16,7 +16,7 @@ Spokojnie, wypadki się zdarzają! Wbudowany kosz w Fossify Gallery pozwala odzy
|
|||
Dostosuj wygląd, działanie i funkcjonalność do swojego stylu. Od motywów interfejsu użytkownika po przyciski akcji, Fossify Gallery daje Ci twórczą swobodę, której pragniesz.
|
||||
|
||||
📷 OBSŁUGA POWSZECHNYCH FORMATÓW:
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, zdjęcia panoramiczne, wideo i wiele więcej — obsłużymy Twoje wspomnienia w dowolnym, wybranym przez Ciebie formacie. Bez ograniczeń, po prostu bez limitu możliwości.
|
||||
JPEG, PNG, MP4, MKV, RAW, SVG, GIF, wideo i wiele więcej — obsłużymy Twoje wspomnienia w dowolnym, wybranym przez Ciebie formacie. Bez ograniczeń, po prostu bez limitu możliwości.
|
||||
|
||||
✨ MATERIAL DESIGN Z DYNAMICZNYMI MOTYWAMI:
|
||||
Doświadcz piękna intuicyjnego Material Design z dynamicznymi motywami. Chcesz więcej? Zanurz się w niestandardowych motywach i spraw, aby Twoja galeria była naprawdę wyjątkowa.
|
||||
|
|
|
@ -25,8 +25,6 @@ gestureviews = "e706487a14"
|
|||
androidsvgAar = "1.4"
|
||||
imagefilters = "1.0.7"
|
||||
sanselan = "0.97-incubator"
|
||||
sdkVideowidget = "1.180.0"
|
||||
sdkPanowidget = "1.180.0"
|
||||
media3Exoplayer = "1.1.0"
|
||||
okhttp = "4.9.0"
|
||||
okio = "3.0.0"
|
||||
|
@ -65,8 +63,6 @@ imagefilters = { module = "info.androidhive:imagefilters", version.ref = "imagef
|
|||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
|
||||
sanselan = { module = "org.apache.sanselan:sanselan", version.ref = "sanselan" }
|
||||
sdk-videowidget = { module = "com.google.vr:sdk-videowidget", version.ref = "sdkVideowidget" }
|
||||
sdk-panowidget = { module = "com.google.vr:sdk-panowidget", version.ref = "sdkPanowidget" }
|
||||
apng = { module = "com.github.penfeizhou.android.animation:apng", version.ref = "apng" }
|
||||
awebp = { module = "com.github.penfeizhou.android.animation:awebp", version.ref = "awebp" }
|
||||
glide-compiler = { module = "com.github.bumptech.glide:ksp", version.ref = "glideCompiler" }
|
||||
|
|
Loading…
Reference in a new issue