From 3566f60b3ec8cc17ce563a3f38487e20f22a01f1 Mon Sep 17 00:00:00 2001 From: Xilin Jia <6257601+XilinJia@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:41:17 +0100 Subject: [PATCH] 4.9.4 commit --- app/build.gradle | 4 ++-- .../service/handler/FeedParserTask.kt | 2 +- .../playback/service/PlaybackService.kt | 2 +- .../storage/AutomaticDownloadAlgorithm.kt | 7 +++--- .../java/ac/mdiq/podcini/storage/DBTasks.kt | 10 +++++++++ .../mdiq/podcini/storage/model/feed/Feed.kt | 6 ++--- .../podcini/storage/model/feed/FeedItem.kt | 22 +++---------------- .../storage/model/feed/FeedPreferences.kt | 4 ++-- .../actions/FeedMultiSelectActionHandler.kt | 2 +- .../ui/fragment/AudioPlayerFragment.kt | 14 ++++++++---- .../mdiq/podcini/util/TimeSpeedConverter.kt | 6 ++--- changelog.md | 11 +++++++++- .../android/en-US/changelogs/3020135.txt | 9 ++++++++ 13 files changed, 58 insertions(+), 41 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/3020135.txt diff --git a/app/build.gradle b/app/build.gradle index bf635d26..ceca22a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -158,8 +158,8 @@ android { // Version code schema (not used): // "1.2.3-beta4" -> 1020304 // "1.2.3" -> 1020395 - versionCode 3020134 - versionName "4.9.3" + versionCode 3020135 + versionName "4.9.4" def commit = "" try { diff --git a/app/src/main/java/ac/mdiq/podcini/net/download/service/handler/FeedParserTask.kt b/app/src/main/java/ac/mdiq/podcini/net/download/service/handler/FeedParserTask.kt index f99ecaf7..305f9c83 100644 --- a/app/src/main/java/ac/mdiq/podcini/net/download/service/handler/FeedParserTask.kt +++ b/app/src/main/java/ac/mdiq/podcini/net/download/service/handler/FeedParserTask.kt @@ -33,7 +33,7 @@ class FeedParserTask(private val request: DownloadRequest) : Callable { val allowStreamThisTime = intent.getBooleanExtra(PlaybackServiceInterface.EXTRA_ALLOW_STREAM_THIS_TIME, false) diff --git a/app/src/main/java/ac/mdiq/podcini/storage/AutomaticDownloadAlgorithm.kt b/app/src/main/java/ac/mdiq/podcini/storage/AutomaticDownloadAlgorithm.kt index c36299b3..9750c4d4 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/AutomaticDownloadAlgorithm.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/AutomaticDownloadAlgorithm.kt @@ -42,6 +42,7 @@ open class AutomaticDownloadAlgorithm { // true if we should auto download based on power status val powerShouldAutoDl = (deviceCharging(context) || isEnableAutodownloadOnBattery) + Log.d(TAG, "prepare autoDownloadUndownloadedItems $networkShouldAutoDl $powerShouldAutoDl") // we should only auto download if both network AND power are happy if (networkShouldAutoDl && powerShouldAutoDl) { @@ -49,7 +50,9 @@ open class AutomaticDownloadAlgorithm { val candidates: MutableList val queue = getQueue() + val newItems = getEpisodes(0, Int.MAX_VALUE, FeedItemFilter(FeedItemFilter.NEW), SortOrder.DATE_NEW_OLD) + Log.d(TAG, "newItems: ${newItems.size}") candidates = ArrayList(queue.size + newItems.size) candidates.addAll(queue) for (newItem in newItems) { @@ -84,9 +87,7 @@ open class AutomaticDownloadAlgorithm { } } } - else { - Log.d(TAG, "not auto downloaded networkShouldAutoDl: $networkShouldAutoDl powerShouldAutoDl $powerShouldAutoDl") - } + else Log.d(TAG, "not auto downloaded networkShouldAutoDl: $networkShouldAutoDl powerShouldAutoDl $powerShouldAutoDl") } } diff --git a/app/src/main/java/ac/mdiq/podcini/storage/DBTasks.kt b/app/src/main/java/ac/mdiq/podcini/storage/DBTasks.kt index c5dce9c1..15877b95 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/DBTasks.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/DBTasks.kt @@ -222,6 +222,10 @@ import java.util.concurrent.* savedFeed.preferences!!.updateFromOther(newFeed.preferences) } + val priorMostRecent = savedFeed.mostRecentItem + var priorMostRecentDate: Date? = Date() + priorMostRecentDate = priorMostRecent?.getPubDate() + // Look for new or updated Items for (idx in newFeed.items.indices) { val item = newFeed.items[idx] @@ -282,6 +286,12 @@ import java.util.concurrent.* if (idx >= savedFeed.items.size) savedFeed.items.add(item) else savedFeed.items.add(idx, item) + + val pubDate = item.getPubDate() + if (pubDate == null || priorMostRecentDate == null || priorMostRecentDate.before(pubDate) || priorMostRecentDate == pubDate) { + Log.d(TAG, "Marking item published on ${pubDate} new, prior most recent date = $priorMostRecentDate") + item.setNew() + } } } diff --git a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/Feed.kt b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/Feed.kt index b266071d..7b489af9 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/Feed.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/Feed.kt @@ -205,10 +205,8 @@ class Feed : FeedFile { * This constructor is used for requesting a feed download (it must not be used for anything else!). It should be * used if the title of the feed is already known. */ - constructor(url: String?, lastUpdate: String?, title: String?, username: String?, password: String?) : this(url, - lastUpdate, - title) { - preferences = FeedPreferences(0, true, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF, + constructor(url: String?, lastUpdate: String?, title: String?, username: String?, password: String?) : this(url, lastUpdate, title) { + preferences = FeedPreferences(0, false, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF, FeedPreferences.NewEpisodesAction.GLOBAL, username, password) } diff --git a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedItem.kt b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedItem.kt index 762363b5..c78335ee 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedItem.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedItem.kt @@ -92,8 +92,7 @@ class FeedItem : FeedComponent, Serializable { */ constructor(id: Long, title: String?, link: String?, pubDate: Date?, paymentLink: String?, feedId: Long, hasChapters: Boolean, imageUrl: String?, state: Int, - itemIdentifier: String?, autoDownloadEnabled: Boolean, podcastIndexChapterUrl: String? - ) { + itemIdentifier: String?, autoDownloadEnabled: Boolean, podcastIndexChapterUrl: String?) { this.id = id this.title = title this.link = link @@ -111,14 +110,7 @@ class FeedItem : FeedComponent, Serializable { /** * This constructor should be used for creating test objects. */ - constructor(id: Long, - title: String?, - itemIdentifier: String?, - link: String?, - pubDate: Date?, - state: Int, - feed: Feed? - ) { + constructor(id: Long, title: String?, itemIdentifier: String?, link: String?, pubDate: Date?, state: Int, feed: Feed?) { this.id = id this.title = title this.itemIdentifier = itemIdentifier @@ -132,15 +124,7 @@ class FeedItem : FeedComponent, Serializable { /** * This constructor should be used for creating test objects involving chapter marks. */ - constructor(id: Long, - title: String?, - itemIdentifier: String?, - link: String?, - pubDate: Date?, - state: Int, - feed: Feed?, - hasChapters: Boolean - ) { + constructor(id: Long, title: String?, itemIdentifier: String?, link: String?, pubDate: Date?, state: Int, feed: Feed?, hasChapters: Boolean) { this.id = id this.title = title this.itemIdentifier = itemIdentifier diff --git a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedPreferences.kt b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedPreferences.kt index d11adb9d..4559e6b2 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedPreferences.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/model/feed/FeedPreferences.kt @@ -68,8 +68,8 @@ class FeedPreferences(@JvmField var feedID: Long, constructor(feedID: Long, autoDownload: Boolean, autoDeleteAction: AutoDeleteAction, volumeAdaptionSetting: VolumeAdaptionSetting?, newEpisodesAction: NewEpisodesAction?, - username: String?, password: String? - ) : this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, username, password, + username: String?, password: String?) + : this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, username, password, FeedFilter(), SPEED_USE_GLOBAL, 0, 0, false, newEpisodesAction, HashSet()) init { diff --git a/app/src/main/java/ac/mdiq/podcini/ui/actions/FeedMultiSelectActionHandler.kt b/app/src/main/java/ac/mdiq/podcini/ui/actions/FeedMultiSelectActionHandler.kt index 3873c222..2dc26133 100644 --- a/app/src/main/java/ac/mdiq/podcini/ui/actions/FeedMultiSelectActionHandler.kt +++ b/app/src/main/java/ac/mdiq/podcini/ui/actions/FeedMultiSelectActionHandler.kt @@ -57,7 +57,7 @@ class FeedMultiSelectActionHandler(private val activity: MainActivity, private v val preferenceSwitchDialog = PreferenceSwitchDialog(activity, activity.getString(R.string.auto_download_settings_label), activity.getString(R.string.auto_download_label)) preferenceSwitchDialog.setOnPreferenceChangedListener(@UnstableApi object: PreferenceSwitchDialog.OnPreferenceChangedListener { override fun preferenceChanged(enabled: Boolean) { - saveFeedPreferences { feedPreferences: FeedPreferences -> feedPreferences.autoDownload = enabled } +// saveFeedPreferences { feedPreferences: FeedPreferences -> feedPreferences.autoDownload = enabled } } }) preferenceSwitchDialog.openDialog() diff --git a/app/src/main/java/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt b/app/src/main/java/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt index 21ea5426..e961ead2 100644 --- a/app/src/main/java/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt +++ b/app/src/main/java/ac/mdiq/podcini/ui/fragment/AudioPlayerFragment.kt @@ -487,11 +487,11 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar txtvLength = binding.txtvLength setupLengthTextView() -// setupControlButtons() + setupControlButtons() butPlaybackSpeed.setOnClickListener { VariableSpeedDialog.newInstance(booleanArrayOf(true, true, true), null)?.show(childFragmentManager, null) } -// sbPosition.setOnSeekBarChangeListener(null) + sbPosition.setOnSeekBarChangeListener(this) binding.internalPlayerFragment.setOnClickListener { Log.d(TAG, "internalPlayerFragment was clicked") @@ -534,9 +534,9 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar requireContext().startActivity(PlaybackService.getPlayerActivityIntent(requireContext(), media.getMediaType())) } else controller!!.playPause() if (!isControlButtonsSet) { - setupControlButtons() +// setupControlButtons() sbPosition.visibility = View.VISIBLE - sbPosition.setOnSeekBarChangeListener(this) +// sbPosition.setOnSeekBarChangeListener(this) isControlButtonsSet = true } } @@ -548,6 +548,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar if (controller != null && controller!!.isPlaybackServiceReady()) { val curr: Int = controller!!.position controller!!.seekTo(curr - UserPreferences.rewindSecs * 1000) + sbPosition.visibility = View.VISIBLE } } butRev.setOnLongClickListener { @@ -569,6 +570,7 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar if (controller != null && controller!!.isPlaybackServiceReady()) { val curr: Int = controller!!.position controller!!.seekTo(curr + UserPreferences.fastForwardSecs * 1000) + sbPosition.visibility = View.VISIBLE } } butFF.setOnLongClickListener { @@ -632,8 +634,12 @@ class AudioPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener, Toolbar txtvLength.text = Converter.getDurationStringLong(duration) } + if (sbPosition.visibility == View.INVISIBLE && controller != null && controller!!.isPlaybackServiceReady()) { + sbPosition.visibility = View.VISIBLE + } if (!sbPosition.isPressed) { val progress: Float = (event.position.toFloat()) / event.duration +// Log.d(TAG, "updating sbPosition: $progress") sbPosition.progress = (progress * sbPosition.max).toInt() } } diff --git a/app/src/main/java/ac/mdiq/podcini/util/TimeSpeedConverter.kt b/app/src/main/java/ac/mdiq/podcini/util/TimeSpeedConverter.kt index d260f864..32cd8ef9 100644 --- a/app/src/main/java/ac/mdiq/podcini/util/TimeSpeedConverter.kt +++ b/app/src/main/java/ac/mdiq/podcini/util/TimeSpeedConverter.kt @@ -7,10 +7,10 @@ class TimeSpeedConverter(private val speed: Float) { * @param time time to convert * @return converted time (can be < 0 if time is < 0) */ - fun convert(time: Int): Int { - val timeRespectsSpeed = UserPreferences.timeRespectsSpeed() - if (time > 0 && timeRespectsSpeed) return (time / speed).toInt() + var timeRespectsSpeed: Boolean = UserPreferences.timeRespectsSpeed() + fun convert(time: Int): Int { + if (time > 0 && timeRespectsSpeed) return (time / speed).toInt() return time } } diff --git a/changelog.md b/changelog.md index 029d1015..6ede50ed 100644 --- a/changelog.md +++ b/changelog.md @@ -300,4 +300,13 @@ * show toast message when episode home views are not available * fixed crash bug on app startup when player buttons are clicked before play * large codebase cleaning -* episode home menu item is disable on video player \ No newline at end of file +* episode home menu item is disable on video player + +## 4.9.4 + +* fixed non-functioning pause button in queue list +* fixed player control buttons not being properly activated +* enabled the function for auto downloading of feeds + * when global auto download setting is enabled, no existing feed is automatically included for auto download + * when subscribing a new feed, there an option for auto download + * new episode of a feed is auto downloaded at a feed refresh only when both global and feed settings for auto download are enabled \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/3020135.txt b/fastlane/metadata/android/en-US/changelogs/3020135.txt new file mode 100644 index 00000000..2447e3db --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3020135.txt @@ -0,0 +1,9 @@ + +Version 4.9.4 brings several changes: + +* fixed non-functioning pause button in queue list +* fixed player control buttons not being properly activated +* enabled the function for auto downloading of feeds + * when global auto download setting is enabled, no existing feed is automatically included for auto download + * when subscribing a new feed, there an option for auto download + * new episode of a feed is auto downloaded at a feed refresh only when both global and feed settings for auto download are enabled