6.5.1 commit

This commit is contained in:
Xilin Jia 2024-08-31 13:31:36 +01:00
parent 277ce496b6
commit 0299b53c8c
12 changed files with 67 additions and 31 deletions

View File

@ -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 = ""

View File

@ -71,4 +71,3 @@
-dontwarn java.lang.management.ThreadMXBean
-dontwarn org.slf4j.impl.StaticLoggerBinder
# -dontwarn java.beans.BeanDescriptor

View File

@ -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
}

View File

@ -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 {

View File

@ -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)

View File

@ -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<String, String> {
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

View File

@ -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
}

View File

@ -8,15 +8,15 @@
android:id="@+id/videoEpisodeContainer">
<FrameLayout
android:id="@+id/videoPlayerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:id="@+id/videoPlayerContainer">
android:background="@color/black">
<ac.mdiq.podcini.ui.view.AspectRatioVideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center" />
<ProgressBar
@ -183,7 +183,6 @@
</RelativeLayout>
</LinearLayout>
</FrameLayout>
<ac.mdiq.podcini.ui.view.ShownotesWebView

View File

@ -239,6 +239,8 @@
<style name="Theme.Podcini.VideoPlayer" parent="@style/Theme.Podcini.Dark">
<item name="windowActionBarOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Podcini.TextView.Heading" parent="@android:style/TextAppearance.Medium">

View File

@ -1,3 +1,8 @@
# 6.5.1
* further improved behavior in video player, seamless switch among audio-only, window and fullscreen modes, and automatical switch to audio when exit
* fixed issue of OnlineFeed view not transition to FeedEpisodes view when subscribing a Youtube channel
# 6.5.0.1
* fixed release app being improperly stripped of classes by R8

View File

@ -1,3 +1,3 @@
Version 6.5.1 brings several changes:
Version 6.5.0.1 brings several changes:
* fixed release app being improperly stripped of classes by R8

View File

@ -0,0 +1,4 @@
Version 6.5.1 brings several changes:
* further improved behavior in video player, seamless switch among audio-only, window and fullscreen modes, and automatical switch to audio when exit
* fixed issue of OnlineFeed view not transition to FeedEpisodes view when subscribing a Youtube channel