diff --git a/app/build.gradle b/app/build.gradle index 20ef60b9..450b7521 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { testApplicationId "ac.mdiq.podcini.tests" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - versionCode 3020234 - versionName "6.5.0.1" + versionCode 3020235 + versionName "6.5.1" applicationId "ac.mdiq.podcini.R" def commit = "" diff --git a/app/proguard.cfg b/app/proguard.cfg index 4b22dc08..25717d63 100644 --- a/app/proguard.cfg +++ b/app/proguard.cfg @@ -71,4 +71,3 @@ -dontwarn java.lang.management.ThreadMXBean -dontwarn org.slf4j.impl.StaticLoggerBinder -# -dontwarn java.beans.BeanDescriptor diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/VideoplayerActivity.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/VideoplayerActivity.kt index 84e493e0..3153486c 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/VideoplayerActivity.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/activity/VideoplayerActivity.kt @@ -104,6 +104,7 @@ class VideoplayerActivity : CastEnabledActivity() { private fun setForVideoMode() { when (videoMode) { VideoMode.FULL_SCREEN_VIEW -> { + window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN) setTheme(R.style.Theme_Podcini_VideoPlayer) requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE @@ -111,13 +112,16 @@ class VideoplayerActivity : CastEnabledActivity() { window.setFormat(PixelFormat.TRANSPARENT) } VideoMode.WINDOW_VIEW -> { + window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) + window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN) setTheme(R.style.Theme_Podcini_VideoEpisode) - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT window.setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) window.setFormat(PixelFormat.TRANSPARENT) } else -> {} } + if (::videoEpisodeFragment.isInitialized) videoEpisodeFragment.setForVideoMode() } @UnstableApi @@ -143,7 +147,6 @@ class VideoplayerActivity : CastEnabledActivity() { super.onDestroy() } - public override fun onUserLeaveHint() { if (!PictureInPictureUtil.isInPictureInPictureMode(this)) compatEnterPictureInPicture() } @@ -185,7 +188,7 @@ class VideoplayerActivity : CastEnabledActivity() { } } - fun onEventMainThread(event: FlowEvent.MessageEvent) { + private fun onEventMainThread(event: FlowEvent.MessageEvent) { // Logd(TAG, "onEvent($event)") val errorDialog = MaterialAlertDialogBuilder(this) errorDialog.setMessage(event.message) @@ -249,20 +252,20 @@ class VideoplayerActivity : CastEnabledActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { // some options option requires FeedItem - when { - item.itemId == R.id.player_switch_to_audio_only -> { + when (item.itemId) { + R.id.player_switch_to_audio_only -> { switchToAudioOnly = true finish() return true } - item.itemId == android.R.id.home -> { + android.R.id.home -> { val intent = Intent(this@VideoplayerActivity, MainActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) startActivity(intent) finish() return true } - item.itemId == R.id.player_show_chapters -> { + R.id.player_show_chapters -> { ChaptersFragment().show(supportFragmentManager, ChaptersFragment.TAG) return true } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AddFeedFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AddFeedFragment.kt index 810499a6..65899532 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AddFeedFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AddFeedFragment.kt @@ -171,7 +171,6 @@ class AddFeedFragment : Fragment() { @UnstableApi private fun addLocalFolderResult(uri: Uri?) { if (uri == null) return - val scope = CoroutineScope(Dispatchers.Main) scope.launch { try { diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt index 184f2f9c..4d528d73 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt @@ -555,7 +555,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar ensureService() (activity as MainActivity).bottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED) } else { - playPause() +// playPause() // controller!!.ensureService() val intent = getPlayerActivityIntent(requireContext(), mediaType) startActivity(intent) diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/OnlineFeedViewFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/OnlineFeedViewFragment.kt index ebcac640..2b17685a 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/OnlineFeedViewFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/OnlineFeedViewFragment.kt @@ -218,7 +218,6 @@ class OnlineFeedViewFragment : Fragment() { break } } - if (url != null) { Logd(TAG, "Successfully retrieve feed url") isFeedFoundBySearch = true @@ -268,9 +267,9 @@ class OnlineFeedViewFragment : Fragment() { try { val channelTabInfo = ChannelTabInfo.getInfo(service, channelInfo.tabs.first()) Logd(TAG, "startFeedBuilding result1: $channelTabInfo ${channelTabInfo.relatedItems.size}") + selectedDownloadUrl = prepareUrl(url) val feed_ = Feed(selectedDownloadUrl, null) feed_.id = 1234567889L - selectedDownloadUrl = prepareUrl(url) feed_.type = Feed.FeedType.YOUTUBE.name feed_.hasVideoMedia = true feed_.title = channelInfo.name @@ -479,6 +478,7 @@ class OnlineFeedViewFragment : Fragment() { } val fo = updateFeed(requireContext(), feed, false) Logd(TAG, "fo.id: ${fo?.id} feed.id: ${feed.id}") +// feeds = getFeedList() } withContext(Dispatchers.Main) { didPressSubscribe = true @@ -521,8 +521,6 @@ class OnlineFeedViewFragment : Fragment() { } @UnstableApi private fun openFeed() { - // feed.getId() is always 0, we have to retrieve the id from the feed list from - // the database (activity as MainActivity).loadFeedFragmentById(feedId, null) } @@ -542,6 +540,9 @@ class OnlineFeedViewFragment : Fragment() { if (dli == null || selectedDownloadUrl == null) return when { +// feedSource != "VistaGuide" -> { +// binding.subscribeButton.isEnabled = false +// } dli.isDownloadingEpisode(selectedDownloadUrl!!) -> { binding.subscribeButton.isEnabled = false binding.subscribeButton.setText(R.string.subscribing_label) @@ -695,7 +696,6 @@ class OnlineFeedViewFragment : Fragment() { fun findLinks(inVal: File, baseUrl: String): Map { return findLinks(Jsoup.parse(inVal), baseUrl) } - /** * Discovers links to RSS and Atom feeds in the given File which must be a HTML document. * @return A map which contains the feed URLs as keys and titles as values (the feed URL is also used as a title if diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/VideoEpisodeFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/VideoEpisodeFragment.kt index 1346aa6e..944f3adf 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/VideoEpisodeFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/VideoEpisodeFragment.kt @@ -30,6 +30,7 @@ import ac.mdiq.podcini.ui.view.ShownotesWebView import ac.mdiq.podcini.storage.utils.DurationConverter.getDurationStringLong import ac.mdiq.podcini.util.Logd import ac.mdiq.podcini.storage.utils.TimeSpeedConverter +import ac.mdiq.podcini.ui.activity.VideoplayerActivity.VideoMode import ac.mdiq.podcini.util.EventFlow import ac.mdiq.podcini.util.FlowEvent import android.os.Bundle @@ -74,7 +75,7 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { private var itemsLoaded = false private var episode: Episode? = null private var webviewData: String? = null - private lateinit var webvDescription: ShownotesWebView + var webvDescription: ShownotesWebView? = null var destroyingDueToReload = false var controller: ServiceStatusHandler? = null @@ -123,8 +124,10 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { override fun surfaceDestroyed(holder: SurfaceHolder) { Logd(TAG, "Videosurface was destroyed") videoSurfaceCreated = false - if (controller != null && !destroyingDueToReload && !(activity as VideoplayerActivity).switchToAudioOnly) - notifyVideoSurfaceAbandoned() + (activity as? VideoplayerActivity)?.finish() +// TODO: test +// if (controller != null && !destroyingDueToReload && !(activity as VideoplayerActivity).switchToAudioOnly) +// notifyVideoSurfaceAbandoned() } } @@ -200,8 +203,10 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { override fun onDestroyView() { Logd(TAG, "onDestroyView") - root.removeView(webvDescription) - webvDescription.destroy() + if (webvDescription != null) { + root.removeView(webvDescription!!) + webvDescription!!.destroy() + } _binding = null controller?.release() controller = null // prevent leak @@ -227,6 +232,24 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { } } + fun setForVideoMode() { + when (videoMode) { + VideoMode.FULL_SCREEN_VIEW ->{ + webvDescription?.visibility = View.GONE + val layoutParams = binding.videoPlayerContainer.layoutParams + layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT + binding.videoPlayerContainer.layoutParams = layoutParams + } + VideoMode.WINDOW_VIEW -> { + webvDescription?.visibility = View.VISIBLE + val layoutParams = binding.videoPlayerContainer.layoutParams + layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT + binding.videoPlayerContainer.layoutParams = layoutParams + } + else -> {} + } + } + private fun bufferUpdate(event: FlowEvent.BufferUpdateEvent) { when { event.hasStarted() -> binding.progressBar.visibility = View.VISIBLE @@ -289,7 +312,7 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { invalidateOptionsMenu(requireActivity()) } } - if (webviewData != null && !itemsLoaded) webvDescription.loadDataWithBaseURL("https://127.0.0.1", webviewData!!, + if (webviewData != null && !itemsLoaded) webvDescription?.loadDataWithBaseURL("https://127.0.0.1", webviewData!!, "text/html", "utf-8", "about:blank") itemsLoaded = true @@ -375,7 +398,9 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { fun toggleVideoControlsVisibility() { if (videoControlsShowing) { hideVideoControls(true) - if (videoMode == VideoplayerActivity.VideoMode.FULL_SCREEN_VIEW) (activity as AppCompatActivity).supportActionBar?.hide() + if (videoMode == VideoplayerActivity.VideoMode.FULL_SCREEN_VIEW) { + (activity as AppCompatActivity).supportActionBar?.hide() + } } else { showVideoControls() (activity as AppCompatActivity).supportActionBar?.show() @@ -456,7 +481,7 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { } (activity as AppCompatActivity).window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) // binding.videoView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE - binding.bottomControlsContainer.fitsSystemWindows = true +// binding.bottomControlsContainer.fitsSystemWindows = true } fun hideVideoControls(showAnimation: Boolean) { @@ -472,7 +497,7 @@ class VideoEpisodeFragment : Fragment(), OnSeekBarChangeListener { // (activity as AppCompatActivity).window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LOW_PROFILE // or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) - binding.bottomControlsContainer.fitsSystemWindows = true +// binding.bottomControlsContainer.fitsSystemWindows = true binding.bottomControlsContainer.visibility = View.GONE binding.controlsContainer.visibility = View.GONE } diff --git a/app/src/main/res/layout/video_episode_fragment.xml b/app/src/main/res/layout/video_episode_fragment.xml index 1039ef0d..2d0943b2 100644 --- a/app/src/main/res/layout/video_episode_fragment.xml +++ b/app/src/main/res/layout/video_episode_fragment.xml @@ -8,15 +8,15 @@ android:id="@+id/videoEpisodeContainer"> + android:background="@color/black"> - true + false + true