Skip to content

Commit

Permalink
6.5.1 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Aug 31, 2024
1 parent 277ce49 commit 0299b53
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
1 change: 0 additions & 1 deletion app/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@
-dontwarn java.lang.management.ThreadMXBean

-dontwarn org.slf4j.impl.StaticLoggerBinder
# -dontwarn java.beans.BeanDescriptor
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,24 @@ 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
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
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
Expand All @@ -143,7 +147,6 @@ class VideoplayerActivity : CastEnabledActivity() {
super.onDestroy()
}


public override fun onUserLeaveHint() {
if (!PictureInPictureUtil.isInPictureInPictureMode(this)) compatEnterPictureInPicture()
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ class OnlineFeedViewFragment : Fragment() {
break
}
}

if (url != null) {
Logd(TAG, "Successfully retrieve feed url")
isFeedFoundBySearch = true
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand All @@ -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
}
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/res/layout/video_episode_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -183,7 +183,6 @@
</RelativeLayout>

</LinearLayout>

</FrameLayout>

<ac.mdiq.podcini.ui.view.ShownotesWebView
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/changelogs/3020234.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/3020235.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0299b53

Please sign in to comment.